I want to systematically measure image intensity around each of the points in this 256x256 image.
i0:
I already have centroid locating code to figure out the centers of each of these points. To measure the intensity around each point within a set radius I was planning on using ImageMeasurements with a systematically created Mask using Graphics.
The masking graphic for a particular point:
mask = Graphics[{Black, Rectangle[{0, 0}, {256, 256}], White,
Disk[Abs[{0, 256} - pos], 7]}];
Where pos is the position of the particular point of interest, in this case {66.6664, 8.74333}. The Abs[{0, 256} - pos] is to get the disk in the disk in the correct position due to different image indexing and graphic indexing.
i1:
Next I planned to use
ImageMeasurements[i0,"Mean",Masking->i1]
However to check whether the mask was measuring what I thought it was I took a look at ImageMultiply
. What worries me is this: when I do ImageMultiply[i0,i1]
the result is:
i0 * i1
I found a work around by using
ImageMultiply[i0,Image[Show[i0,i1]]]
i0 * Image[Show[i0,i1]]
And indeed the two masks: i1 and Image[Show[i0,i1]]
give different results with ImageMeasurements. I'm inclined to think the later mask gives the right answer. But I am wondering why ImageMultiply[i0,i1]
produces such a noticeably undesired result. I found this article to be interesting, as it discusses how ImageSize can possibly mess things up because one function displays in "printer pixel" sizes (72 ppi) and the other in "screen resolution" pixel sizes.
Does anybody know what options I am missing with ImageMultiply[i0,i1]
? Why it does not work correctly? Or know a better approach to my problem?
Much thanks
traj
or modify your code so that it is not needed $\endgroup$i1 // ImageDimensions
is not the same asi0 // ImageDimensions
$\endgroup$