Re: filtering specific pixels



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
.



Relevant Pages

  • Re: filtering specific pixels
    ... >> i have an original image, of which i used a canny edge detector ... >> but the resultant image from the canny filter is a binary ... > What we are doing here is any pixel which is far away from your ...
    (comp.soft-sys.matlab)
  • Re: filtering specific pixels
    ... > i have an original image, of which i used a canny edge detector on. ... > filtered image, then command the filter to do 3x3 average filtering ... What we are doing here is any pixel which is far away from your lines ...
    (comp.soft-sys.matlab)
  • Re: filtering specific pixels
    ... > 1) Take a copy of your image and apply your 3x3 filter to the lot. ... > Gaussian with a few pixels standard deviation. ... > 3) Take your original image and your filtered version of your image ... > undertake a graceful transition between the original pixel, ...
    (comp.soft-sys.matlab)
  • Re: Double hires mode color artifacts
    ... expect of an Apple II, given its resolution and color limitations. ... essentially no change after the window had filled with 14 "dots". ... pixel on host pixel boundaries. ... A filter of 4 bit width in hires should be already sufficent for that. ...
    (comp.sys.apple2)
  • Re: Rookie having problems with some filter code. Any help?
    ... > Frederic Patin's paper titled "An Introduction to Digital Image ... > filter ever written". ... And then constructing a Color pixel from the filtered result? ... I don't think 'Normalizer' is of much ...
    (sci.image.processing)

Loading