Opencv learning-Roi Region

Source: Internet
Author: User
# Include "highgui. H "# include" CV. H "# include <iostream. h> void main () {iplimage * src =/resize ("lena.jpg",-1); // read the image iplimage * DST; cvrect roi_rect_src; cvrect roi_rect_dst; cvnamedwindow ("src", cv_window_autosize); cvmovewindow ("src", 200,200); cvshowimage ("src", Src); // outputs an image cvwaitkey (0) with an unspecified ROI ); roi_rect_src.x = Src-> width/2; rows = Src-> height/2; roi_rect_src.width = 200; roi_rect_src.height = 200; cvsetimageroi (SRC, roi_rect_src ); cout <"output image region" <Endl; cout <(SRC-> ROI-> xoffset) <"<(SRC-> ROI-> yoffset) <Endl; cout <(SRC-> ROI-> width) <"<(SRC-> ROI-> height) <Endl; cvshowimage ("src", Src); // output the image DST = cvcloneimage (SRC) after the ROI is set; // copy the image roi_rect_dst = cvgetimageroi (DST) in the ROI region ); // get the cout <"ROI of the output target image" <Endl; cout <roi_rect_dst.x <"" <roi_rect_dst.y <Endl; cout <strong <"" <roi_rect_dst.height <Endl; cvnamedwindow ("DST", cv_window_autosize); cvmovewindow ("DST", 400,200); cvshowimage ("DST ", DST); cvwaitkey (0); cvresetimageroi (DST); // release the ROI of the Target Image cvshowimage ("DST", DST); cvwaitkey (0); cvreleaseimage (& SRC ); cvreleaseimage (& DST );}

http://blog.csdn.net/gnuhpc/article/details/4259467

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.