![]() |
OpenCV: findContours() messing with images?
Hi,
We used GRIP for Stronghold and was super nice and easy. Now, I want to take it to the next level with OpenCV. I am currently having a lot of trouble just trying to find a contour in anything! The findContours function seems to be interfering with something which makes the edges image deteriorate. For example, here is the Canny edge with and without it being the source of the findContour function: http://imgur.com/a/7kqAw Here is the super simple code I am using: Code:
import cv2 as cvI am super new to OpenCV so there is a strong possibility that there is something that I am doing completely wrong. Any help would greatly be appreciated! |
Re: OpenCV: findContours() messing with images?
If you're using findContours(), you don't need to use Canny Edge Detection. By using Canny first, you're narrowing down the image and giving findContours() less information to work with, and so it's tolerances will cut out anything too small
Here's our code for acquiring the goal, although it is in C++ instead of Python I believe the API is roughly the same |
Re: OpenCV: findContours() messing with images?
Quote:
|
Re: OpenCV: findContours() messing with images?
Firstly, I would recommend converting to HSV and doing HSV filtering at some point (but it sounds like gray was just temporary).
I think doing HSV filtering would help a bit, but it also might not. I can PM you our code, it will be going to github once I've cleaned it up but I can give it you now if it would help. Also, in my code if I draw contours I don't just call the function, I put the result into a varialbe, like: Code:
outImage = cv2.drawContours(origImage, contours, -1, (255, 255, 0), 1)So I would say to do HSV filtering now, I can give you my code to do it if you want, and to also look into the variable return thingy. |
Re: OpenCV: findContours() messing with images?
Quote:
Code:
import cv2 as cv |
| All times are GMT -5. The time now is 10:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi