Keeping a copy of ofCvContourFinder inside a class

Hi
I’m having trouble trying to have a copy of the contour information be accessible from a class.

I tried treating the contour finder as a pointer, but I’m getting an error when I try to send it to a class. It’s probably a basic error about using pointers, but i haven’t been able to figure it out…

Thanks!!
Maria

in testApp.h:

  
ofCvContourFinder * contourFinder;  

in myclass.h:

  
#include "ofCvMain.h"  
  
ofCvContourFinder * cfPtr;       

in testApp::setup()

  
contourFinder = new ofCvContourFinder ();  
myClassArray[i].cfPtr = contourFinder;    

in testApp::update()

  
contourFinder->findContours(grayBg, 20, p.width * p.height, 6, false);  

the-whole-thing

Hey maria,

This works for me.

in testApp.h:

  
      ofCvContourFinder contourFinder; //notice no astrix  
  

in myclass.h:

  
#include "ofCvMain.h"   
  
    ofCvContourFinder * cfPtr;    

in testApp::setup()

  
    myClassArray[i].cfPtr = &contourFinder;   

in testApp::update()

  
myClassArray[i].cPtr->findContours(grayBg, 20, p.width * p.height, 6, false); //just to show that we can use the pointer to call the main objects functions.  
  
  

Hope that helps!
Theo