Open lindsayvallen opened 4 years ago
Useful links for this work
The second link has some good ideas for applying arclength, area, and moments to contours, like the ones we have thus far. I think we could characterize the outer port target pretty specifically using a combination of these properties, even tolerating some variation in angle and distance relative to target.
Working on this in git branch feature/outer_port_finder.
Can use moments to get rotational inertia term John suggested: I{1}=\eta {{20}}+\eta _{{02}} from https://en.wikipedia.org/wiki/Image_moment
I should probably mention: the OpenCV simple blob detector computes inertial ratio by default. GRiP doesn't expose it as an option, but you should be able to set it in Java. Depending how your code is structured it might save you a lot of time.
Here's what setting up a simple blob detector looks like in Python - note the minInertiaRatio
line.
(from that camera calibration project I mentioned)
def make_detector(self):
# Setup SimpleBlobDetector parameters.
parms = cv2.SimpleBlobDetector_Params()
# Change thresholds
parms.minThreshold = 0;
parms.maxThreshold = 128;
# Filter by Area.
parms.filterByArea = True
parms.minArea = 5
# Filter by Circularity
parms.filterByCircularity = True
parms.minCircularity = 0.25
# Filter by Convexity
parms.filterByConvexity = False
parms.minConvexity = 0.9
parms.maxConvexity = 1
# Filter by Inertia
parms.filterByInertia = True
parms.minInertiaRatio = 0.5
# logger.debug("Orig minDistBetweenBlobs: " + str(parms.minDistBetweenBlobs))
parms.minDistBetweenBlobs = 5
parms.blobColor = 0
# Create a detector with the parameters
return cv2.SimpleBlobDetector_create(parms)
@jwalthour you did mention that Saturday (and possibly in Slack too), hence why I have the mention above about the inertial metric. However, you also mentioned that the blob detector seemed slower than finding lines or contours, so I thought finding the info using something other than the blob detector was worth trying.
great plans!
Today I started a draft version of this that uses the line finder. I figure it might end up being a useful starting point for later. I committed it to feature/outer_port_finder, but in separate files, so as to not interfere with the contour-based approach.
Determine a general approach to identify the high port vision target, and where the robot is relative to the target (position and orientation). Suggest using GRiP and example images from FIRST.