Hey,
not sure what you mean by "maximum intensity". Is it brightness?
I have never worked with MATLAB, but i can show you how to do it in processing, and maybe you can transfer the principle.
- PImage img;
int[] bright; // array with index of brightest pixels
float highBright; // highest value for brightness found so far
void setup() {
size(300, 300);
// load image
img = loadImage("example.jpg");
// loop throught all pixels of the image
img.loadPixels();
for (int i =0; i< img.pixels.length; i++) {
// get brightness of current pixel
float curBright = brightness(img.pixels[i]);
// if brightness is higher than previous pixels, create new array
if (curBright > highBright) {
highBright = curBright;
bright = new int[] {i};
}
// if brightness is equal to highest brightness, add pixel-index to array
else if (curBright == highBright) {
bright = append(bright, i);
}
}
img.updatePixels();
// show image
image(img, 0, 0);
// show results
noFill();
stroke(255, 0, 0);
for (int i = 0 ; i< bright.length; i++) {
int x = bright[i]%img.width;
int y = bright[i]/img.width;
ellipse(x, y, 10, 10);
println("x: "+ x + " y: "+y);
}
println(bright.length + " pixels with a brightness of "+highBright);
}