首页 > 编程知识 正文

opencvrect函数,open函数返回值

时间:2023-05-03 12:50:43 阅读:34196 作者:4866

Rect函数功能介绍代码效果展示

功能介绍

rect(intx,int y,int width,int height );

参数1:x,矩形左上角x的坐标; 参数2:y,矩形左上角的y坐标; 参数3 :宽度,矩形宽度; 参数4 :高,矩形高度。 代码matimage=imread('./Lena.jpg ); rectrect1(256、256、128、128 ); rectrect2(224、224、128、128 ); Mat roi1; image(rect1).copyto ) ROI1; //Copytheregionrect1fromtheimagetoroi1im show ('1',ROI1); 维基(0; Mat roi2; image(rect2).copyto ) ROI2; //Copytheregionrect2fromtheimagetoroi2im show ('2',roi2); 维基(0; cv :3360 rect rect3=rect1rect 2; //intersectionofthetwosetsmatroi 3; image(rect3).copyto ) ROI3; imshow('3',roi3); 维基(0; Rect rect4=rect1|rect2; //unionofthetwosets (theminimumboundingrectangle ) Mat roi4; image(rect4).copyto ) ROI4; imshow('4)、roi4); 维基(0; rect rect5(10、10、128、128 ); ROI1.复制到(image ) rect5); //copytheregionrect1tothedesignatedregionintheimageimshow ('5',image ); 维基(0; 效果的展示

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。