Re: filtering specific pixels
- From: "Dave Robinson" <dave.robinson@xxxxxxxxxxxxx>
- Date: Thu, 26 Jan 2006 05:00:39 -0500
Leonard wrote:
>
>
> Dave Robinson wrote:
>>
>>
>>> i have an original image, of which i used a canny edge
> detector
>> on.
>>> then, i have to remove the lines detected.
>>> but the resultant image from the canny filter is a binary
> image,
>>> while my original is an indexed image.
>>> how do i find the pixel location of the edges(white pixels)
> in
>> the
>>> filtered image, then command the filter to do 3x3 average
>> filtering
>>> on those pixels only in my original image, but not on the
> whole
>>> image?
>>
>> The way I might be tempted to tackle this problem is as
follows.
>>
>> 1) Take a copy of your image and apply your 3x3 filter to the
> lot.
>>
>> 2) Take your Canny image and filter it using something like a
>> Gaussian with a few pixels standard deviation. This gives you a
>> rough
>> and ready measure of how close you are to one of your lines.
That
>> is
>> to say it will have a value of '1' when you are sitting on top
of
> a
>> line, and will get smaller as you move away from it. We can
call
>> this
>> the Alpha image
>>
>> 3) Take your original image and your filtered version of your
> image
>> and mix them using something like
>>
>> Mixed_Pixel = Alpha_Pixel*Filtered_Pixel +
>> (1-Alpha_Pixel)*Original_Pixel;
>>
>> What we are doing here is any pixel which is far away from your
>> lines
>> is pure original image, whereas the closer you get to a line,
you
>> undertake a graceful transition between the original pixel, and
> the
>> filtered pixel. When you are exactly on a line you are purely
> using
>> the filtered image.
>>
>> The width of the transition zone is controllable by the
variance
> of
>> the Gaussian you used to filter your Canny edge image with, and
> can
>> be made as wide or as narrow as you require. I think this will
>> generate a much more pleasing result than just treating the
exact
>> edge pixels shown by the Canny, which is probably only showing
> the
>> position of the maximum slope of the edge.
>>
>> It will obviously automatically work for any image, once you
have
>> the
>> parameters of your 3x3 filter, and the Gaussian variance
> specified.
>>
>> Hope this helps
>>
>> Dave Robinson
>
> i tried your method, but it was disastrous - the lines appeared
> white
> on the output image.
> that is to say, there is no transition between the filtered and
> original image, but thick white lines running through the output
> image.
> with regard to my previous post, am i doing anything wrong?
You appear to be amplifying your lines, which suggests to me that
your canny image has its active pixel expressed as 255 not 1 as I
expected. This way when you multiply by the alpha pixel you are
getting the effect that you describe (sounds of guessing wildly;-).
Try taking your filtered canny image and divide it throughout by its
maximum pixel value, thus creating an alpha image whose pixel values
are doubles between 0 & 1 (i.e. normalize it), and try again. The
algorithm should never generate a pixel value that isn't bounded by
the intensity of the original image and the averaged image.
Hope that helps
Dave Robinson
.
- References:
- filtering specific pixels
- From: Leonard
- Re: filtering specific pixels
- From: Rune Allnor
- Re: filtering specific pixels
- From: Leonard
- Re: filtering specific pixels
- From: Dave Robinson
- Re: filtering specific pixels
- From: Leonard
- filtering specific pixels
- Prev by Date: Re: dependencies
- Next by Date: Re: about QUAD... with IF
- Previous by thread: Re: filtering specific pixels
- Next by thread: Conditional probability calculation@Matlab
- Index(es):
Relevant Pages
|
Loading