MATLAB: How to get the pixel value and the location in an image

@image analystImage Processing Toolbox

Hi to evryone,
I am looking for a code, that find and write the location and the value (attomatically)of each pixel in an image ..
I know that there is a lot of work need to do insted of asking, but I am welling to collacet any help to do that code
Welling to have an answer from my fellow freinds here in this community..
Best of all wishes

Best Answer

See ginput(). For example, run this
img = imread('pears.png');
imshow(img)
[x, y] = ginput(1);
pixel_values = img(floor(x), floor(y), :);
disp(pixel_values)