Working camera capture with Lightburn

Update 17.12.2022

I removed the OBS camera and added the step to install @Mayco s Snapmaker Lightburn Host.

Update 16.12.2022

Hello all,

as promised, here is a short tutorial on how to use the camera support of the Snapmaker Laser Module with Lightburn.

First of all: I came up with this when I looked at how to calibrate the camera for Lightburn. Only static images are needed, and we can easily create that with the 10 Watt Laser Module.
Actually, I’m a Linux person, but I made this stab with a Windows system. On Linux it will probably work much easier :wink:

To all people with the 1.6 Watt laser module: Sorry - it’s not that easy.

Roughly, it works like this:

A virtual webcam is fed with still images, which we generate via web requests directly through the API.

Step 1: We need a virtual webcam software. @Mayco programmed a good solution for this.
At his github page you’ll find the Snapmaker Lightburn Host. A small tool which feeds a virtual webcam with pictures taken with your snapmaker laser camera. Works great. Please follow his installation instructions. GitHub - PolymerPrints/SnapmakerLightBurnHost: Snapmaker 2.0 10W laser camera in LightBurn

!!! Attention !!! This software starts a web request which moves your laser head, close it after you took your pictures

Step 3: Turn on Snapmaker and find out the IP, this can be done via the settings menu.

Step 4: Start the Snapmaker Lightburn Host, like it’s described in Maycos instructions.
To make it easier for later starts, it’s possible to create a shortcut to the SnapmakerLightburnHost.exe with your snapmakers ip as start parameter.

The Camera Capture System option behaves weird on my system, so just try the best setting for you.

Step 6: Start Lightburn. Under the menu Laser Tools > Calibrate Camera Lens you should now be able to select the DirectShow Softcam.

If you now have a picture there, it worked :slight_smile: . If there’s a grey image, or the Softcam is not selectable lightburn cannot read the virtual camera. In the Lightburn settings you may switch the following option.
image

When the Camera is still not working, there may be an error loading the dll, then a reboot may help.

Step 7: Execute the Camera Calibration. This is described in the Lightburn documentation. There is also a great video about it.

You have to take a look at it before you continue reading here.

There are the following points to note here:

Our camera is static for Lightburn, because the photos are always taken from a fixed position.
For each photo that is taken in Lightburn during calibration, it is important to keep in mind that we do not have realtime recordings here. Here the following procedure has proven itself:

  • Place the Lightburn calibration card (It makes sense to make it beforehand, I lasered mine out of 5 mm poplar plywood).
  • Start the Powershell script to create the new camera_capture.jpg
  • Check in OBS if the new photo arrived, otherwise reload the image source.
  • Check if the new image is displayed in Lightburn.
  • Click Capture.
  • Re-place the calibration card, and then start again.

When the calibration is done, you have the possibility to choose the photo as background for the build area, just like in Luban.
It is also possible to draw on your material, Lightburn will parse it for you, and you can laser it directly. (The controls for this are in the Camera tab on the right).
I am endlessly impressed by the precision Lightburn delivers here.

I hope these instructions are understandable. Yes, in the end it is a crutch, especially the detour via the virtual camera, but it works and that’s the main thing!

Bonus: Picture of a laser cut 3 legged gnome, scribbled with a sharpie on 5 mm poplar plywood. What a precision!


Hey guys,

I managed to get the snapmaker laser camera to work with lightburn.
Too tired now to write a tutorial, but I’ll update this thread tomorrow.

Here are some pictures to prove it :slight_smile:

Video gif. A young boy dances happily, his hands moving from his chest to his upper legs as he moves.


13 Likes

Amazing! Expect the tutorial. :smile:

Updated!
I hope this brings you further!
If you have questions, just reply to this thread :slight_smile:

2 Likes

Great job and nice explanation! Minor note: in LightBurn settings, “Camera Capture System” must be set to “Default Camera System”. Mine was set to “Custom” (not sure if default) and I couldn’t see any DirectDraw devices.

Based on your findings, I whipped up a small proof-of-concept application using softcam that takes out the script + OBS steps and automatically requests a new image from the Snapmaker as quickly as possible (which is still really slow, one image per 10 seconds or so).

I can share it if that’s okay with you.

1 Like

Thank you!

This ist more I ever dreamed of :slight_smile:
Would be nice If you publish your application.
But I think calling the camera endpoint in a loop ist a bit dangerous, because it generates movement. Maybe you enable it to work in a manual way, also!
A calibration and a snapshot mode or sth. like that.

I’ll add your hint to the tutorial later.
In fact in knew about this, but i forgot to mention.

1 Like

Initial version is out: GitHub - PolymerPrints/SnapmakerLightBurnHost: Snapmaker 2.0 10W laser camera in LightBurn. It no longer fetches images automatically but will do so when the user presses ENTER.

If there is anything you would like to add/change/remove in the ReadMe please let me know.

1 Like

Very impressive! Thanks! Works like a charm. Is it possible to disable the listener for the Enter button when the window is not active? I accidentally shot a few photos while updating the tutorial :smiley:

Sadly I needed to do a new calibration. The settings export did not work for me.

Yes, that’s possible. I fixed it in the latest version (now available on GitHub).

1 Like

Sorry for the double post, but I updated the tool to perform a material thickness measurement when SPACE is pressed. Can be downloaded from GitHub.

afbeelding

2 Likes

Nice one! I also thought a feature like this could be useful.

Hey, thanks for the awesome work you guys are doing. I (and I believe many others) have been wishing for this functionality for a while, so this is a big deal and I (we) really appreciate your efforts.

I got the softcam installed and it will take and image and put it in the folder. Lightburn also will let me select DirectShow Softcam as an option in Camera Lens Calibration, but it doesn’t show anything in camera view and Back and Next are both grayed out. It is set to Default Capture System, and I have rebooted both the Snapmaker and my computer a couple of times just to see if it helped. Any ideas?

1 Like

This could have many causes, but if the application captures an image successful and a picture file is placed in the directory, the virtual camera should work.

I could be that Lightburn is missing some permissions, but that’s just speculation.
Maybe you could try the virtual camera in google meet / zoom / teams or whatever to see if it’s working there.

@Mayco do you have an idea?

As Slynold said, please check in a camera application to see if anything shows up. In addition, please share any logging visible in the terminal.

The virtual camera doesn’t show up at all in my PC as a camera or as anything in Google Meeting or Discord. In fact the only place I can see DirectShow Softcam is in LightBurn, but it doesn’t let me go forward with selecting it there. There is no logging of anything in the console except the image request and retrieval:

[19-12 17:23:31] Virtual camera has started @ 192.168.1.4
[19-12 17:23:31] Press ENTER to request a new image from base position (warning: will move bed & laser!)
[19-12 17:23:31] Press SPACE to request material thickness from base position (warning: will move bed & laser!)
[19-12 17:23:36] New image requested, please wait…
[19-12 17:23:36] → cURL: Sending request to camera…
[19-12 17:23:51] → cURL: Retrieving image…
[19-12 17:23:51] Image sent to virtual camera. Press ENTER to request a new image.

It saves the image as “latest.jpg” in the same directory as the program. It’s clean and clear and looks perfectly fine.

1 Like

Could you share your “latest.jpg”? I can check if loading and displaying it works on my end.

Thanks. Unfortunately I cannot reproduce it on my end. Can you check if LightBurn is up-to-date (1.3.01) just in case? Probably a silly question, but I assume you keep the application running while working in LightBurn?

I do keep the application running, and my LightBurn seems up to date (1.3.01)

I didn’t see any other dependencies or anything that I missed. Is the DirectShow that you used a 32-bit or 64-bit application? I assume it’s 64 since its working with LightBurn for you guys, but I did see that mentioned as a compatibility issue a few places.

DirectShow is part of the Windows SDK, and it is built as part of softcam, which in turn is built in Release/x64 configuration (by me) and the installer is included as “softcam-installer.zip”.

I have included the 32-bit version of softcam for you to try, but to be honest I would be surprised if it works seeing LightBurn you are most likely running the 64-bit version of LightBurn.

softcam-installer32.zip (411.3 KB)

Ok, I did reinstall, re-register, and reboot everything and I think it’s working now! Thanks so much for your help and I sincerely appreciate what you guys have done.

2 Likes