Re: Image analysis and ring identification [message #30271] |
Thu, 18 April 2002 08:07  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Paul Van Delst wrote:
> Rachel Pepper wrote:
>
>> Actually, the rings often have a bright spot that is not in the center of
>> the ring, so I don't think the centroiding technique will work. Do you have
>> any other suggestions?
>
>
> Once you've isolated the region of interest within the ring (the hardest part I reckon), can't
> you just determine the bright spot location by finding it's location via MAX using the image
> intensities?
Yes, but I didn't get the impression that he wants to find the bright
spot. He asked how to determine the center of the circle, and complained
about the fact that the bright spot would mess up the centroid-based
method of calculating the center, because the bright spot was off-center.
|
|
|
Re: Image analysis and ring identification [message #30272 is a reply to message #30271] |
Thu, 18 April 2002 06:44   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
>
> Rachel Pepper (Rachel_Pepper@brown.edu) writes:
>
>> Actually, the rings often have a bright spot that is not in the center of
>> the ring, so I don't think the centroiding technique will work. Do you have
>> any other suggestions?
>
> I think Paul's suggestions are right on the money,
> but I wouldn't give up on the centroid theory too
> quickly. The wonderful thing about centroids is that
> they are really center of mass calculations. So if
> the values you total are actual image values,
> then the centroid will naturally zero in on
> bright spots, since they are "heavier" in the
> calculations.
Personally I prefer the centroid method. I think its more accurate than simple peak-finding. If
the bright spot is a nice gaussian shape, then determing the maximum will probably do the job.
In the real world nice smooth shapes are rare, so the centroid method is the way to go.
My experience in this area is with finding the centroid of a satellite instrument channel
spectral response function (SRF). An SRF is determined by the detector response, properties of
optical components directing the radiation onto the detector, the instrument field of view etc.
etc. The resultant SRF is replete with bumps, wiggles, and shimmies. Calculating the first
moment of the SRF (the frequency centroid) is really the only way to do it accurately. If it's
not done accurately, then any calculated Planck function radiances will be slightly incorrect
and this will introduce a frequency dependent bias in any comparison of satellite observations
with calculations. That is not a Good Thing (tm).
If the OP's particles are "macroscopic" (i.e. she's not searching for Higg's bosons amidst a
slurry of those pesky W and Z particles :o) and have a shape to them, then the centroid method
is recommended.
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|
|
Re: Image analysis and ring identification [message #30277 is a reply to message #30275] |
Thu, 18 April 2002 05:37   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Rachel Pepper wrote:
>
> Actually, the rings often have a bright spot that is not in the center of
> the ring, so I don't think the centroiding technique will work. Do you have
> any other suggestions?
Once you've isolated the region of interest within the ring (the hardest part I reckon), can't
you just determine the bright spot location by finding it's location via MAX using the image
intensities?
e.g. if the variable blob_index contains the indices of the pixels blob_image within the ring,
then
max_spot_value = MAX( blob_image[ blob_index ], max_spot_index )
Doesn't matter where the bright spot is. Or, if you're looking for regions where the
intensities are greater than some value, say max_spot_threshold, use WHERE:
max_spot_index = WHERE( blob_image[ blob_index ] GT max_spot_threshold, max_spot_count )
IF ( max_spot_count EQ 0 ) THEN $
MESSAGE, 'No bright spot found!'
In both cases, of course, max_spot_index references the blob_index array, not the actual image
array.
?
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|
Re: Image analysis and ring identification [message #30281 is a reply to message #30277] |
Wed, 17 April 2002 21:21   |
Rachel Pepper
Messages: 3 Registered: April 2002
|
Junior Member |
|
|
Actually, the rings often have a bright spot that is not in the center of
the ring, so I don't think the centroiding technique will work. Do you have
any other suggestions?
Thanks,
Rachel
David Fanning wrote:
> Rachel Pepper (Rachel_Pepper@brown.edu) writes:
>
>> I am a fairly new IDL user trying to use image analysis to determine
>> particle positions in my images. After filtering the images, they
>> appear to be bright rings around a dark center. I was wondering if
>> anyone knew a routine to fit these sorts of images to a circle so that
>> the center of the ring could be determined. Thanks for any help!
>
> If you can isolate the "blobs" (as we usually call them) in
> your image (e.g., with Label_Region or with something home-grown)
> and obtain the indices of the pixels in the blob, then you can
> calculate the centroid of the pixel distribution in the manner
> described on this page:
>
> http://www.dfanning.com/tips/centroid.html
>
> Craig Markwardt wrote me a nifty little routine one time
> to then fit an ellipse to the pixel distribution in an
> attempt to characterize the size, shape, and orientation
> of the blobs. I keep meaning to make this algorithm available,
> but I haven't gotten around to it yet. (And I don't really
> what to cut into Craig's significant income as the Expert's
> Expert, if you know what I mean.)
>
> Cheers,
>
> David
>
> P.S. By the way, Craig. I put that check in the mail to
> you today. Really! :-)
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Image analysis and ring identification [message #30310 is a reply to message #30281] |
Wed, 17 April 2002 07:29   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Rachel Pepper (Rachel_Pepper@brown.edu) writes:
> I am a fairly new IDL user trying to use image analysis to determine
> particle positions in my images. After filtering the images, they
> appear to be bright rings around a dark center. I was wondering if
> anyone knew a routine to fit these sorts of images to a circle so that
> the center of the ring could be determined. Thanks for any help!
If you can isolate the "blobs" (as we usually call them) in
your image (e.g., with Label_Region or with something home-grown)
and obtain the indices of the pixels in the blob, then you can
calculate the centroid of the pixel distribution in the manner
described on this page:
http://www.dfanning.com/tips/centroid.html
Craig Markwardt wrote me a nifty little routine one time
to then fit an ellipse to the pixel distribution in an
attempt to characterize the size, shape, and orientation
of the blobs. I keep meaning to make this algorithm available,
but I haven't gotten around to it yet. (And I don't really
what to cut into Craig's significant income as the Expert's
Expert, if you know what I mean.)
Cheers,
David
P.S. By the way, Craig. I put that check in the mail to
you today. Really! :-)
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Image analysis and ring identification [message #30368 is a reply to message #30275] |
Thu, 18 April 2002 08:37  |
Dan Larson
Messages: 21 Registered: March 2002
|
Junior Member |
|
|
In article <MPG.172872a05bbf04f3989895@news.frii.com>, david@dfanning.com
says...
> Rachel Pepper (Rachel_Pepper@brown.edu) writes:
>
>> Actually, the rings often have a bright spot that is not in the center of
>> the ring, so I don't think the centroiding technique will work. Do you have
>> any other suggestions?
>
> I think Paul's suggestions are right on the money,
> but I wouldn't give up on the centroid theory too
> quickly. The wonderful thing about centroids is that
> they are really center of mass calculations. So if
> the values you total are actual image values,
> then the centroid will naturally zero in on
> bright spots, since they are "heavier" in the
> calculations.
>
> Cheers,
>
> David
>
I have seen this issue arise a number of times:
what is the best way to find the center of a
sub-resolution object?
A sub-resolution object will appear in the image
as a point spread function that is well
approximated by a Guassian. However, as Paul noted,
one is usually dealing with noisy data, and the
Gaussian is rarely smooth. Centroid approaches
work well in this situation.
I use an algorithm which is intermediate
in complexitiy between a centroid (essentially
a binary mask) and a full non-linear least squares
fit to a Gaussian. This algorithm is a centroid-like
approach that uses an error function to obtain the mask.
It is iterative and therefore slower than a simple centroid,
but it is much more accurate and works well in noisy,
pixelated environments. This 'Gaussian mask' algorithm is
way more robust than a full non-linear least squares fit
(say Levenberg-Marquadt).
My implementation is below. There is some other junk in the
code, but I think the idea is clear.
Cheers,
Dan
FUNCTION gmask_fit, spot, psf_width, black_level, x_dim, y_dim
; gmask_fit calculates the center of a psf using an iterative gaussian
mask
; (Thompson, Larson, Webb, Biophysical Journal, in Press)
;
; Dan Larson
; 4/18/02
x0=0.0
y0=0.0
pi=3.1415926
F=1.0/(sqrt(2.0)*psf_width)
gauss_mask = dblarr(x_dim, y_dim)
error = 0.0
results=dblarr(3)
; offset correction
image=spot-black_level
; boundary condition. border is set to zero
image[0, *]= 0.0
image[x_dim-1, *]= 0.0
image[*, 0]= 0.0
image[*, y_dim-1] = 0.0
; easy localisation by finding the centroid of the image
center=fast_centroid(image)
x0=center[0]
y0=center[1]
; iterative centroid calculation with gaussian mask
h = 1.0e-8 ; tolerance
diff_x=0.0
diff_y=0.0
repeat_index=0
x_dim = long(x_dim)
y_dim = long(y_dim)
array=lindgen(x_dim, y_dim)
xarr=array mod x_dim
yarr=array/x_dim
REPEAT begin
x0=x0 + diff_x/2.0
y0=y0 + diff_y/2.0
a=F*(yarr - 0.5 - y0)
b=F*(yarr + 0.5 - y0)
c=F*(xarr - 0.5 - x0)
d=F*(xarr + 0.5 - x0)
gauss_mask =0.25*(errorf(a)-errorf(b))*(errorf(c)-errorf(d))
sum=total(image*gauss_mask)
trial_x0=total(xarr*image*gauss_mask)
trial_y0=total(yarr*image*gauss_mask)
diff_x = trial_x0/sum - x0
diff_y = trial_y0/sum - y0
;print, diff_x, diff_y
repeat_index=repeat_index+1
endrep until (abs(diff_x LT h)) and (abs(diff_y) LT h) or (repeat_index
GT 300)
if (repeat_index GT 300) then begin
print, "GMASK ITERATION MAXED OUT (number of iterations=",
repeat_index, ")"
results[2]=0.0
return, results
endif
if (repeat_index LE 300) then print, "gmask_fit convergence satisfied
(number of iterations=", repeat_index, ")"
; photon number calc
sum = total(gauss_mask*gauss_mask)
N = total(image*gauss_mask)
photon_number = N/sum;
results[0]=x0
results[1]=y0
results[2]=photon_number
return, results
end
|
|
|
Re: Image analysis and ring identification [message #30369 is a reply to message #30271] |
Thu, 18 April 2002 08:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
James Kuyper (kuyper@gscmail.gsfc.nasa.gov) writes:
> Yes, but I didn't get the impression that he wants to find the bright
> spot. He asked how to determine the center of the circle, and complained
> about the fact that the bright spot would mess up the centroid-based
> method of calculating the center, because the bright spot was off-center.
Isn't language odd? I thought she asked how to find the
center of the ring, but then realized she wasn't interested
in the center, but in the bright spot, which wasn't necessarily
in the center. I think she might be able to have her cake
and eat it too, depending upon the values she uses to
calculate the centroid. In fact, she might even learn
something fascinating about her rings by measuringg how
the centroid changes between the two different calculations.
But, hang on a minute! We don't have to be Aristotle and
his friends arguing endlessly about how many teeth a
horse has, we can ask the source. Rachel, what in the
world are you asking about?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|