当前位置:网站首页>First acquaintance with opencv4.x --- ROI interception
First acquaintance with opencv4.x --- ROI interception
2022-07-25 09:47:00 【F l e】
//ROI Intercept
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img = Mat::zeros(Size(400, 400), CV_8UC1);// Create a black background , Note that Size(x,y), namely ( Column , That's ok )
putText(img, "A", Point(1, 200), 1, 15, Scalar(255), 1);
putText(img, "B", Point(200, 200), 1, 15, Scalar(255), 1);
putText(img, "C", Point(1, 400), 1, 15, Scalar(255), 1);
putText(img, "D", Point(200, 400), 1, 15, Scalar(255), 1);
// Use Rect Type acquisition ROI--Rect(x,y,width,height)
Mat ROI_Rect;
ROI_Rect = img(Rect(0, 0, 200, 200));
// Use Range Type acquisition ROI--Range(start,end)
Mat ROI_Range;
ROI_Range = img(Range(200,400),Range(0,200));
imshow("img", img);
imshow("ROI_Rect", ROI_Rect);
imshow("ROI_Range", ROI_Range);
waitKey(0);
return 0;
}



边栏推荐
猜你喜欢
随机推荐
Class (2) and protocol
How to obtain location information (longitude and latitude) by uni app
学习新技术语言流程
[code source] daily question tree
Matlab drawing | some common settings of axis
Flutter Rive 多状态例子
【数据挖掘】最近邻和贝叶斯分类器
CoreData存储待办事项
expect+sh实现自动交互
无向连通图邻接表的创建输出广度深度遍历
How to convert object data into arrays
App的生命周期和AppleDelegate,SceneDelegate
关于C和OC
OC -- Foundation -- string + date and time
自定义 view 实现兑奖券背景[初级]
Assignment 7.21 Joseph Ring problem and decimal conversion
In depth interpretation of C language random number function and how to realize random number
Server CUDA toolkit multi version switching
降低程序空间复杂度的一些技巧
一张图讲解 SQL Join 左连 又连









