OpenCV in Rect class

Source: Internet
Author: User

Reproduced:

The Rect_ class has some meanings, the member variable x, y, width, height, respectively, the coordinates of the upper-left corner and the width and height of the rectangle. Commonly used member functions have a size () return value of one Size,area () returns the area of the rectangle, contains (point) is used to determine whether the dot is within the rectangle, the inside (Rect) function determines whether the rectangle is within the rectangle, and the TL () returns the upper-left point coordinate, BR () Returns the point coordinate of the lower right corner. It is worth noting that if you want to find the intersection of two rectangles, and set, you can use the following format

[CPP] view plain copy
  1. Rect rect = rect1 & rect2;
  2. Rect rect = Rect1 | Rect2;

If you want the rectangle to pan, the zoom operation can even be written like this

[CPP] view plain copy

  1. Rect rectshift = rect + point;
  2. Rect rectscale = rect + size;

OpenCV in Rect class

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.