Lower the camera adjusts for the brightness

311 views
Skip to first unread message

Александр Зендриков

unread,
May 2, 2017, 3:40:23 PM5/2/17
to OpenPnP
Good evening . There is a problem. When the light at the bottom of the camera, the camera does not have time to tune in the desired brightness and the nozzle with the component to be lighted.
Here are two photos. At first the glare on the second photo is after a while when the camera is properly set up light

1.jpg
2.jpg

Cri S

unread,
May 2, 2017, 3:52:37 PM5/2/17
to OpenPnP
Three possibilty, disable AGC and set exposure time manually, use what you have, change illumination in order to trick out ADC a bit.
Post the raw image, not screenshoot, you can use double clicking, maybe the image can be used after little preprocessing.

Cri.s

Александр Зендриков

unread,
May 2, 2017, 3:55:31 PM5/2/17
to OpenPnP
And how to disable? AGC

Cri S

unread,
May 2, 2017, 4:54:00 PM5/2/17
to OpenPnP
 CV_CAP_PROP_EXPOSURE , the wizard should know it, if it works? maybe.
Usually camera accept this property only after acg is captured and most only if agc is looked in.
Otherwise you need to use external utility that initialize the camera correctly before starting opencv.
As i'm more biased to linux where such utility are plently available, on windows i know how to do that programmatically from c(+)
but don't know any utility that expose that.
Ps, post a picture of the "wrong" image if you are able, maybe it's usable.


Am Dienstag, 2. Mai 2017 21:55:31 UTC+2 schrieb Александр Зендриков:
And how to disable? AGC

Jason von Nieda

unread,
May 2, 2017, 4:57:16 PM5/2/17
to OpenPnP
An easy way to fix this, withing having to get into external utilities, is just set the Settle Time higher for the bottom vision camera. The settle time is the amount of time the camera will wait before capturing an image. This will slow your processing down, but it's an easy fix.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/53e4a8ae-4ca3-451b-9ba1-369fb99757d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marek T.

unread,
May 4, 2017, 6:41:11 PM5/4/17
to OpenPnP
I have the light of bottom camera turned on whole the time. The light of the top camera I turn on/off using "before.capture" and "after.capture" scripts when go with nozzle to bottom camera (otherwise light of the top camera makes bottom vision blind). But the bottom vision allignment is not the only one screenshot but some serie of 3-5, so I get also serie of 3-5 turn on/off of the top light. Because have to set settle time at least ~1000ms for the bottom camera good "stabilization", then this 1000ms multiplied by 3-5 makes total positioning time really too long (in my oppinion). Could be good if possible to kill the top light with before.capture like now but turn it on after whole the positioning process (when the nozzle leaves the bottom camera) only. Jason, Is there a problem to add some event like camera.after.final.capture?

BTW: tried what Cri says above with AGC, exposure and different light settings - but all for nothing. My actual camera (some 2mpx A4tech webcam with the lens replaced into C) does not allow to change too much.

Anatoly

unread,
May 4, 2017, 9:07:03 PM5/4/17
to OpenPnP
 Try to set CV_CAP_PROP_AUTO_EXPOSURE parameter to -1, then set proper values to CV_CAP_PROP_GAIN, CV_CAP_PROP_EXPOSURE parameters.

среда, 3 мая 2017 г., 3:54:00 UTC+7 пользователь Cri S написал:

Marek T.

unread,
May 5, 2017, 1:58:23 AM5/5/17
to OpenPnP
As said above I've tried what Cri says about AGC and exposure - and every other parameters for the camera reacts to. Gain in this camera doesn't work at all, same like autofocus off and many other. You can set what you want but camera chipset must react for this first.

Cri S

unread,
May 5, 2017, 6:14:43 AM5/5/17
to OpenPnP
Write 0 to settings and the control panel comes out. The second control panel is missing and it is unclear how to write down fourcc or guide
Everything what is grayed out is unsupported.
As example if I have tryed out openpnp with this mods I was not able to run longer as 10 minutes because opencv read zoom settings that return some values where camera capability say , don't use it. Probably some hook for special feature

Marek T.

unread,
May 5, 2017, 12:04:40 PM5/5/17
to OpenPnP
Cri, I'm not sure you write to me or to Александр...
I have tested settings of my camera using settings edition with Openpnp and with the camera windows driver instead (openpnp not running then). Never got good effects if the light of the top is flashing onto bottom. I'm just waiting for new camera but still think that it's better to turn up-light when coming with the nozzle to the bottom, and run it again when leave the botttom camera after completed scanning. I hope that Jason may add this kind of event as I said in some free time.

Cri S

unread,
May 5, 2017, 1:42:43 PM5/5/17
to OpenPnP
I'm have respond to you. I'm assuming windows, on linux you have other possibility that are far more powerful.
To test, you should remove all CAP_PROP from machine.xml if there are any.
then, you should set CAP_PROP_SETTING to 0  and enable "after camera open"
After hitting apply just some moments a dialog appears including all configurable parameters when not grayed out.
There exist a second configuration dialog for image format and dimension, that seems to not work, and i cannot check why because
after 3 Minutes java exit with core dump, the problem is the integrated webcam.

For activating/deactivating the camera, run a script inside the pipeline, and at the end of the pipeline using the scriptRun stage
Further you should run a script that takes 10/20/50/100 images, This gives you a overview of the quality of image and difference and how many samples it takes to look in.
The images get writtinen inside config directory.
Example here written in beanshell (.bsh)

i=0;
while(i<10) { i++;
    cam = org.openpnp.util.VisionUtils.getBottomVisionCamera();
    img=org.openpnp.util.OpenCvUtils.toMat(cam.capture()); tmp=img;
    img=org.openpnp.util.OpenCvUtils.gaussianBlur(img,3);
    img=org.openpnp.util.OpenCvUtils.toGray(img);    
    org.opencv.core.Core.normalize(img,img, 0, 255, 32);    
    img=org.openpnp.util.OpenCvUtils.gaussianBlur(img,3);  err=0.;
    org.opencv.highgui.Highgui.imwrite(config.getConfigurationDirectory().getAbsolutePath()+File.separator+"img"+i+".png",tmp);
 }

Marek T.

unread,
May 5, 2017, 7:38:15 PM5/5/17
to OpenPnP
Thanks Cri, it's really valuable information, we will try to use it.

Jason von Nieda

unread,
May 6, 2017, 9:16:55 AM5/6/17
to ope...@googlegroups.com

Marek T.

unread,
May 6, 2017, 10:32:20 AM5/6/17
to OpenPnP
Thanks Jason, I will start study and use it just after the weekend.
(BTW: I have sent you on email description and logs of some situations when get "transition from PreFlight" communicates. I hope you got it, understand that no-time to answer hundred questions in the same time).
Reply all
Reply to author
Forward
0 new messages