ofxCvblob VS. CvSeq

Is there any functions that restores CvSeq structure out of ofxCvblob object?

I want to draw contours onto grayscaleimage, so i can feed it to contour finder again as contour finder gets grayscaleimage argument.

It is possible to draw contours on screen but is there any way i can draw into allocated grayscaleimage in OF way? (grabscreen() is not the ofxCVImage method, or is it?)

I couldn’t find how so i was gonna use cvDrawContours but i needed to put CvSeq structure contour as the argument.

And as i wanted to do more with contours like Theo did to smooth, approx poly the contours, i found i needed CvSeq type contours more so i can use OpenCV functions. (otherwise i have to rewrite all the algorithm by myself.)

And i think, If there is anyway we can convert CvSeq structure wtih ofxCvblob objects, it’d it be easier for us to make interfaces with other OF functions.

I’d appreciate if anyone can give me an advice on this.

Thank you in advance.

self reply.

after fiddling around with openCV datatypes and OF datatypes, i found it almost meaningless to convert contour back to image.

Better to process the contour itself.

and to do this, i found using ofxCvBlob object is more convenient.

Thank you OF people.

hojun

I know I’m late with this but, I found something that may help.

  
contourFinder2.findContours(grayDiff2, minBlob, maxBlob, nConsidered, false, false);  
  
        if(surface != NULL) {  
            cairo_surface_destroy(surface);  
            cairo_destroy(cr);  
        }  
  
        surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, imgCWidth, imgCHeight);  
        cr      = cairo_create (surface);  
  
        for (int j = 0; j < contourFinder2.nBlobs; j++) {  
            cairo_move_to (cr, contourFinder2.blobs[j].pts[0].x, contourFinder2.blobs[j].pts[0].y);  
            for (int i = 1; i < contourFinder2.blobs[j].nPts; i++){  
                cairo_line_to (cr, contourFinder2.blobs[j].pts[i].x, contourFinder2.blobs[j].pts[i].y);  
            }  
            cairo_close_path (cr);  
        }  
  
        cairo_set_source_rgb (cr, 1, 1, 1);  
        cairo_fill_preserve (cr);  
        cairo_stroke (cr);  
  
        screen.setFromPixels(cairo_image_surface_get_data(surface), imgCWidth, imgCHeight, OF_IMAGE_COLOR_ALPHA);  

Rodrigo

I’m really late at this too but this is really nice.
these days i save contours to polylines to do the processing.
But this is still useful!

thank you!