Matrix values of an Image

조회 수: 4 (최근 30일)
Muthuraj V
Muthuraj V 2011년 11월 17일
can anyone tell me how can i get the matrix values(i.e pixel vales) of an image and store it for further analysis..?

답변 (1개)

Amith Kamath
Amith Kamath 2011년 11월 17일
I = imread('rice.png');
Now I includes the pixel values from the image 'rice.png' as a matrix, of size equal to the resolution of the image, and you could then access the values as I(pixel_y,pixel_x). Note that the pixel indices start from the left top, instead of left bottom as we are usually used to.
imshow(I(1:100,1:100)) %to show the first 100 pixels from the left top
figure, imshow(I) %Compare it with the entire image.
you could also cast the data into other types, based on how you want the numbers to be stored. The value in this example is uint8, which ranges from [0 - 255].

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by