Webcam exposure

Is there any way to adjust the exposure of the webcam when streaming? I have a couple of LED spotlights on my extruder so I can see what is going on but they are too bright for the cam.. I can physically alter the circuit and add a higher value resistor to reduce the light output but I would rather not go that route if I don't have to.

I don't think I could say it any better than Gina did. If you are using one of the webcams made for the Raspberry Pi then it includes an exposure setting which may be set in octopi.txt here if you're using the OctoPi image.

Na, I have the logitech C270..
Just unplugged the LEDs seems much better
Think I should have gotten the pi cam..

Logitech cameras all support different subsets of UVC controls. The C270 does allow for manual exposure control via UVC, so you may need to use v4l2-ctl to set parameters or set them in mjpg-streamer's coniguration. Not sure if the octopi.txt settings will work for UVC cameras or not.

I'm going down to build something anyway, and I've got 2 of those C270's, so I can experiment.
Are there 2 of those octopi.txt files ? Cuz I'm only seeing one, and everything in it looks commented out with a # in front of every line

I checked the Logitech C270 FAQ page and didn't see anything helpful there

However, I also installed lights on the frame of my printer, and I'm not having any issues with it being too bright, but, my cams are aimed at the print head, not the lights

also using the C270, so this solution will work for you : https://discourse.octoprint.org/t/changed-the-video-feed-brightness-contrast-and-settings-for-my-logitech-usb-video

If there was an "embarrassed" emoji, I'd use it here

Can't believe I missed that

Thanks Dave! We get spoiled with Googles ability to find things even if the search terms are not correct.. Did not find that post when I was searching for this prior to posting.. I will get this completed today and post a before and after pick If that is allowed on this forum.. don't recall seeing any attachments so far..

FYI, Octolapse can (in many cases) control most of the camera settings without making config changes. They are applied before the print and rely on MJpegStreamer's web services, so won't always work.

You can disable rendering and stabilization, and still use Octolapse to apply the camera settings if you don't want to create a timelapse. You could even create multiple profiles to use in different lighting conditions.

Let me know if this helps, or if you have any questions.

Actually the solution Dave provided works but not as he has described it in his original post. I have gotten my cam configured really well now but am waiting on a print to get it setup to apply the setting on startup. Once I have that complete I will update Dave's post with a summary of what I have done.

1 Like

I know this is a long shot, but what setting did you end up using for your C270? I'm trying to tune mine, but most of the values seem to not change much. Brightness works, but the other ones aren't really doing anything.

I have a couple of configs I will load depending on the color of the plastic. In my home pi dir I have a bin dir and etc dir with the scripts and configs.
The script to load a config is simple, but could take the config as an argument, just didn't bother since once they are in the history file simple enough to recall them. Anyway

#!/bin/bash

#################################################################################
# Script  : gray_load_uvcdynctrl_config
# Purpose : Load config to set webcam image parameters
#
#################################################################################

/usr/bin/uvcdynctrl -L /home/pi/etc/grey_uvcdynctrl.conf

This is the default config

pi@octopi:~/etc$ cat uvcdynctrl.conf 
#V4L2/CTRL/0.0.2
APP{"libwebcam"}
# control data
#Brightness
ID{0x00980900};CHK{0:255:1:-8193}=VAL{120}
#Contrast
ID{0x00980901};CHK{0:255:1:57343}=VAL{30}
#Saturation
ID{0x00980902};CHK{0:255:1:57343}=VAL{40}
#White Balance Temperature, Auto
ID{0x0098090c};CHK{0:1:1:1}=VAL{0}
#Gain
ID{0x00980913};CHK{0:255:1:57343}=VAL{0}
#Power Line Frequency
ID{0x00980918};CHK{0:2:1:2}=VAL{2}
#White Balance Temperature
ID{0x0098091a};CHK{0:10000:10:61432}=VAL{3700}
#Sharpness
ID{0x0098091b};CHK{0:255:1:57343}=VAL{80}
#Backlight Compensation
ID{0x0098091c};CHK{0:1:1:57343}=VAL{0}
#Exposure, Auto
ID{0x009a0901};CHK{0:1:1:0}=VAL{1}
#Exposure (Absolute)
# 375 for dark 75 for white 
ID{0x009a0902};CHK{1:10000:1:166}=VAL{375}
#Exposure, Auto Priority
ID{0x009a0903};CHK{0:1:1:0}=VAL{0}

This is for darker colored filament

pi@octopi:~/etc$ cat grey*.conf 
#V4L2/CTRL/0.0.2
APP{"libwebcam"}
# control data
#Brightness
ID{0x00980900};CHK{0:255:1:-8193}=VAL{148}
#Contrast
ID{0x00980901};CHK{0:255:1:57343}=VAL{30}
#Saturation
ID{0x00980902};CHK{0:255:1:57343}=VAL{40}
#White Balance Temperature, Auto
ID{0x0098090c};CHK{0:1:1:1}=VAL{0}
#Gain
ID{0x00980913};CHK{0:255:1:57343}=VAL{0}
#Power Line Frequency
ID{0x00980918};CHK{0:2:1:2}=VAL{2}
#White Balance Temperature
ID{0x0098091a};CHK{0:10000:10:61432}=VAL{3700}
#Sharpness
ID{0x0098091b};CHK{0:255:1:57343}=VAL{80}
#Backlight Compensation
ID{0x0098091c};CHK{0:1:1:57343}=VAL{0}
#Exposure, Auto
ID{0x009a0901};CHK{0:1:1:0}=VAL{1}
#Exposure (Absolute)
# 375 for dark 75 for white 
ID{0x009a0902};CHK{1:10000:1:166}=VAL{145}
#Exposure, Auto Priority
ID{0x009a0903};CHK{0:1:1:0}=VAL{0}

This is for white or really light

pi@octopi:~/etc$ cat white*.conf 
#V4L2/CTRL/0.0.2
APP{"libwebcam"}
# control data
#Brightness
ID{0x00980900};CHK{0:255:1:-8193}=VAL{120}
#Contrast
ID{0x00980901};CHK{0:255:1:57343}=VAL{30}
#Saturation
ID{0x00980902};CHK{0:255:1:57343}=VAL{40}
#White Balance Temperature, Auto
ID{0x0098090c};CHK{0:1:1:1}=VAL{0}
#Gain
ID{0x00980913};CHK{0:255:1:57343}=VAL{0}
#Power Line Frequency
ID{0x00980918};CHK{0:2:1:2}=VAL{2}
#White Balance Temperature
ID{0x0098091a};CHK{0:10000:10:61432}=VAL{3700}
#Sharpness
ID{0x0098091b};CHK{0:255:1:57343}=VAL{80}
#Backlight Compensation
ID{0x0098091c};CHK{0:1:1:57343}=VAL{0}
#Exposure, Auto
ID{0x009a0901};CHK{0:1:1:0}=VAL{1}
#Exposure (Absolute)
# 375 for dark 75 for white 
ID{0x009a0902};CHK{1:10000:1:166}=VAL{110}
#Exposure, Auto Priority
ID{0x009a0903};CHK{0:1:1:0}=VAL{0}

Sir,

What method are you using to change settings when you change filament colors. I'm Linux stupid so...

I plan to follow every step you outline above to the best of my ability, but then what?

Did you create some sort of "macro button" in Octoprint to execute the command to change the camera's profile settings?

I apologize for my ignorance here, just not what the steps are to make things happen.

You mention you have scripts and configs. So the script executes the config? What calls the script?

Kyle <-- Again , Linux dumb

I log into the console and run the command passing it the conf file..
/usr/bin/uvcdynctrl -L /home/pi/etc/grey_uvcdynctrl.conf