How to recieve Brightness-Value?


#1

Hello,

I’m just starting to use ImageJ.

I work with the Color-Threshold-Feature and managed to use the Macrofunction for it.
The problem is, that each of my pictures has a slighty different Brightness-level.
I was wondering, if its possible to get the highest Brightnessvalue.
I can look it up manually: Analyse -> Histogram -> List
For my sample Picture the highest value is in Row 200 ->270103
I’m looking for a command to get ‘200’ as a Result.
I found the

Does anyone know a solution?

Kind regards


#2

Good day Tobias,

you write and the topic implies that you are loooking for the maximum value of images:

if its possible to get the highest Brightnessvalue

but then you want the position of this value:

the highest value is in Row 200 ->270103

So what is your desire?

Regards

Herbie


#3

Yes,I wanted to use the position(!) for a Colourthreshold-macro.
It took some time but i figured it out already :slight_smile:
Don’t think it is very smooth but it works.

 getHistogram(values, counts, 256); 
      pos=0
      z=0
      itemp = counts[1];
for( i=0; i<255; i++) {
	z=z+1; 
     if (itemp<(counts[z])) 
     {
		itemp = counts[z];
		pos= z;
     } 
}
      print(pos, counts[pos]);

Thank you


#4

Sorry Tobias,

but how do you expect to get a position in the image from its histogram.

Puzzeled

Herbie