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: https://lh6.ggpht.com/jhyielbi8ldxkge5h5psiftqbmkco8pc4w3vixr3vb5eedutixje5fco7ohzp294zn4=h900

and here's result:

enter image description here

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

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -