Re: connected component labeling problem in a graylevel image without background [message #32559 is a reply to message #32507] |
Tue, 15 October 2002 09:22  |
Julia
Messages: 11 Registered: July 2002
|
Junior Member |
|
|
If the hist_nd.pro is like to manufacture X and Y profiles of the marbles. I
do not think it can solve this. Considering the situation that two regions
with the same gray level, but they do not touch each other, and they are
very near and their boundaries are zigzag, I think their projection will
overlap in any direction.
Cheers,
Julia
"Ben Tupper" <btupper@bigelow.remove.org> wrote in message
news:n9eoquc3r17slgfekcq3ui8oqv6gkt3ntk@4ax.com...
> On Fri, 11 Oct 2002 10:38:48 -0600, David Fanning <david@dfanning.com>
> wrote:
>
>> Julia (julia65201@yahoo.com) writes:
>>
>>> But I think you kind of misunderstood my problem, maybe due to my not
very
>>> clear expression. :)
>>>
>>>> >" The problem is like a grayscale photograph of a jar of
>>>> >marbles. Each marble is uniformly gray. All the marbles are touching
each
>>>> >other, so there is no
>>>> >background. Two marbles of the same color may not belong to the
same
>>>> >region.
>>>> >I want to give a unique label to each marble/region."
>>>
> snip
>>
>> P.S. Let's just say I'd bet some good money even the
>> HISTOGRAM function can't get us out of this one. :-)
>
> Oh! Wait, wait! Maybe you could use histogram! At least, for the
> easiest of the marbles. Consider an image (dimx, dimy) with a
> couple of gray circles (gray pixels have index addresses ind).
>
> Start with the indices of each gray level from the original histogram
> (use reverse_indices to pull out these indices.) Convert the indices
> to cartesian coords.
>
> x = ind mod dimx
> y = ind/dimx
>
> Use histogram (actually, JD's hist_nd.pro ... I found it using
> Google) to manufacture X and Y profiles of the marbles.
>
> ; hist=HIST_ND(V,BINSIZE,MIN=,MAX=,NBINS=,REVERSE_INDICES=)
>
> v = transpose([[x],[y]])
> binsz = [1,1]
> hh = hist_nd(v, binsz, min = [0,0], max = [dimx-1, dimy-1])
>
> Now, peak at the resulting histograms in each dimension - these will
> be like profile plots or the original image for each gray level n. (I
> suppose these could be called shadow plots along each dimension.)
>
> !p.multi = [0,1,2]
> Plot, hh[0,*], title = 'x profile'
> Plot, indgen(dimx), hh[1,*], title = 'y profile'
>
> If the marbles do not overlap (in a dimension), then the center of
> mass of each marble along each dimension should be easy to find. If
> they do overlap - well that's a new kind of problem. I suppose that
> you are not limited to the X and Y axes - that is, you could develop a
> profile along any arbitrarily rotated axis. That math gets a bit
> fuzzy for me after this point, but it should be just a geometry game.
>
> I don't IDL in front of me this morning - so this is cut and pasted
> from my own wobbly memory (and it still a bit early in the morn'.)
>
> Cheers,
> Ben
|
|
|