ROI感兴趣区域
cv::Rect rect(
100,
100,
300,
300);
#include<stdio.h>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
void PrintMs(
const char *text =
"")
{
static long long last =
0;
long long cur = getTickCount();
if (last ==
0)
{
last = cur;
return;
}
long long ms =
0;
ms = ((
double)(cur - last) / getTickFrequency()) *
1000;
if (*text !=
0)
{
printf(
"%s = %dms\n ", text, ms);
}
last = getTickCount();
}
int main(
int argc,
char *argv)
{
Mat src = imread(
"lena.jpg");
Rect rect(
100,
100,
200,
200);
Mat roi = src(rect);
namedWindow(
"Lena");
namedWindow(
"ROI");
imshow(
"Lena", src);
imshow(
"ROI", roi);
waitKey(
0);
return 0;
}