Menu

detecting contour/border

c_cosmin
2017-03-14
2017-03-14
  • c_cosmin

    c_cosmin - 2017-03-14

    Hi,

    I'm trying to make a function to detect opaque and/or partially opaque pixels which are in a specific range (1..9) of fully transparent pixel(s).
    In other words: to detect the border/contour of a shape in a transparent image.
    I have made some progress, a function with 4 cycles, but it's very slow.
    I was wondering if I could use some functions from your library to make it faster. Maybe the ContourDetector function?
    Could be used for this?

    Thank you.

     
  • Yermalayeu Ihar

    Yermalayeu Ihar - 2017-03-15

    If I had to solve simular task I would try to do something like this:

    1) Extract alpha channel (for example see SimdDeinterleaveBgra).
    2) Optional: boost contrast (see SimdBinarization or SimdAbsGradientSaturatedSum).
    3) ContourDetector

     
  • c_cosmin

    c_cosmin - 2017-03-15

    Thank you.

    The alpha channel is already extracted.

    Using the contour detector function would give the border pixels (of 1 pixel thick). For the 2..9 I would have to use my function again (searching for neighbour pixels).
    On average it would be a speed improvement, but not that big...

     

Anonymous
Anonymous

Add attachments
Cancel