MATLAB: Finding the Brightest Pixel in an Image

image processingImage Processing Toolbox

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.

Best Answer

Well we have to figure out how to define "brightest". Is red brighter than blue?
Anyway, if we say brightness is the sum of the RGB channels, then the max pixel will be:
I = your_image;
S = sum(I,3) %
[~,idx] = max(S(:));
[row,col] = ind2sub(size(S),idx);