OPENCV Study Notes (8): capturing/cropping images with Cvsetimageroi

Source: Internet
Author: User

Sometimes we need to get an area of interest ROI from an image (region of interesting) and crop the ROI region into small images as input for post-processing. With the Cvsetimageroi () function, you can easily get it done.

First, Cvsetimageroi function

function

Sets the ROI of an image based on a given rectangle (area of interest, region of interesting)

formatvoid Cvsetimageroi (iplimage*Image, Cvrectrect);ParametersImageImage header, pending imagerect ROIRectangular

Example

Cvsetimageroi (Image,cvrect (100,100,356,156)), (100,100) represents the upper-left coordinate of the ROI region, and 356,156 represents the length-width of the ROI region, respectively.

Description

After executing Cvsetimageroi (), the image is displayed only as part of the ROI ID, which changes the pointer image, but it still retains the information of the original image, in the execution of this sentence cvresetimageroi (image); Image indicates the original picture information.

Second, the Code

#include <iostream> #include 

Iii. Results of operation


OPENCV Study Notes (8): capturing/cropping images with Cvsetimageroi

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.