Ask Your Question

Michael Lilley's profile - activity

2018-09-21 21:01:47 -0600 commented question OpenCL not recognizing Intel iGPU on Linux

That was exactly what I needed, thank you.

2018-09-16 23:39:28 -0600 asked a question OpenCL not recognizing Intel iGPU on Linux

OpenCL not recognizing Intel iGPU on Linux Hello, I'm using OpenCV 3.4.3 in conjunction with OpenCL on Ubuntu 16.04. I

2016-09-17 20:11:48 -0600 asked a question Best Way to Detect Contours Consistently?

Hi all, this is my first time in the forum.

I've been working a project to detect the contours of an object from a live video feed. My goal is to implement this in a robot so it's able to follow the object around based on the contour's position in the screen. For testing purposes, I've been working in a dark room with a bright yellow notepad, as I assumed the contrast between the notepad and the dark background would be the best environment for contour finding.

My results have proved otherwise. It does detect contours, but whenever I move the object around or there's a slight change in lighting, the contour will no longer be detected consistently. Rather, it detects other small individual contours all over the screen. I tried in an environment with good even white lighting, but the same problem occurs.

I believe this happens because the threshold boundaries are too specific. I would change the range to be something more broad, but then the object I'm trying to track is no longer properly isolated.

So my question is this: What is a way to properly filter a video feed and isolate an object so it will be detected consistently, rather than having shoddy detection whenever something small is changed? I'm using inRange() to control the range of acceptable HSV values, then finding the contours of the binary image that is created.

Any help would be appreciated! Below is the function of my code that detects the contours.

void detectContours()
{
    vector<vector<Point>> contours;
    vector<Vec4i> hierarchy;

    Canny(morphedFrame, cannyFrame, 200, 255, 3, false);

    findContours(cannyFrame, contours, hierarchy, RETR_EXTERNAL, CHAIN_APPROX_NONE);

    drawContours(normalFrame, contours, 0, color, 3, LINE_AA, hierarchy, 0, Point());
}