[英]How can I make my threshold window only work for half my image?
I am using Visual Basic 2010 Express, and opencv in c++, and while this line already limits my color to track in the threshold window, 我正在使用Visual Basic 2010 Express和c ++中的opencv,尽管此行已经限制了我的颜色以在阈值窗口中进行跟踪,
inRange(HSV,Scalar(0,1,170),Scalar(196,137,256),thresholdL);
I am trying to figure out how to also say 'only show pixels(I don't know the proper terminology for it) that lie somewhere from 320 to 640 on the x axis in this threshold window.' 我试图弄清楚如何也说“仅显示在此阈值窗口中x轴上介于320到640之间的像素(我不知道它的正确术语)”。
I do have a variable that i use to check the x position, called 我有一个用于检查x位置的变量,称为
int xPos;
but I'm not sure how to take that and funnel the info into my threshold window. 但是我不确定如何将其收集到我的阈值窗口中。 Do I modify the line shown?
是否修改显示的行? is there a function for this that I just haven't found and can insert underneath?
有没有我刚才发现的功能,可以在下面插入? Will I have to set up a whole new class or something?
我需要开设一门全新的课程吗?
Thank you in advance. 先感谢您。
If you want to work on some specific part of the image OpenCV ROI may help you 如果您要处理图像的某些特定部分,OpenCV ROI可能会帮助您
You can have something like 你可以有类似的东西
Mat HSV; //your source image for inrange
Mat thresholdL//destination image
int xPos= x_starting_point;
int yPos=HSV.rows
width=HSV.cols-xPos;
height=HSV.rows;
cv::Rect roi(xPos, yPos, width, height); // Your ROI rectangle
//Set image ROI
cv::Mat image_roi = HSV(roi);// note: this assignment does not copy data,HSV and image_roi now share data
//Perform your operation
inRange(image_roi,Scalar(0,1,170),Scalar(196,137,256),thresholdL);
// Now dislpay
imshow("out",HSV);
Hope these helpful for you... 希望这些对您有帮助...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.