Why is warpAffine failing silently?

asked 2018-09-05 10:59:46 -0500

bfialkoff gravatar image

Hi all

I'm using warpAffine to rotate an image. Basically I have a rectangular mask that I made from a RotatedRect and I want to rotate the mask so it's side's are parallel to the the sides of the screen. The thing is its behaving unpredictably. Sometimes it works like a charm other times it doesn't to anything. What could be causing this?

Some code:

Point pt = new Point(rotatedRect.center.x, rotatedRect.center.y);//center of the bounding box
        Mat r = Imgproc.getRotationMatrix2D(pt, angle, 1.0);//angle is negative. this is only good when pt[0] is the bottom left vertex of the rect, otherwise not good. need to have a check
        Imgproc.warpAffine(textOnlymat, textOnlymat, r, new Size(textMat.cols(), textMat.rows()));
edit retag flag offensive close merge delete


hmm, i don't think, there is enough information here, to help.

other times it doesn't to anything.

when, exactly ?

berak gravatar imageberak ( 2018-09-05 11:22:16 -0500 )edit