簡體   English   中英

如何使閾值窗口僅適用於一半的圖像?

[英]How can I make my threshold window only work for half my image?

我正在使用Visual Basic 2010 Express和c ++中的opencv,盡管此行已經限制了我的顏色以在閾值窗口中進行跟蹤,

inRange(HSV,Scalar(0,1,170),Scalar(196,137,256),thresholdL);

我試圖弄清楚如何也說“僅顯示在此閾值窗口中x軸上介於320到640之間的像素(我不知道它的正確術語)”。

我有一個用於檢查x位置的變量,稱為

int xPos;

但是我不確定如何將其收集到我的閾值窗口中。 是否修改顯示的行? 有沒有我剛才發現的功能,可以在下面插入? 我需要開設一門全新的課程嗎?

先感謝您。

如果您要處理圖像的某些特定部分,OpenCV ROI可能會幫助您

你可以有類似的東西

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);

希望這些對您有幫助...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM