How do i obtain a single pixel value in a grayscale image by clicking on it?

5 views (last 30 days)
I have a GUI snd i need to obtain a pixel value of one of my images so i can set a threshold for segmentation. I only want one pixel value and want the user to click on the picture to find the specific value. Does ginput do this or is there something to ginput that i can use?

Accepted Answer

Image Analyst
Image Analyst on 23 Apr 2013
See my interactive thresholding app : http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image. It should work beautifully for all type of grayscale images - let me know if it doesn't. Other than that, use ginput() to get the column,row coordinates
[column, row] = ginput(1);
grayLevel = image(row, column);
or use impixelinfo() to get the gray level "live" as you move the mouse around over the image.
  7 Comments
Image Analyst
Image Analyst on 24 Apr 2013
Well, then you'd better track down why the BlueFish image is basically null.
Ryan
Ryan on 24 Apr 2013
I didnt have BlueFish set to global earlier in my program! That basically null comment clicked in my brain! Thank you so much for your help! I now have a set of RGB Values!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!