1 Star 0 Fork 0

Robin/Learn-OpenCV-cpp-in-4-Hours

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ColorPicker.cpp 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
Murtaza Hassan 提交于 2020-12-12 15:30 . Add files via upload
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(1);
Mat img;
Mat imgHSV, mask, imgColor;
int hmin = 0, smin = 0, vmin = 0;
int hmax = 179, smax = 255, vmax = 255;
namedWindow("Trackbars", (640, 200)); // Create Window
createTrackbar("Hue Min", "Trackbars", &hmin, 179);
createTrackbar("Hue Max", "Trackbars", &hmax, 179);
createTrackbar("Sat Min", "Trackbars", &smin, 255);
createTrackbar("Sat Max", "Trackbars", &smax, 255);
createTrackbar("Val Min", "Trackbars", &vmin, 255);
createTrackbar("Val Max", "Trackbars", &vmax, 255);
while (true) {
cap.read(img);
cvtColor(img, imgHSV, COLOR_BGR2HSV);
Scalar lower(hmin, smin, vmin);
Scalar upper(hmax, smax, vmax);
inRange(imgHSV, lower, upper, mask);
// hmin, smin, vmin, hmax, smax, vmax;
cout << hmin << "," << smin << "," << vmin << "," << hmax << "," << smax << "," << vmax << endl;
imshow("Image", img);
imshow("Mask", mask);
waitKey(1);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Robin-yuetb_private-master/Learn-OpenCV-cpp-in-4-Hours.git
git@gitee.com:Robin-yuetb_private-master/Learn-OpenCV-cpp-in-4-Hours.git
Robin-yuetb_private-master
Learn-OpenCV-cpp-in-4-Hours
Learn-OpenCV-cpp-in-4-Hours
main

搜索帮助