Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Turn HFS result into Contours

I suspect I'm missing something obvious but I can't sort out the best way to turn my segmented results into contours. I am using the cv2.hfs module and the preview looks great for my purposes. But I need to get a set of contours with centers, orientation etc. But the output of performSegmentCpu gives me a posterized or false-color image.

What's the best way to turn this into a set of contours?

Do I need to iterate through the whole output checking for unique pixel values and then do some kind of threshold for those pixels so I can run it through findContours?

The docs mention that the default result of hfs.performSegmentCpu is a "matrix of index" but I can't imagine what that is or how I would access it.