peterbraden/node-opencv

CV_RETR_CCOMP in findContours not returning hierarchy

Closed this issue · 2 comments

I noticed that the mode and chain args inside of findContours are hardcoded to be CV_RETR_LIST and CV_CHAIN_APPROX_SIMPLE. However, when the mode is changed to CV_RETR_CCOMP (which should return the hierarchy with sibling and parent-child relationships), it is not returning the full hierarchy.

  1. Why is the mode and chain hardcoded? These should be arguments to the findContours function.
  2. Why is CV_RETR_CCOMP returning the same hierarchy output as CV_RETR_LIST?

Were you able to solve this? Also looking to get the hierarchy from findContours...

OK, so you CAN pass integer vals for mode and chain, modes:

CV_RETR_EXTERNAL =0,
CV_RETR_LIST =1,
CV_RETR_CCOMP =2,
CV_RETR_TREE =3,
CV_RETR_FLOODFILL =4