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:
import cv2 as cv
import numpy as np
img = cv.imread("29.jpg")#Sample image of Field
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) #Convert to gray...just to try
edges = cv.Canny(gray, 200, 300)
#Finds the contours
image, contours, hierarchy = cv.findContours(edges,cv.RETR_EXTERNAL,cv.CHAIN_APPROX_NONE)
cv.drawContours(img, contours, 1, (0, 255,255), 3)
k = cv.waitKey(0)
Because the image deteriorates when put through the findContours function, I feel that it is never able to find anything. This doesn’t just happen when I put the edges image through, it happens when I try things like masks too.
I am super new to OpenCV so there is a strong possibility that there is something that I am doing completely wrong.
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