ios - OpenCV 3 - How can I properly extract the ROI of a cv::Mat? -
i've started working opencv in ios, , want extract roi (region of interest) particular cv::mat.
this current code:
- (uiimage*)test { uiimage* img = [uiimage imagenamed:@"unnamed"]; cv::mat mat1; uiimagetomat(img, mat1); cv::rect rect = cv::rect(175, 219, 130, 50); cv::mat mat2 = mat1(rect); return mattouiimage(mat2); } however result not expected:
here's original image, in want extract bottom texts: 
and here's result:
i'm absolutely new opencv, don't have idea causes this. can please?
i extracted roi code below. not sure if mattouiimage(mat2); work maybe need mattouiimage(mat2.clone());
cv::mat mat1 = imread("e:/test/rsfoy.jpg"); cv::rect rect = cv::rect(310, 420, 330, 110); cv::mat mat2 = mat1(rect); imshow("rect", mat2); 
Comments
Post a Comment