对象跟踪

1. 跟踪特定颜色的对象

颜色信息对光照条件敏感,这里假设图像已经消除光照影响。

HSV色调饱和度值

色调:色谱
饱和度:特定颜色的强度,值是该像素的亮度

int main(int argc, char* argv[])
{
	//Variable declarations and initatializations
	// Iterate until the user presses the Esc  key
	while(true)
	{
		// Initialize the output image before each iteration
		outputImage = Scalar(0, 0, 0);

		// Capture the current frame
		cap >> frame;

		// Check if 'frame' is empty
		if(frame.empty())
			break;

		// Resieze the frame
		resize(frame, frame, Size(), scalingFactor, scalingFactor, INTER_AREA)

		// Convert to HSV colorspace
		cvtColor(frame, hsvImage, COLOR_BGR2HSV);

		// Define the range of "blue" color in HSV colorspace
		Scalar lowerLimit = Scalar(60, 100, 100);
		Scalar upperLimit = Scalar(180, 255, 255);

		// Threshold the HSV image to get only blue color 
		inRange(hsvImage, lowerLimit, upperLimit, mask);

		// Computer bitwise-AND of input image and mask
		bitwise_and(frame, frame, outputImage, mask=mask);

		// Run median filter on the output to smoothen it
		medianBlur(outputImage, outputImage, 5);

		// Display the input and output image
		imshow("Input", frame);
		imshow("Output", outputImage);
		// Get the keyboard input and check if it's 'Esc'
		// 27 -> wait for 30ms
		// 27 -> ASCII value of 'Esc' key
		ch = waitKey(30);
		if(ch == 27)
		{
			break;
		}
	}
	return -1;
}

2. 构建交互式对象跟踪器

连续自适应平移算法CAMShift,改进版的meanshift算法.

3. 用Harris角点检测器检测点

用于跟踪的好特征

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值