Opencv函数确认

29 篇文章 1 订阅
void callback1(int pos, void*){	std::cout << "hmin" << pos << std::endl;}
void callback2(int pos, void*){	std::cout << "smin" << pos << std::endl;}
void callback3(int pos, void*){	std::cout << "vmin" << pos << std::endl;}
void callback4(int pos, void*){	std::cout << "hmax" << pos << std::endl;}
void callback5(int pos, void*){	std::cout << "smax" << pos << std::endl;}
void callback6(int pos, void*){	std::cout << "vmax" << pos << std::endl;}


int _tmain(int argc, _TCHAR* argv[])
{
	Mat img = imread("D:\\11.jpg");

	namedWindow("img", 0);
	imshow("img", img);

	Mat hsv, dst;
	int hmin = 0;
	int smin = 0;
	int vmin = 0;
	int hmax = 255;
	int smax = 255;
	int vmax = 255;
	cvtColor(img, hsv, CV_RGB2HSV);	
	createTrackbar("hmin", "img", &hmin, 256, callback1);	
	createTrackbar("smin", "img", &smin, 256, callback2);	
	createTrackbar("vmin", "img", &vmin, 256, callback3);	
	createTrackbar("hmax", "img", &hmax, 256, callback4);
	createTrackbar("smax", "img", &smax, 256, callback5);
	createTrackbar("vmax", "img", &vmax, 256, callback6);	
	while (1)//循环包裹,刷新图像	
	{		
		inRange(hsv, Scalar(hmin, smin, vmin), Scalar(hmax, smax, vmax), dst);	
		
	    namedWindow("dst", 0);
		imshow("dst", dst); 	
		int c = waitKey(10);	
		if (c == 'q')
			break;	
	}

	return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值