Working on some pixel rotation and transforming stuff. Made this in the process, figure that I would post it.
//-------------------------------------------------------------------------------- Get Sub Pixels
void ofxCvImage::getSubPixels(ofxCvImage& input, float x, float y) {
if(width > input.width || height > input.height) {
cout << "Bad sizes" << endl;
return;
}
CvPoint2D32f center;
if(OF_RECTMODE_CORNER) {
center.x = x+(width/2);
center.y = y+(height/2);
}else if(OF_RECTMODE_CENTER) {
center.x = x;
center.y = y;
}
cvGetRectSubPix(input.getCvImage(), cvImageTemp, center);
swapTemp();
}
It grabs a set size of pixels based on a image that you create. You pass it a image to sample from and x and y offset. If the offset is greater than the image you get a crazy tunnel effect You can change the origin of the rectangle by changing OF_RECMODE (CORNER/CENTER).
I’m still working on a pixel rotation to transform a 640 x 480 image to 480 x 640 image. Not how to go about this. I have used some of the methods in the ofxCvImage Class (rotate/transform) I can get the image to rotate but the size is still 640 x 480. I then resize but the image get psychedelic. any thoughts would be great. I