将rect划分为水平部分并丢弃第一部分

时间:2015-12-25 02:03:18

标签: c++ opencv

我有一个rect对象,我想

  1. 将其分为三个水平部分
  2. 提取第一个水平部分
  3. 保留其他两个部分并显示它们。

      Rect Roi=faces[i];
    
      Roi.height = Roi.width / 3;
    
      Mat rect_region = frame(Roi);
    
  4. 我不知道如何继续这个,我认为上面的代码是不对的。

1 个答案:

答案 0 :(得分:0)

你可以像下面这样做

Rect Roi=faces[i]; 
// maybe you must to check here if( Roi.width > 0 & Roi.height > 0 ) 
Roi.y += Roi.height/3; 
Roi.height -= (Roi.height/3);
Mat rect_region = frame(Roi);