Landscape image to portrait with opencv
I have a method that does some processing on an IplImage and the method works as it should if the image is 640x480 pixels. But if it开发者_JAVA技巧 is 480x640 pixels, it does't not... because the image needs to be rotated to become 640x480 again, but then I need to rotate it back to 480x640 or translate ther coordinates taken from cvHaarDetectObjects to 480x640.
Can anybody tell me how can I do this?
thanks!!
Try transpose
followed by flip
. The flip
is needed because transpose
leaves an mirrored image when compared to the results of a rotation. If the algorithm can work with the mirrored image directly, I would recommend simply flipping the coordinate values of the detection result, rather than flipping the input image.
(Disclaimer: I haven't tried transpose
or flip
on multi-channel images)
精彩评论