New Advanced Camera Calibration is available for testing

651 views
Skip to first unread message

tonyl...@gmail.com

unread,
Dec 19, 2021, 11:02:02 PM12/19/21
to OpenPnP
Mark has merged the new Advanced Camera Calibration into the test branch.  Please give it a try.  You can run it either directly from the Advanced Calibration tab for the camera or via Issues and Solutions.  There is a wiki page here that should give you a pretty good explanation on what it does.

jdlv...@gmail.com

unread,
Dec 26, 2021, 10:15:00 AM12/26/21
to OpenPnP
Hi Tony
new advanced camera calibration is nice! Thank you very much.
Calibrating bottom camera improves placement accuracy a lot!
0.5mm pitch parts placing is now easy:

sot363.png




bottom1.png

bottom2.png
bottom3.png

I did calibrate the top camera too and hit a side effect, the center is not a the image center, there is an offset. That's a bit annoying as you can see in the picture after calibration:

topcameracalibrated.png

Before calibration :

uncalibrated.png

Should I have to correct the camera mounting errors to recover the full view area and recover OCR?

And the calibration results for top camera :

calibration1.png

calibration2.png
calibration3.png

Thank you.
joël

tonyl...@gmail.com

unread,
Dec 26, 2021, 11:55:45 AM12/26/21
to OpenPnP
Thanks  Joël for testing this.  As explained here, if your cameras are tilted, the size of the largest object you can center on the crosshairs will be reduced (the image will appear to be off center relative to the crosshairs).  This is a consequence of having the pixel that corresponds to the camera's vertical ray appear at the intersection of the crosshairs.   According to your top camera diagnostics, it is currently tilted 1.677 degrees about the X-axis - this explains why your images appear shifted in the positive Y direction relative to the crosshairs.  Correcting that physical tilt should get the image centered on the crosshairs and recover your OCR capability.

jdlv...@gmail.com

unread,
Dec 27, 2021, 6:17:12 AM12/27/21
to OpenPnP
Thanks, that's clear now. Correcting physically is the only way.

joël

Zdenko Stanec

unread,
Dec 28, 2021, 12:05:13 PM12/28/21
to OpenPnP
Hi, 

I started testing the new "Advanced Camera Calibration", "Top_Cam" went well I think :D..., this is 1mm graph paper but it does not 100% align with "OpenPnP Ruler" but I think it is OK.

20211227_143104_1024x577.jpg

"Bottom_Cam" is a different story, when I saw the results I just giggled and went on to lunch, so the first "Z" calibration went fine (-32.00mm), on the second "Z" (-15.00mm) it was not possible to detect nozzle anymore. I tried calibrating "Bottom_Cam" again via the standard calibration process and then one more time I tried "Advanced Camera Calibration" it seems in my case it is not possible to detect Nozzle on the "Second Z" in "Advanced Camera Calibration", this "Second Z" (-15.00mm) is given by standard Calibration process and it is too blurry to be tracked by the calibration process.

Can I change this "Second Z" (-15.00mm) to for example -25.00mm to be in a "good" focus? In that case, I would have First Z on -32.00mm and second Z on -25.00mm.

20211227_150131_1024x577.jpgž

Best regards,

Zdenko

Jim Freeman

unread,
Dec 28, 2021, 12:45:29 PM12/28/21
to OpenPnP
Hi, Tony. I ran the advanced camera calibration (for the up-looking camera). I have run it twice. (with different lighting to see if that is the problem.) After a good amount of time, it fails, and gives "Error 0". It fails on the second pass through the points (it seems) and when the nozzle is very close to the limiting field of view. It could be that at that angle the "target image" is not seen. Do you have any suggestions?
Best, Jim


On Sun, Dec 19, 2021 at 10:02 PM tonyl...@gmail.com <tonyl...@gmail.com> wrote:
Mark has merged the new Advanced Camera Calibration into the test branch.  Please give it a try.  You can run it either directly from the Advanced Calibration tab for the camera or via Issues and Solutions.  There is a wiki page here that should give you a pretty good explanation on what it does.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/82f4620f-1882-4246-86dc-820dd3fe272fn%40googlegroups.com.

Jim Freeman

unread,
Dec 28, 2021, 12:54:21 PM12/28/21
to OpenPnP
When I go to the Advanced calibration tab, I get a different error:



On Sun, Dec 19, 2021 at 10:02 PM tonyl...@gmail.com <tonyl...@gmail.com> wrote:
Mark has merged the new Advanced Camera Calibration into the test branch.  Please give it a try.  You can run it either directly from the Advanced Calibration tab for the camera or via Issues and Solutions.  There is a wiki page here that should give you a pretty good explanation on what it does.

--
Advanced calibration error.PNG

Jim Freeman

unread,
Dec 28, 2021, 3:27:47 PM12/28/21
to OpenPnP
I have traced down (at least part) of my trouble. For my up-looking camera, part of the pixels are "mechanically" cropped. That is they are obstructed by the base plate of the machine.The automatic calibration tries to find target images in those locations and cannot. That generates the "error 0" message. Is there a way to crop the pixels used in the calibration? ie  only use pixels X_i to X_j, Y_ii to Y_jj  ?  The image transformation tab does not seem to do that.
Best, Jim

jdlv

unread,
Dec 28, 2021, 3:36:04 PM12/28/21
to ope...@googlegroups.com

https://github.com/openpnp/openpnp/wiki/Advanced-Camera-Calibration#general-settings

"Note that Cropped Width and Cropped Height are applied to the raw camera images prior to any other corrections made by this calibration. Therefore, calibration data is only collected over the cropped image and any corrections will only be valid over that portion of the raw image."

Is it what you are looking for?

joël

james.edwa...@gmail.com

unread,
Dec 28, 2021, 4:06:41 PM12/28/21
to ope...@googlegroups.com

Thanks! I did try that but  I have mechanically cropped pixels on top and bottom both. So I need to crop on both sides of the center of the image.

tonyl...@gmail.com

unread,
Dec 28, 2021, 4:29:12 PM12/28/21
to OpenPnP
> Can I change this "Second Z" (-15.00mm) to for example -25.00mm to be in a "good" focus?

Yes, that should be fine.

tonyl...@gmail.com

unread,
Dec 28, 2021, 4:31:29 PM12/28/21
to OpenPnP
>  I have mechanically cropped pixels on top and bottom both. So I need to crop on both sides of the center of the image.

The Cropped Width and Cropped Height settings should do precisely that - they crop equal amounts off the edges of the image.

james.edwa...@gmail.com

unread,
Dec 28, 2021, 5:50:55 PM12/28/21
to ope...@googlegroups.com

tonyl...@gmail.com

unread,
Dec 28, 2021, 10:18:39 PM12/28/21
to OpenPnP
Jim,

Could you post your machine.xml and logs (with logging level set to trace) for the "Error 0" and the null pointer exceptions?

Thanks,
Tony

Zdenko Stanec

unread,
Dec 29, 2021, 10:58:30 AM12/29/21
to OpenPnP
Hi,

Crop function for "Bottom Cam" is working fine for me, but for "Top Cam" I have an issue.

20211229_144642_1024x577.jpg20211229_144652_1024x577.jpg20211229_144706_1024x577.jpg

Best regards,

Zdenko

tonyl...@gmail.com

unread,
Dec 29, 2021, 12:14:38 PM12/29/21
to OpenPnP
> but for "Top Cam" I have an issue.

Are you recalibrating after changing the cropped width and height?  Please read the wiki about General Settings - they need to be setup prior to running the calibration.

Zdenko Stanec

unread,
Dec 29, 2021, 12:31:18 PM12/29/21
to OpenPnP
 Hi Tony,

Lets put it like this, the short answer is "No" as I thought it was some kind of an issue as I did not have this problem with "Bottom Cam", for "Bottom Cam" I used the Crop function and it was properly "symmetrically" cropped on top and bottom and left and right so I proceeded with calibration.

For "Top Cam" when I have seen this "issue" I did not proceed with calibration, I removed cropped pixels and continued without it.

So, do you think I should continue with calibration even if it is not cropped symmetrically like in pictures?

Best regards,

Zdenko

tonyl...@gmail.com

unread,
Dec 29, 2021, 1:17:53 PM12/29/21
to OpenPnP
If you've already run the advanced calibration, you are seeing its results in the camera view.  If you uncheck the Apply Calibration checkbox you should see the raw uncalibrated images in the camera view and then you can adjust the cropping as desired.  Once you are satisfied, then re-run the calibration.  I suspect it appeared to work ok with your bottom camera because it has less tilt than your top camera.

Jim Freeman

unread,
Dec 29, 2021, 1:28:33 PM12/29/21
to OpenPnP
Hi, Tony. I am getting 2 errors. The "Error 0" is when the circle of the nozzle is not detected. Here is the log file when I get Error 0. ( toward the bottom.)

Another error I get is this, while in the camera/advanced calibration tab, when I try to jog the nozzle.

Best, Jim






OpenPnP.3.log
Jogging error.PNG

Jim Freeman

unread,
Dec 29, 2021, 1:41:46 PM12/29/21
to OpenPnP
Also there seems to be some issues communicating between Mark's camera calibration and your advanced calibration. Here are 2 screen shots, one showing the search for circle is et at 23. The other is your advanced screen where it shows 0.

Best, Jim


On Tue, Dec 28, 2021 at 9:18 PM tonyl...@gmail.com <tonyl...@gmail.com> wrote:
feature diameter 22.PNG
detection diameter 0.PNG

Jim Freeman

unread,
Dec 29, 2021, 1:43:02 PM12/29/21
to OpenPnP
Hi, Tony. A suggestion:

For me at least, I get a lot of failures of the up-looking camera calibration. I am sure it is due to my setup. I have a camera at -20cm from the Z working plane. My field of view is about 8x8 cm. (I have very big parts.) As the nozzle is moved to the extreme cases I get occulting of the image, (I am working on fixing it.) For me it would be very useful if the calibration did a few test images at the extrema first  so I could see if it is going to fail and then tweak something.  As it is, I wait a considerable time, then toward the end, the calibration fails, and I start again.
Best, Jim


On Tue, Dec 28, 2021 at 9:18 PM tonyl...@gmail.com <tonyl...@gmail.com> wrote:

tonyl...@gmail.com

unread,
Dec 29, 2021, 1:49:51 PM12/29/21
to OpenPnP
Jim,

Are the "Error 0" you're talking about really these:
2021-12-28 11:38:08.364 MessageBoxes DEBUG: Error: java.lang.ArrayIndexOutOfBoundsException: 0?

And wrt the jogging errors, are you actually following the very first step which is to select a nozzle and load it with the smallest nozzle tip?  Even if it is already loaded with the nozzle tip you intend to use you still need to select it using the dropdown menu on the Machine Control panel. 

Jim Freeman

unread,
Dec 29, 2021, 2:32:55 PM12/29/21
to OpenPnP
The "Error 0" appears as a box on the camera screen. Yes, I believe the trace log file shows the out-of-bounds error. 
I just ran a successful bottom camera calibration. Your addition to openpnp is going to be very useful! I only ran 8 radial lines as I expected it to fail, but it worked. Here is a screen shot of some of the results. I am trying to understand what "Z axis angular error" means. It wasn't clear to me in the Wiki page you referenced:

Bottom camera calibration results.PNG

tonyl...@gmail.com

unread,
Dec 29, 2021, 3:07:55 PM12/29/21
to OpenPnP
> I am trying to understand what "Z axis angular error" means.

Well, ideally you'd like your camera mounted such that every row of pixels in the image is parallel with your machine X-axis and every column of pixels is parallel with your machine Y-Axis.  The Z axis angular error is basically just a measure of how far the rows and columns are rotated from that ideal - that is, how much the camera is rotated about the machine Z-axis.

Zdenko Stanec

unread,
Dec 29, 2021, 3:52:53 PM12/29/21
to OpenPnP
Hi Tony,

"Top Cam" tilt is ok, X:0.297, Y:0.110, Z:0.131 deg.

If you look carefully at the top pictures I have sent, "Crop" is done like it should be done, just the picture is not in the middle of the viewing box, so I need to for example do something/fiddle with "horizontal/vertical" options to "refresh" it and then it is ok.

In the end, I managed to do complete calibration of "Top Cam" and "Bottom Cam", with no issues placing TQFP-64s in the end and some 0603.

Three things that are probably some "issues":
1. When I did a "Crop" on "Top Cam" and "Bottom Cam" I wanted to input for example 1050pix on horizontal or vertical and complete OpenPnP froze and I needed to restart it, I later tested with values that don't start with 1, for example, 950pix and it was ok, strange.
2. After the Second Z "Top Cam" on -6.8mm, when calibration finished my Nozzle N1 went to Z -32.00mm, I don't know why.
3. After the Second Z "Bottom Cam" on -27.00mm, when calibration finished my Nozzle N1 stayed on Z -27.00mm.

It would be OK for nozzles to go back to Z 0.

Best regards,

Zdenko,

tonyl...@gmail.com

unread,
Dec 29, 2021, 5:20:25 PM12/29/21
to OpenPnP
Zdenko,

If you uncheck the Apply Calibration checkbox, do the crop width and height settings then work as expected - the image is centered with equal amounts cropped from the edges?  If so, I think you just need to re-run the calibration after you set the crop settings.  I can't guarantee the results if you change the crop settings without re-running the calibration.  I probably should change the GUI to invalidate the current calibration whenever the crop settings are changed.  That should force the operator to re-run the calibration.

>do something/fiddle with "horizontal/vertical" options to "refresh"
Can you be more specific?  It is almost impossible to track down the problem unless I can duplicate what you are doing.

Is item 1 of your issues list reproducible?  I can't think of any reason that the changes for advance calibration would cause this.  If you can reproduce it, can you try the same with the develop branch to see if the problem is there as well?
For items 2 and 3, can you post your log files?

james.edwa...@gmail.com

unread,
Dec 29, 2021, 5:47:29 PM12/29/21
to ope...@googlegroups.com

Sam Vanheule

unread,
Dec 31, 2021, 10:21:41 AM12/31/21
to OpenPnP
Not sure if this is still relevant. I did encounter an error right at the end of the calibration sequence. (I'm using OpenPnP Test version: 2021-12-01_16-22-39.33a9c07)

I did attach machine.xml for reference of testpoints.

Thanks,
Sam

machine_advanced_bottom_cam_calib_error.xml
Bottom camera calibration error2.png
Bottom camera calibration error.png

tonyl...@gmail.com

unread,
Dec 31, 2021, 11:28:29 AM12/31/21
to OpenPnP
From your screen shot it, it appears you have both the primary and secondary cal Z set to zero - that won't work - they need to be at two different levels. I need to add a check for that before calibration actually starts.

Jim Freeman

unread,
Dec 31, 2021, 1:55:59 PM12/31/21
to OpenPnP
Hi, Tony. I just did a successful down-looking camera advanced calibration. When I then go to the secondary fiducial I see it is somewhat off.. Is it to be expected that it is off center? (ie does your advanced calibration update the target location)?
Also after the advanced calibration, when I go to the HOME fiducial, I am off by about 150 microns. After I re-home, I go back to the secondary fiducial and I am even more off than before. I am attaching 5 files: 
A normal homing
advanced homing calibration results
secondary fiducial location after advanced calibration
home location after advanced calibration
secondary fiducial after advanced calibration and rehoming.
Best, Jim


Home offset after advanced calibration.PNG
Secondary fiducial after advanced down-looking camera calibration.PNG
Successful homing.PNG
secondary fidicual after re-homing.PNG
Adanced caibration results.PNG

tonyl...@gmail.com

unread,
Dec 31, 2021, 5:28:49 PM12/31/21
to OpenPnP
Hi Jim,

So is the image "Home offset after advanced calibration" an image taken before the machine was rehomed or after?  I can't explain that offset if it happened after rehoming.  Right after advanced calibration of your top camera, a homing cycle needs to be performed because the camera's head offsets may have changed. Did it not do that automatically?

Because your camera has some tilt (-1.5 degrees about the Y-axis), there will be some offsets of locations (that were captured with the camera prior to running advanced calibration) that were not at the same height as the primary calibration fiducial.  That probably explains the offset of the secondary fiducial you are observing.

Mark may have to step in here as he may have made some changes when advanced calibration was merged in with I&S.  But, AFAIK, advanced camera calibration doesn't update locations of anything other than the bottom camera.  However, it does update the head offsets of the top camera in an attempt to compensate for any offsets that may have been caused by the camera tilt prior to advanced calibration being run.  But that can only correct for offsets at a single Z height (namely the primary calibration Z height).

james.edwa...@gmail.com

unread,
Dec 31, 2021, 5:44:08 PM12/31/21
to ope...@googlegroups.com

Hi, Tony. The “home offset image” is before homing. It didn’t re-home automatically after the calibration. That is OK, I am happy to do it myself. Actually the primary and secondary fiducials (after re-homing) both had about the same offset, about 1.5mm in X and -0.2mm in Y, which are very close to the offsets found in your calibration cycle.  If I assume that these offsets are due to the calibration, I can manually update the fiducial locations. It is interesting to see that the calibration X offset is larger than the Y offset, even though the Y axis is more out-of-alignment.

Thanks for the info, and Happy New Year!

Best, Jim

tonyl...@gmail.com

unread,
Dec 31, 2021, 5:59:40 PM12/31/21
to OpenPnP
The automatic rehoming may have been something Mark took out - I think somebody had an issue with it.  Note that camera tilt about the Y-axis causes the image to shift in the X direction and tilt about the X-axis causes the image to shift in the Y direction so I think your results are all consistent.

fxframes

unread,
Jan 3, 2022, 6:49:47 AM1/3/22
to OpenPnP

On Mac it seems the "accept" button is disabled in Issues & Solutions on the test version (just downloaded)...?

Screenshot 2022-01-03 at 11.42.01.png
Reply all
Reply to author
Forward
0 new messages