0
私のアプリでは、特定の座標で画像を切り取るのにopencvを使用しましたが、左側の座標を移動すると問題が発生しました。Opencv cvSetImageROI座標の問題
//assignment of calculates ration between view resolution and resolution of the photograph
double scaleX = (outPutImage.frame.size.width/newCoordRect.imgWidth);
double scaleY = (outPutImage.frame.size.height/newCoordRect.imgHeight);
//assignment of the values after calculates coordinates
int x = newCoordRect.leftUp.x/(scaleX);
int y = newCoordRect.leftUp.y/(scaleY);
int heigth = ((newCoordRect.rightDown.y-newCoordRect.rightUp.y)/scaleY);
int width = ((newCoordRect.rightDown.x-newCoordRect.leftUp.x)/scaleX);
/* load image */
IplImage *img1 = [[ShareFunction sFunction]CreateIplImageFromUIImage:outPutImage.image];
/* sets the Region of Interest
Note that the rectangle area has to be __INSIDE__ the image */
cvSetImageROI(img1, cvRect(x, y, width, heigth));
/* create destination image
Note that cvGetSize will return the width and the height of ROI */
IplImage *img2 = cvCreateImage(cvGetSize(img1),
img1->depth,
3);
/* copy subimage */
cvCopy(img1, img2, NULL);
/* always reset the Region of Interest */
cvResetImageROI(img1);
retCropImg = [[ShareFunction sFunction]UIImageFromIplImage:img2];
私はCタグが作物や作物よりはるかに適切であり、さらに多くの信者を持っていると思います。再タグ付けを検討してください。 – karlphillip
ok thxでも、私はすでに私のuiimageを回転させる必要があり、その作業の後に解決策が見つかりました。 – Eliann