필터 지우기
필터 지우기

How to calculate intensity value of an image ?

조회 수: 34 (최근 30일)
julia jemila
julia jemila 2013년 3월 22일
편집: Image Analyst 2022년 3월 2일
i'm doing project in Image retrieval using Krawtchouk moment .. we are calculating the moment value but to do this.. we need to know the intensity value of an image.. plz help us..

채택된 답변

Image Analyst
Image Analyst 2013년 3월 22일
The image is in a variable. This is an array with rows and columns. The value of the array at each row and column is the intensity. So you already have it.
  댓글 수: 7
julia jemila
julia jemila 2013년 3월 24일
편집: Image Analyst 2013년 3월 24일
o=imread('car.jpg');
i=rgb2gray(o);
imshow(i)
[r c]=size(i);
s=0;
for p=1:c
for q=1:r
px=impixel(i,c,r);
s=px(1,1)+s;
end
end
s
This is how we calculated the total intensity value. Is it correct or we have to do it for every f(x,y) value?
Image Analyst
Image Analyst 2013년 3월 24일
NO it's not right. you're just summing up the last pixel, (r,c) which is the very lower right pixel, so the value is just the gray level of that pixel times the number of pixels in the image - a totally useless thing. If you just want to sum up the gray level version of your rgb image, you can do this:
rgbImage = imread('car.jpg');
grayImage = rgb2gray(rgbImage);
sumOfAllGrayLevels = sum(grayImage);
But I doubt that is a Krawtchouk moment.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Mona
Mona 2013년 6월 25일
how can i find : the total number of possible intensity levels in hyper image?
is it the total number of bands?
  댓글 수: 1
Image Analyst
Image Analyst 2013년 6월 25일
Check out the class of the image. If it's uint8, you can have 256 intensity values. If it's uint16, there are 65536 values. If it's color, there are 256*256*256 possible values for a color uint8 image, and 65536*65536*65536 possible values for a color uint16 image.

댓글을 달려면 로그인하십시오.


Poornima Devi
Poornima Devi 2018년 1월 23일
Sir I am also doing a project which includes the calculation of intensity of each pixel soo can I get the perfect code for it pleaseeeee sir it's urgent
  댓글 수: 3
YOGITAA YOGITAA
YOGITAA YOGITAA 2022년 3월 2일
could you please share the code?
Image Analyst
Image Analyst 2022년 3월 2일
편집: Image Analyst 2022년 3월 2일
@Poornima Devi, @Aatheeswaran M, and @YOGITAA YOGITAA, the image array is already the intensity of each pixel. There is nothing left to do - you have it already. If you want the intensity along one particular row only, you can use indexing:
row = 42; % Whatever row you want
horizontalProfile = grayImage(row, :);
If you want the mean of that row, you can use mean():
meanGrayLevel = mean(horizontalProfile);
If you'd like to see an tutorial on image segmentation, see it on my File Exchange page:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by