MATLAB: Want to get these values in the code

digital image processingimage processingImage Processing Toolbox

i need these values in my code ..
when i select the mouse courser on a point . it automatically pass to my code

Best Answer

If you just want to see the values on your GUI as you mouse around, use impixelinfo().
If you want to click on some pixels and get the values in an array, use impixel():
impixel(I) returns the value of pixels in the specified image I, where I can be a grayscale, binary, or RGB image. impixel displays the image specified and waits for you to select the pixels in the image using the mouse. If you omit the input arguments, impixel operates on the image in the current axes.
Use normal button clicks to select pixels. Press Backspace or Delete to remove the previously selected pixel. To finish selecting pixels, adding a final pixel, press shift-click, right-click, or double-click. To finish selecting pixels without adding a final pixel, press Return.
When you finish selecting pixels, impixel returns an m-by-3 matrix of RGB values in the supplied output argument. If you do not supply an output argument, impixel returns the matrix in ans. impixel always returns pixel values as RGB triplets, regardless of the image type: