OpenCV area of Interest established

Source: Internet
Author: User



After setting the ROI for a iplimage image with the Cvsetimageroi function, the image processing will be limited to the ROI region, which is equivalent to the image in Roi, and the test code value is only tested with cvcopy (function of copying image). In fact, for any function that handles an image iplimage type, processing an image class object that sets the ROI region is the ROI region for processing it.


#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include void Main ()
{
Iplimage *RES,*DST;
Cvrect rect;
rect.x=130,rect.y=30,rect.width=200,rect.height=200;
Res=cvloadimage ("r1.jpg");//Load a picture
Dst=cvcreateimage (Cvsize (200,200), 8, 3);//Create Image Space


Create window
Cvnamedwindow ("res", cv_window_autosize);
Cvnamedwindow ("DST", cv_window_autosize);


Set ROI Area
Cvsetimageroi (Res,rect);


Extract ROI
Cvcopy (RES,DST);


Cancel Settings
Cvresetimageroi (RES);


Display image
Cvshowimage ("res", res);
Cvshowimage ("DST", DST);
Cvwaitkey (0);


Cvdestroywindow ("res");
Cvdestroywindow ("DST");


Cvreleaseimage (&res);
Cvreleaseimage (&AMP;DST);

}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

OpenCV area of Interest established

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.