将opencv中的图像旋转c++;不缩放图像 我用C++编写OpenCV 2.4。我有一个二值图像,它使用minareact函数查找角度,如: RotatedRect BodyRec = minAreaRect(PointsOfbinaryImage); angle=BodyRec.angle; if (angle < -45.) angle += 90.; result.Angle=angle; //calculate Center result.Center=BodyRec.center; RotatedRect BodyRec=minarealect(点为二进制图像); 角度=车身倾斜角度; 如果(角度

将opencv中的图像旋转c++;不缩放图像 我用C++编写OpenCV 2.4。我有一个二值图像,它使用minareact函数查找角度,如: RotatedRect BodyRec = minAreaRect(PointsOfbinaryImage); angle=BodyRec.angle; if (angle < -45.) angle += 90.; result.Angle=angle; //calculate Center result.Center=BodyRec.center; RotatedRect BodyRec=minarealect(点为二进制图像); 角度=车身倾斜角度; 如果(角度,c++,opencv,scale,image-rotation,C++,Opencv,Scale,Image Rotation,现在,我想旋转图像而不缩放图像。 我使用以下代码: // Get rotation matrix for rotating the image around its center Point2f center22(RGBsrc.cols/2.0, RGBsrc.rows/2.0); Mat rot = getRotationMatrix2D(center22, result.Angle, 1.0); // determine bounding rectangle Rect bbox =

现在,我想旋转图像而不缩放图像。 我使用以下代码:

    // Get rotation matrix for rotating the image around its center
Point2f center22(RGBsrc.cols/2.0, RGBsrc.rows/2.0);
Mat rot = getRotationMatrix2D(center22, result.Angle, 1.0);
// determine bounding rectangle
Rect bbox = RotatedRect(center22,RGBsrc.size(), result.Angle).boundingRect();
// adjust transformation matrix
rot.at<double>(0,2) += bbox.width/2.0 - center22.x;
rot.at<double>(1,2) += bbox.height/2.0 - center22.y;

Mat dst;
warpAffine(RGBsrc, dst, rot, bbox.size());
imshow("rotated_im", dst);
//获取围绕图像中心旋转图像的旋转矩阵
Point2f center22(RGBsrc.cols/2.0,RGBsrc.rows/2.0);
Mat rot=getRotationMatrix2D(中心22,结果角度,1.0);
//确定边界矩形
Rect bbox=RotatedRect(center22,RGBsrc.size(),result.Angle);
//调整变换矩阵
在(0,2)+=b箱宽/2.0-中心22.x处旋转;
在(1,2)+=b箱高/2.0-中心22.y处腐烂;
Mat-dst;
翘曲仿射(RGBsrc,dst,rot,bbox.size());
imshow(“旋转的im”,dst);
但我的形象是规模。 主图像: 旋转图像:


我必须做什么?

图像的内容没有缩放。这只是一种光学效果,因为您的第二张图像较小(您设置了
bbox