# 计算机视觉不规则roi原理,C++ 中利用 Opencv 得到不规则的ROI 区域(已知不规则区域)...

setMouseCallback("setROIParking_Image", on_MouseHandle, (void*)&SrcImage);

void Image::GetROImage()

{

for (int j = 0; j < ROInumber; j++)

{

Point root_points[1][4];

root_points[0][0] = DrawPoints[j*4];

root_points[0][1] = DrawPoints[j*4 + 1];

root_points[0][2] = DrawPoints[j*4 + 2];

root_points[0][3] = DrawPoints[j*4 + 3];

const Point* ppt[1] = { root_points[0] };

int npt[] = { 4 };

//polylines(srcImage, ppt, npt, 1, 1, Scalar(0, 0, 0), 1, 8, 0);

vector mv;

fillPoly(mask_ann, ppt, npt, 1, Scalar(255, 255, 255));

srcImage.copyTo(dst, mv[0]);

vector rectPoints = {}; //得到rectangle 的角点

rectPoints.push_back(DrawPoints[j * 4]);

rectPoints.push_back(DrawPoints[j * 4 +1]);

rectPoints.push_back(DrawPoints[j * 4 +2]);

rectPoints.push_back(DrawPoints[j * 4 +3]);

Rect rec = boundingRect(Mat(rectPoints));

dst1 = dst(rec); //boundingRect(Mat(rectPoints)) //得到rectROImage

if (dst1.cols >= 160)

{

resize(dst1, dst2, Size(160, 120),0,0,3); //得到rectROImage_resize //降采样

}

else

{

resize(dst1, dst2, Size(160, 120),0,0,1);//放大

}

//默认为线性插值 INTER_NEAREST = 0(最近邻插值),

//INTER_LINEAR = 1(线性插值，默认值),

//INTER_CUBIC = 2(三次样条插值),INTER_AREA = 3(区域插值)；INTER_LANCZOS4 = 4(Lanczos插值),

//INTER_MAX = 7, WARP_FILL_OUTLIERS = 8,

//降采样：3， 放大：2(效率不高,不推荐);1(效率高，推荐)

imwrite(ROImageNames[j], dst);

imwrite(rectROImageNames[j], dst1);

imwrite(rectROImageNames_resize[j], dst2);

imwrite(rectROImageNames_resize_[j], dst2);

}

}

const Point* ppt[1] = { root_points[0] };

int npt[] = { 4 };

fillPoly(mask_ann, ppt, npt, 1, Scalar(255, 255, 255));

vector mv;

srcImage.copyTo(dst, mv[0]);

srcImage.copyTo(dst, mv[0]);

Rect rec = boundingRect(Mat(rectPoints));

dst1 = dst(rec); //boundingRect(Mat(rectPoints)) //得到rectROImage

MFC中利用Opencv与C&plus;&plus;抓取摄像头进行人脸识别(Mat)

OpenCV - Android Studio 2&period;2 中利用CAMKE进行OpenCV的NDK开发

&lbrack;转&rsqb;在MacOS和iOS系统中使用OpenCV

OpenCV 是一个开源的跨平台计算机视觉库,实现了图像处理和计算机视觉方面的很多通用算法. 最近试着在MacOS和iOS上使用OpenCV,发现网上关于在MacOS和iOS上搭建OpenCV的资料很 ...

opencv探索之路(十二)：感兴趣区域ROI和logo添加技术

jquery用append添加按钮之后，按钮监听无法使用的解决方法

&lt ...

C&num;事件与接口

using System; namespace ConsoleApplication1d { delegate void MsgDel(string s); interface IMsg { even ...

Android-给另一个Activity传递HashMap

I have a HashMap which I would pass to another Activity class. I simply use this code: Intent intent ...

linux 终端下敲ctrl-c时，到底发生了什么&quest;&lpar;转&rpar;

Java语法基础学习DayNineteen(反射机制)

fatal&colon; LF would be replaced by CRLF in index&period;html

GitKraken 团队项目使用教程

beyondCompare试用期到期解决办法

• 0
点赞
• 1
收藏
• 0
评论
09-08 926
03-03 1万+
12-10 837
08-30 1439
01-09 1万+
12-12 1901
09-29 480
11-12 264
09-22 1676
11-18 624

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助