some camera advice/findings

WayOutWest
Posts: 198
Joined: Thu Jul 16, 2015 12:18 am
Location: Washington State, USA

Re: some camera advice/findings

Post by WayOutWest »

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:
upcam.jpg
upcam.jpg (65.17 KiB) Viewed 6450 times
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:
upcam2.jpg
upcam2.jpg (84.29 KiB) Viewed 6450 times
Did you mean that you did something to pixels which had too little saturation? But if so, what?

Thanks,
- Adam
vonnieda
Posts: 30
Joined: Sun Jan 03, 2016 7:05 pm

Re: some camera advice/findings

Post by vonnieda »

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
IMG_3010.JPG (225.8 KiB) Viewed 6444 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
Screen Shot 2016-04-20 at 8.07.37 AM.png (373.7 KiB) Viewed 6444 times
Screen Shot 2016-04-20 at 8.07.59 AM.png
Screen Shot 2016-04-20 at 8.07.59 AM.png (150.54 KiB) Viewed 6444 times
Screen Shot 2016-04-20 at 8.08.15 AM.png
Screen Shot 2016-04-20 at 8.08.15 AM.png (369.63 KiB) Viewed 6444 times
Screen Shot 2016-04-20 at 8.08.28 AM.png
Screen Shot 2016-04-20 at 8.08.28 AM.png (148.56 KiB) Viewed 6444 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
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: some camera advice/findings

Post by dampfboot »

Because of this posts I installed two logiteh C270 on my machine. It's running nice with it.

Unfortunately I get random camera errors while using the machine and/or placing parts. A red cross shows up instead of the camera view and I get an error message. After quitting the error message the machine keeps up placing but do not show a camera picture anymore.

I am running the latest Liteplacer Software on a Win 8.1 System on a Lenovo Thinkpad with an i5 processor and 4 GB RAM. The cameras are directly connected to one of the 4 different USB connectors of the laptop. I cross changed the cameras to the different connectors randomly already. I also tried the different camera settings in the Liteplacer Software makes no difference. I also tried it with a Windows running on a MAC Book of a friend - same issue.

1) @all
Any idea how to solve this problem - I am even willing to use/buy an other computer or trying out a different OS - but I would like to stay with the C270.

2) @Juha
After quitting the error message the software uses the cameras again correct but don't show the image on the screen - it would be nice if the software could display the image to the screen again also.

Thanks for your suggestions and help
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: some camera advice/findings

Post by dampfboot »

Me again:

I tried a second computer with win 7 and 8 MB RAM but I still get the red cross on the camera screen by chance.

Next step will be to go to a more modern computer with USB3 ports - even if i am not using USB3 the controller might be more sophisticatd and maybe that helps.

@Juha
Do you have any idea why the visual system stops working that way. I am a mechanical engineer and don'T have the ability to look deeper into the vision code. What do you think.
- is it some sort of memory problem
- some sort of hardware problem
. a connection problem

You must have programed the routine which shows the red cross so you might know when it will appear?

Is there any kind of error file which I could send or publish here. Even if I am not a customer of your hardware this problem might appear with your customers alos!

Rainer
JuKu
Site Admin
Posts: 1114
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: some camera advice/findings

Post by JuKu »

> You must have programed the routine which shows the red cross so you might know when it will appear?

No, that's the standard Windows "broken image link" function. I don't know why that happens. I'm still looking. One thing I do know (and will fix asap) is that the software doesn't handle the situation where a camera is found in the past, but goes away unexpectedly. In other words, it might be a connection issue or USB bandwidth, which might break the connection momentarily.
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: some camera advice/findings

Post by dampfboot »

I tried several core i5 computer with Win8.1 and Win 7 but get the red cross with all of it randomly with this message:

object is used currently elswhere

You can find quite some hints for this problem with this google search

windows camera "object is used currently elswhere"

I don't know anything about that. Does anybody else get such error messages too?
JuKu
Site Admin
Posts: 1114
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: some camera advice/findings

Post by JuKu »

Thank you! It has been very frustrating trying to fix an issue that never happens for me. Now when you get an actual error message with the red cross, I have a good idea what is the reason. I built a version for testing. I would appreciate if you would try this install and tell if anything changes, for better or worse:

http://www.liteplacer.com/Downloads/Lit ... 6_2016.exe

No promises (other than this version runs just as good (without errors) on my machine as the previous one) but it might be the fix.
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: some camera advice/findings

Post by dampfboot »

Thanks for this quick try to help!
Will try it out when I am back home tonight.

Rainer
JuKu
Site Admin
Posts: 1114
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: some camera advice/findings

Post by JuKu »

I got feedback from the test release already, and the test was successful, but did not completely cure the issue. A more comprehensive (complete?) fix for this issue is in today's release: http://www.liteplacer.com/Downloads/Lit ... 6_2016.exe
mike58
Posts: 12
Joined: Sat Jan 21, 2017 12:28 pm

Re: some camera advice/findings

Post by mike58 »

Hello
Thanks for sharing this information gentleman!
The conclusion is two C270 cameras or did this development continue ?
Post Reply