Finding the Brightest Pixel in an Image
Afficher commentaires plus anciens
I have an RGB image, but its mostly black with different areas of shining light. I want my code to find the pixel where the light is shining brightest and mark that pixel but I'm not sure how.
Any help is appreciated. Thanks.
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 26 Oct 2012
An alternative is to convert your image to monochrome by using rgb2gray() or taking just one of the color channels,
% Convert to gray with a weighted average of the R, G, and B channels.
grayImage = rgb2gray(rgbImage);
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Then using imregionalmax() on whichever monochrome image you create. This will find ALL of the shiny peaks of light, with the brightest of those being just one of the peaks that it finds. But in general to find the brightest spot, use the method Sean gave. If you want to go further and find the one pixel that is the centroid of that spot, then you need to call regionprops(). See my Image Segmentation Tutorial if you want an example.
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!