2
我正在開發一個openCV項目,試圖檢測車位並從圖像中提取ROI(感興趣區域)以便進一步檢測車輛。所提供的圖像將包含所有空車位。我已閱讀了幾篇關於此的帖子和教程。到目前爲止,我已經想盡了辦法是:檢測停車場線路和ROI openCV
1.Convert image to grayscale using `cvtColor()`
2.Blur the image using `blur()`
3.Threshold the image to get edges `threshold()`
4.Find image contours using findContours()
5.Finding all convex contours using `convexHull()`
6.Approx polygonal regions using `approxPolyDP()`
7.Get the points for the result from 5, if total number of points =4.
Check for area and angle.
我想這種方法的問題是,當我這樣做findContours()
,發現不規則的和更長的輪廓導致approxPolyDP
承擔超過停車位本身更大的四邊形。有些停車線有洞/不規則。
我也試過goodFeaturesToTrack()
,它可以非常有效地給出轉角,但是存儲在輸出中的點是以任意順序存在的,我認爲從中提取四邊形/矩形非常嚴格。
我在這方面花了相當長的時間。有沒有更好的方法呢?
This是我玩的圖像。