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

4 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Image Analyst
Image Analyst il 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 Commenti
Image Analyst
Image Analyst il 24 Apr 2013
Well, then you'd better track down why the BlueFish image is basically null.
Ryan
Ryan il 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!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by