make a copy of ofxCvGrayscaleImage

I have a method that receives a pointer to a ofxCvGrayscaleImage.

(ofxCvGrayscaleImage *thresholdImage) {  

Then i want to make a copy of that image.

ofxCvGrayscaleImage *newThresholdImage = new ofxCvGrayscaleImage();  

Now how can i create that copy?

from what I JUST learned myself.
ofxCv*Image do a deep copy and can only do that.

so if this is a c++ matter, the solution should be

dereference the pointer to the grayscale image and just assign that.

sort of

    ofxCvGrayscaleImage *thresholdImage) {   
        ofxCvGrayscaleImage newThresholdImage;  
        newThresholdImage  = *thresholdImage ;  

but since I , myself, is new to this , a more advanced user should agree or correct me.

I use this now:

this->thresholdImage = new ofxCvGrayscaleImage(*thresholdImage);  

I’m not sure about your method. If i look at the documentation i see:

// make sure that the dimensions and ROI match


But i’m not sure of my way either. It runs for me, but my program freezes at random with different errors everytime but all related to drawing a ofxCvGrayscaleImage. But on the other hand, that is what my program mostly does so if it has to freeze somewhere…