16

The built-in iSight cam on my MacBook machine keeps re-adjusting the lighting (and focus I think). I need to manually set those, but I found nothing of any use in System Preferences or System Profiler.

Any way to access the settings? Any magic terminal commands that allows access to the camera Anyone has a driver that allows for any camera access?

Chealion
  • 25,408
  • 8
  • 67
  • 75
George Profenza
  • 820
  • 5
  • 20
  • 40
  • 7
    I want a nerdy solution, not a commercial app. I don't want to pay for using a webcam! – George Profenza Mar 12 '10 at 02:41
  • I don't think you understand what webcams are for. – Hasaan Chop Mar 12 '10 at 06:09
  • @NSD what do you mean ? What are webcams for ? @fideli - fair enough – George Profenza Mar 12 '10 at 14:10
  • George, @fideli won't get notified for your "at". Only the first one on each comment will get a notification. It's just how things work today. – cregox Mar 13 '10 at 02:41
  • @NSD I don't see how your comments are of any use. If apple says the webcam is only to be used with one purpose, do you have to agree ? if your hardware can make a lot more than your software allow it, should you close your eyes and pretend the posibilities aren't even there ? It's like saying 'I write software, but I only use APIs and never write my own. I just do what is easy to do.' – George Profenza Mar 13 '10 at 13:59
  • Might want to tag this as opencv as I, too, was doing some OpenCV stuff. – Qix - MONICA WAS MISTREATED Sep 10 '15 at 19:48

10 Answers10

9

Try uvcc, a tool to configure USB Video Class (UVC) compliant devices from the command line. You can find the uvcc source code on github. (Note: I'm the author.) It's a generic tool which should work for any UVC webcams, although I've only tested it with my Logitech C920 HD Pro Webcam.

Installing the uvcc npm package requires Node.js including npm, or run commands using npx.

# Install uvcc using npm.
npm install --global uvcc@latest

# Alternatively, skip install and use npx as a prefix to all uvcc commands.
npx uvcc@latest

Here is how to turn off automatic exposure and automatic white balance settings, and manually set white balance and contrast. Other controls are available.

# Export current configuration of the first UVC device found.
uvcc export

# Turn off automatic white balance.
uvcc set auto_white_balance_temperature 0

# Set the white balance temperature to 2000.
# NOTE: the white_balance_temperature range for Logitech C920 is 2000-6500.
uvcc set white_balance_temperature 2000

# Set exposure to manual.
uvcc set auto_exposure_mode 1

# Set exposure time to 500 milliseconds.
# NOTE: the absolute_exposure_time range for Logitech C920 is 3-2047.
uvcc set absolute_exposure_time 500

# Set the contrast to 192.
# NOTE: the contrast range for Logitech C920 is 0-255, default value 128.
uvcc set contrast 192

It is also possible to export and import several settings at once, in case you need to reliably and repeatedly configure one or more cameras for various situations. See USAGE.md.

Joel Purra
  • 954
  • 11
  • 11
  • 2
    This worked perfectly for me on my mid-2012 MacBook Pro's built-in iSight/FaceTime camera. Just needed to set `autoExposureMode 1` and then set `absoluteExposureTime` to the desired time in milliseconds (`500` in my case). – Jivan Pal Feb 17 '20 at 23:49
  • This worked for the built-in camera of my mac 17,1. I had to install node.js (installed the 14.17.4 LTS version here: https://nodejs.org/en/) and I had to chown permissions (sudo chown -R $USER /usr/local/lib/node_modules) after which uvcc would install with `npm install --global uvcc` – BartmanEH Aug 04 '21 at 17:38
  • @BartmanEH: great that it works! FYI `chown` to fix permissions isn't the recommended way; instead configure `npm` to use a subdirectory of your home directory. https://stackoverflow.com/a/23889603 – Joel Purra Sep 30 '21 at 16:01
  • I rarely use npm so I really know nothing about it. In fact, I installed npm just for this project! There's so many command line technologies one needs to learn: npm, homebrew, git... I just can't be an expert in all of them. chown'ing that folder wasn't my idea--something I found on google and it worked. To be honest, undoing it all now and trying to do it "the right way" is something I don't have time to do. Thanks for warning though. – BartmanEH Oct 01 '21 at 17:41
  • @BartmanEH: honored that `uvcc` is worth a full new toolchain installation! =) No worries, we've all been there. Permissions is a common issue for `npm` users, but my proposed solution is indeed best for "fresh" installations. (Also, keep an eye on the `uvcc` repository, I might release a much simple way in the near future.) – Joel Purra Oct 02 '21 at 18:16
  • The settings I set seem to be lost upon re-plugging the camera. What am I missing? – urover Nov 05 '21 at 00:41
  • 1
    @urover: that is expected. The camera doesn't "remember" anything, nor does the operating system. This is why `uvcc` has "presets", in the form of JSON files, which you can export/import (and thus automate as you wish). That said, remembering settings _could_ of course be implemented by the camera (in hardware), the operating system (which already has UVC drivers), or a (custom) system service (which runs at system start and continuously detects connected cameras). There are no current plans to make a service out of `uvcc` though. – Joel Purra Nov 05 '21 at 09:24
3

Doing some work with openCV too and went for the non technical implementation: some tape and black card, and simply covered the light sensor to the left of the camera.

Works perfectly!

The iGlasses solution doesn't address the problem as the brightness/contrast adjustments are performed by the hardware (i think) so it will affect the iGlasses input source and thus output. I imagine you can fiddle with settings to try and alleviate this effect as much as possible although will not combat it completely.

moonthug
  • 46
  • 1
2

Using uvc-ctrl & uvc-ctrl-GUI.app

  1. Prerequisite: install libusb using brew install libusb
  2. Download uvc-ctrl-v1.02a.zip from sluggo dm9
  3. Download uvc-ctrl-GUI from ppooll
  4. Copy uvc-ctrl-GUI.app into uvc-ctrl-v0.12b folder
  5. Launch uvc-ctrl-GUI.app

enter image description here

With my LifeCam HD-3000, the only thing I get worked was to disable auto_exposure..

enter image description here


UVC CAMERA CONTROL FOR MAC OS X (not working anymore but interesting to read)

Here is an interesting article about how to control camera settings: http://phoboslab.org/log/2009/07/uvc-camera-control-for-mac-os-x

I also built a simple demo application that makes use of the UVCCameraControl class. This demo uses QTKit to open a connection to the first (default) video device and simply displays the images in a QTCaptureView. There's no system setting to select the default video device, however the device you selected to use in iChat will be the default (you have to quit iChat after selecting your camera, otherwise it will be locked for all other applications).

Here is the download link: http://phoboslab.org/files/misc/camera-control.zip

Yves M.
  • 121
  • 4
2

You may want to try iGlasses. From the website:

Adjust and manipulate your webcam's video settings from within iChat and many other programs, including iMovie, Photo Booth, Yahoo! Messenger, Skype and web-based chat. Apply easy preset settings and fun effects to your video conferences and recordings.

Adjust colors, brightness, and even pan and zoom your Mac's built-in iSight. The picture from your iMac, MacBook or MacBook Pro has never looked so good.

Is your external iSight looking a bit dark? You could install studio lighting, or just install iGlasses to give your videos an instant brightness boost.

iGlasses is a great companion to your iMage USB Webcam. Fine tune your colors for a perfect picture every time.

It's not just for iSight! If you use a Logitech QuickCam or other 3rd-party webcam that uses UVC or the macam driver, iGlasses will add the same great adjustments and features.

iGlasses

fideli
  • 14,636
  • 2
  • 35
  • 44
  • 2
    thanks for the link, I did mention nothing commercial. Why should I pay for something that should be in the system preferences ? "iChat and many other programs, " - does that mean I can use this, disable the auto-adjustments and carry on playing with openCV ? – George Profenza Mar 12 '10 at 14:12
  • Sorry, not familiar with OpenCV. Maybe someone else can help you with a nerdy solution. – fideli Mar 12 '10 at 15:21
  • 2
    George, you may just be out of luck here. I looked long and hard for a similar solution, but found none. I had to resort to getting `iGlasses`. – ayaz May 20 '10 at 17:24
1

Maybe your best bet would be Macam. It didn't work for me, but they have active support and probably will add iSight to their list soon enough.

cregox
  • 5,804
  • 7
  • 49
  • 66
0

This currently appears to be impossible, unfortunately. iGlasses can lock the exposure, but this only works in programs it knows about, which rules out most computer vision applications (e.g. Max/MSP).

It's a real shame, as it limites the use of the camera for CV applications.

mo-seph
  • 283
  • 1
  • 2
  • 6
0

It may not help exactly, but Macam allows you to disable auto adjustment of gain and shutter (which is probably what you want) for many cameras. Using the svn version this work with the ps3eye (while the stock macam doesn't allow you to disable auto adjustment). Unfortunately, Macam doesn't support the iSight as far as I can tell.

(I'm adding this in case other people are also looking for a solution, who might not be bound to the iSight, and it's not obvious that using the SVN version helps)

http://webcam-osx.sourceforge.net/

mo-seph
  • 283
  • 1
  • 2
  • 6
0

Just wanted to add that I've managed to get control of this camera and Logitech c920 in c++ using openframeworks and ofxUVC which is a wrapper for the Linux UVC library

George Profenza
  • 820
  • 5
  • 20
  • 40
-1

It's not clear whether by "adjusting the light/focus" you're referring to the resulting movie or whether you're referring to the effect of the light sensor (next to the camera) dimming of the monitor/screen?

If it's the first then this seems strange - are you wanting to keep images under or over exposed? Someone else will need to help you on this... and it probably is either buy something commercial or include the phrase "open source" in your web search.

The second... you'll find in system preferences "Displays" and at the bottom there (easy to miss) a tick box labeled "Automatically adjust display brightness as ambient light changes". Un tick the box and you are master of the brightness of your screen.

Hope that's helpful.

-1

The Answer is Simple: just go to Display settings and uncheck "automatically adjust brightness as ambient changes.

mike
  • 9
  • 3
    Not that he'll ever see this, but that's the screen brightness. It doesn't have anything to do with the camera's auto-exposure. – Glenn Maynard Jan 13 '15 at 19:47