-
Notifications
You must be signed in to change notification settings - Fork 0
Camera Profiles
Here you can configure and fine-tune your camera. Octolapse allows you to control the camera settings (if supported by your camera and streamer) before each print, giving you complete control of how your snapshots look.
click to see the tab
You can get to the camera profiles by opening the Octolapse settings and clicking on the 'Camera' tab.
click to see the profile
Three types of cameras are supported in Octolapse: Webcams, external (script/DSLR) cameras, and Gcode triggered cameras.
Webcams must be accessible via http or https and must deliver jpg images (currently). Octolapse supports mjpegstreamer, yawcam, or any other streaming server or camera that can provide an image via a browser link.
This is the full path to the web camera. This address can be used in the Snapshot Address Template and the Camera Settings Request Templates by using the {camera_address} replacement token.
The initial setting (after install or after you restore the default settings) is based on the OctoPrint settings within the 'Webcam & Timelapse' screen. The OctoPrint default is (I believe) http://127.0.0.1:8080/
For Yawcam the default port is 8888, so if you haven't changed that and as long as your Yawcam instance is running on the same computer as OctoPrint, you should be able to use this as your base address: http://127.0.0.1:8888/
Notice that there is a trailing / on the address. This is important if you want to take advantage of some of the default settings (and you probably do).
If you are using a remote camera, that will work too as long as you enter the proper URL, and that the URL you are using is accessible from the host computer. If you are using HTTPS without a trusted certificate or a username/password, please see the advanced settings below.
You can either enter the full path for your webcam's snapshot page, or you can use the {camera_address} template. Using the {camera_address} token is preferred if for no other reason than to verify that the base address is correct. The base address is used for custom image preferences as well as some error checking, and it's important that you get it correct.
The default value is {camera_address}?action=snapshot
, which works well for mjpgstreamer (bundled with octopi). If you are using Yawcam you probably want to use {camera_address}out.jpg
The default full url after replacing the {camera_address} token with the default 'Base Address' above would be would be http://127.0.0.1:8080/?action=snapshot
for mjpegstreamer and http://127.0.0.1:8888/out.jpg
for Yawcam.
Click this button to make sure a snapshot can be downloaded from the provided Snapshot Address Template. Octolapse also performs this test at the beginning of a print to make sure the webcam is working. If it fails the test, the print will be cancelled and you'll receive an appropriate error message.
If you have custom image preferences enabled, 'Test Camera' will also test the application of your custom camera settings. Currently this is only available when using mjpegstreamer.
This camera type can be used to call a script when a snapshot needs to be taken. The primary use here is for DSLR cameras that support triggering, though there are lots of interesting things you could probably do here. I haven't done it yet, but I believe you could also use this to trigger a camera via GPIO.
See this beta guide for setting up a DSLR camera on Linux using gPhoto2. I have also gotten this to work on Windows using digiCamControl, but have not finished up the guide for that part yet.
This script will be executed after the printer position as stabilized and after any camera delay that you have configured. Normally a delay is not needed for a DSLR, but might be necessary in some situations.
The following parameters, in order, are sent to the script.
Snapshot Number - an integer value that increments after each successful snapshot
Delay Seconds - the camera delay in seconds
Data Directory - the path to the Octolapse data folder
Snapshot Directory - The path to the current camera's snapshot folder for the current print job. This directory may not exist, so be sure to create it before using the path!
Snapshot File Name - The expected file name of the snapshot after it has been taken
Snapshot Full Path - the full path and filename of the expected snapshot. If this file exists after the script has returned, Octolapse will treat it like any other snapshot, and will apply transposition, record metadata (for rendering overlays), and will generate a thumbnail that will be sent to the client.
If your printer contains an internal camera that can be triggered via gcode, normally via M240, you can use this camera type to take trigger your printer's camera. I've actually not tested this except through the debugger since I do not have a printer with a built-in camera, so I'm not 100% sure it will work. For this reason I'd welcome any feedback on this camera type!
Here you can enter any gcode that you want to execute to acquire a snapshot. You can enter as many lines as you like. Each line will be stripped of any comments, and sent to the printer. The gcode is sent after all script/webcam images start, but before they are completed. The snapshot will only complete once all of the script has been executed and the printer movements are completed. Octolapse will send an M400 followed by an M114 after the script has been sent, and will wait for a reply from the M114 before continuing.
It is NOT recommended that you change the position of the print head or any of the axis modes during this process, since it is possible that you will mess up the return script.
This value is in milliseconds, where 1000 milliseconds = 1 second. The delay will be applied after Octolapse moves the bed and extruder into position, but before a snapshot is taken. This can be used to give the camera enough time to adjust, keeping your images clear. If you set this value too high, you're prints will take longer and you may have stringing/quality issues. The default value is 125, but I've gotten good results with significantly lower values. Some users have reported needing to double this setting or more.
In general if your delay needs to be very high in order to get a clear image, there may be a few other things going on:
- Autofocus is enabled - It takes some time to autofocus. You will be able to lower your delay by manually focusing your camera.
- Other automatic settings - some of these may also impact the delay, but this is unknown.
- Low light conditions - some cameras require more light than others, and some cameras automatically adjust the exposure. Increasing the lighting and reducing the exposure time can lower the required delay and improve the output video quality significantly.
- SECURE YOUR CAMERA! A loose or wobbly camera will affect your timelapse. There is no way to get a smooth timelapse if the camera is bouncing around or sliding.
- Consider adding vibration dampening to your camera/printer, or move your camera to another structure.
Controls how long a snapshot can take before timing out in milliseconds (1000 milliseconds = 1 second). This applies to all camera types. If your snapshot takes longer than this, it will be cancelled as best as possible. Warning: If you are using a gcode camera, and it takes longer than the timeout to execute, but it eventually DOES execute, Octolapse may mistake the response as belonging to another request. This would be highly unusual to occur in practice, but in general you want to make sure any gcode cameras script does NOT time out.
Are your snapshots upside-down, rotated or transposed? You can fix this with the snapshot transposition option. These options are available:
- Flip Left and Right
- Flip Top and Bottom
- Rotate 90 Degrees
- Rotate 180 Degrees
- Rotate 270 Degrees
- Transpose
Here you can add scripts to be executed, per camera. The Before and After snapshot scripts will obey the 'Snapshot Timeout' while the initialization and rendering scripts will run until they are completed.
This script can be used to prepare your camera before any printing starts. I used this script to erase all of the existing images on my DSLR and to adjust the settings. It could be used for a variety of purposes. Currently only one parameter is passed into the script, the camera's name, but only because I'm not sure what might be useful here. Let me know what arguments would be useful and I'll consider adding them.
This script will be called after the printer has stabilized, but before any snapshots are taken. It might be useful to turn on lighting, to send a notification, or other things I haven't even thought of.
The following parameters, in order, are currently supplied to this script:
- Snapshot Number - an integer value that increments after each successful snapshot
- Delay Seconds - the camera delay in seconds
- Data Directory - the path to the Octolapse data folder
- Snapshot Directory - The path to the current camera's snapshot folder for the current print job.
- Snapshot File Name - The expected file name of the snapshot after it has been taken
- Snapshot Full Path - the full path and filename of the expected snapshot.
Note that the directories above may not exist, and there will be no file at the 'Snapshot Full Path' when this script is executed.
This script is executed after ALL cameras have completed (or failed) taking a snapshot. The parameters are the same as for the Before Snapshot Script
- Snapshot Number - an integer value that increments after each successful snapshot
- Delay Seconds - the camera delay in seconds
- Data Directory - the path to the Octolapse data folder
- Snapshot Directory - The path to the current camera's snapshot folder for the current print job. This directory may not exist, so be sure to create it before using the path!
- Snapshot File Name - The expected file name of the snapshot after it has been taken.
- Snapshot Full Path - the full path and filename of the expected snapshot.
Note that the directories above may not exist, and there may be no file at the 'Snapshot Full Path' when this script is executed.
This script is executed before rendering begins for this camera. This script runs with no timeout, so make sure it returns, else your rendering will never complete. It will only run if rendering is enabled, and will run even if there are no snapshots at the proper location to generate a timelapse. I used this script to download all images from my DSLR in order to reduce the amount of time it took to take snapshots (reduced it by more than half) for high res images. It could be used to apply custom image filters, and a whole lot more. Please let me know what you are using this for!
Parameters:
- Camera Name - The name of the camera profile used to generate the images
- Snapshot Directory - The path to the current camera's snapshot folder for the current print job. This directory may not exist, so be sure to create it before using the path!
- Snapshot File Name Template - A template that can be used to format the filenames so that ffmpeg can turn them into a timelapse.
- Snapshot Full Path Template - Combines the snapshot directory and the file name template.
Here is a bash script that I used to move and rename all of the images that I downloaded from my DSLR in order to render a timelapse from them:
a=0
for i in *.JPG *.jpg *.JPEG *.jpeg; do
new=$(printf "${SNAPSHOT_FILENAME_TEMPLATE}" "${a}")
mv -- "${i}" "${new}"
a=$((a+1))
done
I plan to add this to the DSLR guide soon.
This is called after rendering is completed successfully (not on error), but before any prepossessed images are deleted and before the rendered timelapse is optionally moved into the OctoPrint timelapse folder. This has not been tested too much because I haven't had a use for it yet. It was requested by a user who wanted to move completed timelapses to another server after rendering.
Parameters:
* Camera Name - The name of the camera profile used to generate the images
* Snapshot Directory - The path to the current camera's snapshot folder for the current print job. This directory may not exist, so be sure to create it before using the path!
* Snapshot File Name Template - A template that can be used to format the filenames so that ffmpeg can turn them into a timelapse.
* Snapshot Full Path Template - Combines the snapshot directory and the file name template.
* Timelapse Output Directory - The directory containing the final rendered timelapse.
* Timelapse Output Filename - The final timelapse file name without extension
* Timelapse Extension - The output extension of the rendered timelapse.
* Timelapse Full Path - The current location of any rendered timelapse.
* Synchronization Directory - The path to OctoPrint's Timelapse Folder.
* Synchronization Full Path - The full path to OctoPrint's Timelapse Folder. This path is guaranteed to be unique.
When enabled, Octolapse will attempt to apply your custom settings to the camera before every print. Not all cameras are capable of using all of the settings, sorry.
As of Octolapse V0.3.4, Custom Image Preferences are only supported if you are using a webcam stream with mjpegstreamer. Octolapse will NOT let you enable these features unless it detects that the camera is running from mjpegstreamer and that control.htm is accessible (read the notes below to see how to do this).
these changes are required in order to use the custom image preferences
If you are using octopi, to use the custom image preferences you'll need to make a small adjustment to your boot/octopi.txt file. See this troubleshooting guide to enable custom printer settings by allowing access to webcam/control.htm.
After you click 'Apply Now' (under general image preferences) you may have very poor image quality visible in your camera stream. This is because every camera is different, and the default settings will probably make your image look terrible. Expect to spend 10-15 minutes tweaking your image settings to get a good image. Make sure you have good lighting, and close the blinds! Also, it's best if your camera is running at minimum 4FPS (250MS camera delay per frame), preferably 8FPS(125MS camera delay per frame) to get a good image without having a large camera delay.
I recommend the following procedure:
- Start by making sure the following options are set to automatic: Auto White Balance Temperature = Checked, Exposure type = Auto, Autofocus Enabled = Checked
- Click Apply Now and note the image changes in your camera stream.
- Adjust the brightness, contrast, saturation and sharpness one at a time, clicking 'Apply Now' and checking the image between settings changes. The goal is not yet to get to the image perfect, just try to improve it a bit. You'll come back to these later probably.
- Put an object on your 3d printer in the center of the bed and point your camera right at it. You want your object and printer bed to be in the same place you want to take a snapshot for your timelapse.
- Uncheck 'Autofocus Enabled'. Set the 'Absolute Focus' to 15 and click 'apply now'. If your image is not sharp (it won't be), increment your focus by about 5 and repeat this step. Once it gets clear(ish) such that the next adjustment makes the image LESS SHARP, start reducing the focus by 1 or 2 until you are happy with the focus.
- Set 'Exposure Type' to 'Manual'. Start with the gain at 0 and exposure at 3. Keep increasing exposure until you have a good image. Now bump up the gain by about 20 until the image is both bright enough and has good color. Then decrease the exposure by 10 and see if raising the gain can give you a good image. The goal here is to reduce the exposure by as much as possible without having terrible color (due to the gain).
- Uncheck 'Auto White Balance Temperature' and change the 'White Balance Temperature' to 2000 and click 'Apply Now'. Increase the color temp by 500 until the colors start to look accurate. Note that the colors will shift from blueish to reddish.
- Go back to brightness/contrast/saturation and tweak some more. If you are not satisfied with the color/brightness here try going back to the exposure settings and raise the exposure if the image is too dark or lower it if it's washed out. Lower the gain/saturation if the colors are fuzzy and over-saturated.
- SAVE YOUR CHANGES BEFORE EXITING YOUR PROFILE! Otherwise you'll have to go through all of this again!
Now you should have a camera profile with no automatic settings at all. This should (as long as your lighting conditions are stable) minimize change between snapshots, giving you that butter smooth timelapse that you're craving :)
You can test your settings by clicking the 'Apply Now' button and looking at your camera's web stream. It may take a few seconds for the settings to be applied, so be patient. I recommend using two browser windows, one for the Octolapse settings, and another showing your webcam. Octolapse does not currently have an image preview, but this is coming.
128 is the default (50%) for each setting.
In theory this should control the quality of the final jpeg image in percent (1-100), but currently I can't tell if it's doing anything at all. This will be investigated at some point.
When enabled the white balance will be adjusted automatically. This could affect your snapshot delay.
This setting is available when Auto White Balance Temperature is disabled. Here you can color correct your images based on the temperature of your light source in kelvin. A higher value will give you a more yellow image, while a lower value will give you a bluer image. This is backwards from how the color temperature is labeled on a light bulb, so make a note of the difference.
Supposedly improved the image if the target is illuminated from behind.
There are four settings here, but I only understand two of them. It's possible my camera only supports two of the options, which are:
- Manual
- Auto - Aperture Priority Mode
If manual exposure is selected, you'll have access to some additional settings
Higher values will give you longer exposures. The higher the exposure value the longer the image will take to capture, but the image will be brighter.
Increase the brightness without increasing the exposure. You can somewhat compensate for lower light levels, but you may notice that some colors tend to wash out if your gain is too high.
Not sure what this setting does. If someone knows, please let me know!
Control the pan, tilt and Zoom! Some cameras have software pan, tilt and zoom, so you might want to try these settings out, even if you don't have a motorized camera with a zoom lens!
Autofocus takes time, and it may result in a blurry timelapse if your camera is off or if it focuses on the wrong thing. A much better option is to manually set your focus.
If Autofocus is NOT enabled, you can manually set the focus here. I recommend starting by increasing the focus by units of 5 at first, then reversing direction when the image becomes worse, moving by 1 unit at a time until you either find the best value, or you can't tell a difference anymore. It helps to put book or something else with printed text EXACTLY where your print will be. It is much easier to adjust the focus when there is sharp text at the focal point.
In theory these settings control your camera LED. I've not noticed any effect. Will try to debug as soon as I get some different cameras to test.
Can be Auto, On, Off or Blink. Not sure if this works (no light on my camera).
I'm guessing this is either the blinking frequency or effectively the LED brightness. It could be both. If anyone knows, please let me know
Supposedly this eliminates flicker according to the frequency of your mains power, but I haven't noticed any effect. Someone let me know if they notice any effect here.
These are advanced settings that impact the security of Octolapse and Octoprint. Do NOT use them unless you are sure you need to.
If you are using a remote webcam you may want to communicate with it over HTTPS. Normally a valid SSL certificate is required, but many people are using a self-signed certificate. You may still see ssl warnings in the log file (plugin_octolapse.log) depending on your debug settings.
Warning: This option could leave you open to certain kinds of attacks. If you use this option make sure your local network is secure.
If your camera requires authentication you can provide it here. WARNING: Your username is stored in plain text within the settings.json file. Additionally if you enable certain diagnostic logging (log settings save, log settings load), your username will appear within the log file! Finally, if you are using a remote webcam without SSL your username will be sent in PLAIN TEXT over the network!
If you leave the username field blank, no sign-in credentials will be sent.
If your camera requires a password for basic authentication you can provide it here. WARNING: Your password is stored in plain text within the settings.json file. Additionally if you enable certain diagnostic logging (log settings save, log settings load), your password will appear within the log file! Finally, if you are using a remote webcam without SSL your password will be sent in PLAIN TEXT over the network! Please be careful with your passwords and NEVER reuse your webcam password anywhere else! If you are not using authentication (no user name entered) please erase any password entered here and save over your existing profile.
I discovered these URLs by watching requests sent to mjpegstreamer when I made changes within the default settings page. I"m not sure if they are standard, of if they change from camera to camera, so I created templates for each setting. Hopefully they can be made to work with additional camera servers too.
If you come up with a new or different template that works, please let me know the make and model number of your camera, the new template value (using the {camera_address} token for the base address of the camera), and which setting it changes and I'll see about adding a profile, or updating the default settings.
Octolapse is provided without warranties of any kind. By installing Octolapse you agree to accept all liability for any damage caused directly or indirectly by Octolapse.
Use caution and never leave your printer unattended.