My pet project from this weekend: findContours (openCV) added to cv.jit


    Dec 19 2016 | 12:38 am
    I am not sure why the amazing cv.jit package does not include support for findContours - but when I found myself having a need for it, I spent the weekend getting it to work...
    I am pretty happy with the results - especially after running the cvFindContours() results through cvApproxPoly() to reduce the point count (which is super important for my project).
    I am currently working on some better control over the coloring - right now it simply uses a matrix of color choices in the right inlet and iterates over these colors for each path - which looks ok for static images, but for movies / animations - it results in a the same path being colored different each frame - which looks kinda bad. I am going to add the option of coloring all enclosing contours the same color - and also add the option to color based on contour area size - which should improve the results for movies / animations.
    I also discovered by accident that jit.movie allows you to drop image files as well as movie files - so I simply use a dropfile->read->jit.movie path - and then do rgb2luma->cv.jit.canny->cv.jit.findContours.
    Thanks to C74 for updating the cv.jit package to 64bit and moving the build files to Xcode! That was super helpful when it came time to debug the crazy CvSeq structure that findContours uses.

    • Dec 19 2016 | 10:47 am
      This is great! Any plan for sharing it?
    • Dec 19 2016 | 5:32 pm
      yes please share. perhaps we can get this incorporated into the jit.cv package.
    • Dec 19 2016 | 5:41 pm
      Absolutely - I need to spend some time to clean it up and harden it up - but have no problems sharing. I was thinking a bit more about the coloring of the paths - and will probably add an optional inlet where you can pass in the original RGB raster image and it will sample colors for the paths from the original image.
    • Dec 20 2016 | 10:38 am
      Yes, that could be very useful, although I believe the native system is more intended as an ID number for contours, rather than color, and keeping that option would be still very useful for some applications.
    • Dec 21 2016 | 11:30 pm
      Nice!
    • Apr 16 2017 | 12:07 pm
      This looks great - am bumping to see if this can be shared.
    • Apr 16 2017 | 4:01 pm
      cool.
      yes, please share when you can.
    • Nov 29 2018 | 3:50 pm
      I'm interested too