How do I find pixel intensity in ROI and color based on intensity?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an image in a GUI where I draw a ROI. I wish to find the various intensities of pixels with the ROI, and change their color (r, b, g) based on their intensity. How can I do this? Here is the code I use for the ROI.
r = impoly;
mask = createMask(r);
roi = mask .* y{1};
imshow(roi)
idx = find(bw);
im(idx);
mean(im(idx))
std(im(idx))
I hope someone can help me.
0 commentaires
Réponses (1)
Arun Mathamkode
le 12 Juin 2018
If you want the community to understand your code and help you, you may need to provide bit more details about your code and your use case. For example, in this case, I am not really sure what are the variables y, im and bw represent. I am not really sure about whether you want to find the mean intensity in the ROI or you want to find all the unique intensities in the ROI. What do you mean by changing colors based on intensity?
If you are using a grayscale image im and based on the pixel value you want to assign a certain color at these locations, you may probably want to use find command which finds the locations of a specific intensity k and you can assign any specific color (r,g,b) to that locations.
im_new=repmat(im,1,1,3);
[idx idy]=find(im==k);
im_new(idx,idy,:)=[ r, g ,b];
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!