WayOutWest wrote:vonnieda wrote:I've been having very good luck with this by using the HSV color space.
Actually I don't think HSV had anything to do with it... you covered up the curves with a flat disc to hide the curves!
I'd like to see the before/after shots of your HSV manipulations without the green disc in place.
I tried HSV initially too; I would convert to HSV then multiply the V (intensity) by the H-distance from the color point to pure green. So the closer to green, the more blackened the post-transform image would be. The problem was that shades of gray, like you get from curvature and shadows, have have ill-defined/degenerate hue in the HSV colorspace. So if you have a field of black/white/gray and you look at the H component after HSV you'll see some pretty wild noise.
Here's what the curvy part of the nozzle looks like:
I subtract pretty much everything between yellow and blue which gets the vast majority of the nozzle
Okay, with you so far...
and then the threshold gets everything that was too dark to discern a color from.
What about gray? For example a 50% gray has a very unstable hue; changing one of its RGB components by even the tiniest bit can change its hue from perfect-green to perfect-yellow. And it isn't dark at all (50% gray has 50% intensity/V).
If I do this, here's what I get:
Did you mean that you did something to pixels which had too little saturation? But if so, what?
Thanks,
The green disk is above the entire nozzle assembly from the perspective of the camera. It doesn't cover anything with regards to the nozzle. It only covers visual clutter on my head. Here it is in place so you can see what I mean:
- IMG_3010.JPG (225.8 KiB) Viewed 6440 times
The reason you didn't see any of the curves in the video I posted is that the chip was larger than the nozzle's diameter from the camera's perspective, so it was fully covered. Here are some examples with smaller parts:
- Screen Shot 2016-04-20 at 8.07.37 AM.png (373.7 KiB) Viewed 6440 times
- Screen Shot 2016-04-20 at 8.07.59 AM.png (150.54 KiB) Viewed 6440 times
- Screen Shot 2016-04-20 at 8.08.15 AM.png (369.63 KiB) Viewed 6440 times
- Screen Shot 2016-04-20 at 8.08.28 AM.png (148.56 KiB) Viewed 6440 times
The pipeline I am using roughly does the following:
Gaussian blur 9x9: Reduce noise in the image
Mask circle to center 525 pixels: Chop out everything outside the vision disk, primarily to remove visible head objects
Convert color from BGR to HSV_Full
Mask HSV subtracting all pixels with hue 60-130 at any V or S
Convert color from HSV_Full to BGR_Full
Convert color from BGR to gray
Threshold 100: primarily removes any visible bits of the black nozzle tip
Find contours
Filter any contours smaller than 50 pixels: Removes contours created by dust, noise
Draw the contours in white on a completely black background
Get min area rect of all the white pixels in the frame (basically finding the bounding box of all the previous contours)
So far this is working well for my entire test image data set, which is 24 different parts imaged at 3 different angles each. You can see those images at
https://www.dropbox.com/s/troh0pgt5jt4l ... 7.zip?dl=0
The only issue I have currently is that I need to adjust the MaskCircle stage based on the height of the part since the vision disk "shrinks" as the nozzle is raised to accommodate taller parts. You can see the problem in the "05_" series of images.
Jason