简体   繁体   English

如何使阈值窗口仅适用于一半的图像?

[英]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.

相关问题 c_str()只读取字符串的一半,为什么呢? 我怎样才能解决这个问题? 是字节问题吗? - c_str() is only reading half of my string, why? How can I fix this? Is it a byte issue? 如何修复并使我的代码在 C++ 中工作? - How can I fix and make my code work in c++? PHP 仅适用于 Apache,还是可以与我自己的 C++ 服务器一起使用? - Does PHP only work with Apache, or can I make it work with my own c ++ server? 为什么这个对 sprintf_s() 的调用有效,我怎样才能在我的计算机上使它工作? - Why does this call to sprintf_s() work, and how can I make this work on my computer? 我的基类中有一个虚拟析构函数和一个数组。 我该如何运作? - I have a virtual destructor and an array in my base class. How can I make it work? 如何使服务器成为多线程? - How can I make my server multithreaded? 如果我只想使用cvgoodfeaturetotrack检测图像的一半,如何更改 - How to change if i only wanna to detect half of the image using cvgoodfeaturetotrack 如何在不先启动 IE 的情况下使我的 WinCE 应用程序中的网络工作? - How can I make networking work in my WinCE app without launching IE first? 我怎样才能打电话给我的 function 让这个程序计算成绩? - How can I call my function to make this program work to calculate grades? 如何更改我的输入以接受来自用户的字符串? 目前我的程序只能使用 char 值 - How can I change my input to accept a string from the user? Currently my program will only work with a char value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM