Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can't approximate an Image with a polygon, you need to to find some contours first.

it's not a matter of converting Mat types.

to do it, you need to: 1. binarize your (grayscale) image using threshold, compare or Canny 2. findContours() in the binary image , probably filter out stuff you don't want 3. now you can approxpoly those contours

you can't approximate an Image with a polygon, you need to to find some contours first.

it's not a matter of converting Mat types.

to do it, you need to: 1. to:

  1. binarize your (grayscale) image using threshold, compare or Canny 2. Canny
  2. findContours() in the binary image , probably filter out stuff you don't want 3. want
  3. now you can approxpoly those contours

you can't approximate an Image with a polygon, you need to to find some contours first.

it's not a matter of converting Mat types.types, you're missing some processing steps.

to do it, you need to:

  1. binarize your (grayscale) image using threshold, compare or Canny
  2. findContours() in the binary image , probably filter out stuff you don't want
  3. now you can approxpoly those contours