I’m working with a camera and openCV, and the camera is flipped.
Tho draw correctly the blob finder is quite simple as I rotate and translate as shown in the code. The challenge appears when I need to get the updated position of a flow field in this matrix called mat, which is a vector of glm::vec2.
The point is that I need to rotate -90 and translate the position and scale to mirror both, cur and mat.
I’ve been trying some examples but never getting the correct coordinates.
In other words, I need to get rid of
ofPushMatrix();
ofRotateZDeg(-90);
ofTranslate(-ofGetHeight(), ofGetWidth()); //x and y are inverted
ofScale(1,-1); //mirror the image
(...)
ofPopMatrix();
The code is the following:
ofPushMatrix();
ofRotateZDeg(-90);
ofTranslate(-ofGetHeight(), ofGetWidth()); //x and y are inverted
ofScale(1,-1); //mirror the image
ofSetLineWidth(1.0);
for(int y=0; y < 90; y+=2) {
for(int x=0; x < 160; x+=2) {
glm::vec2 cur = glm::vec2(x, y) * scale;
ofDrawLine(cur, mat.at(i));
i++;
}
}
ofPopMatrix();