MATLAB: Intensity value of the pixel located

homeworkImage Processing Toolbox

I have this question :
1-Read an image.
2-Show that image.
3-Write the image to the disk by new name.
4-Show additional info about image.
5-How to get the size of that image.
6-What is the intensity value of the pixel located at position(4,7)?
*I solved the previous five questions, but how can I solve the sixth question
figure
image=imread('Picture2.jpg')
imshow(image)
gray = rgb2gray(image)
imwrite(image,'House.jpg');
information = imfinfo('House.jpg')
information = information.FileSize

Best Answer

Your image is stored as a matrix in MATLAB. So, for getting the pixel intensity value you need to read the image:
image_mat = rgb2gray(imread('image.jpg')); % image_mat is simply a matrix
disp(image_mat(4, 7)); % Intensity at (4,7)