@elliot wrote:
I am trying to combine two ofxCvFloatImage instances from some optical flow with the ofxOpenCv built in addon.
I have the split the flow into separate images flowX describing the motion of each pixel in the x-axis and flowY describing the motion in the y-axis.
From the documentation in ofxCvColorImage this shows you can add pixel data from one to another:
first += second; // both are ofxCvFloatImage instances
However, I am unable to do this and get and error: "Invalid operands to binary expression ('ofxCvFloatImage' and 'ofxCvFloatImage')"
Any help on adding pixel data from two ofxCvFloatImage instances would be great.
Here is the code I'm working with.Mat img1( gray1.getCvImage() ); //Create OpenCV images Mat img2( gray2.getCvImage() ); Mat flow; //Image for flow calcOpticalFlowFarneback( img1, img2, flow, 0.7, 3, 11, 5, 5, 1.1, 0 ); //Split flow into separate images //describing the motion of each pixel in the x-axis and one describing the motion in the y-axis vector<Mat> flowPlanes; split( flow, flowPlanes ); //Copy float planes to ofxCvFloatImage images flowX and flowY IplImage iplX( flowPlanes[0] ); flowX = &iplX; IplImage iplY( flowPlanes[1] ); flowY = &iplY; //Need to combine flowX and flowY which are of type ofxCvFloatImage //Or convert the flow into one CVimage.
Posts: 2
Participants: 1