makenai / node-uvc-control

Control UVC compliant USB webcams from node
80 stars 28 forks source link

Logitech C270 manual exposure #62

Open Jip-Hop opened 4 years ago

Jip-Hop commented 4 years ago

Hi,

I downloaded the repository, ran npm install then node test/discover.js but there's no output. I'm testing the Logitech C270 on MacOS 10.14.6, with the goal of manually adjusting exposure for this webcam.

When I run npm run preview I can select the Logitech C270 webcam from the dropdown, it shows up as: USB Camera (046d:0825).

Most of the time, changing the sliders won't affect anything.

I get this error:

setting absolute_exposure_time [ '72' ]
{ Error: LIBUSB_ERROR_NO_DEVICE
    at Device.usb.Device.controlTransfer (~/Downloads/node-uvc-control-master/node_modules/usb/usb.js:136:12)
    at Promise (~/Downloads/node-uvc-control-master/index.js:227:19)
    at new Promise (<anonymous>)
    at UVCControl.set (~/Downloads/node-uvc-control-master/index.js:219:12)
    at app.post (~/Downloads/node-uvc-control-master/examples/server.js:43:7)
    at Layer.handle [as handle_request] (~/Downloads/node-uvc-control-master/node_modules/express/lib/router/layer.js:95:5)
    at next (~/Downloads/node-uvc-control-master/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (~/Downloads/node-uvc-control-master/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (~/Downloads/node-uvc-control-master/node_modules/express/lib/router/layer.js:95:5)
    at ~/Downloads/node-uvc-control-master/node_modules/express/lib/router/index.js:281:22 errno: -4 }

Turns out I need to wait for the webcam to show up in Chrome, before I run npm run preview. Then I don't get the above error.

By default, the value for "bAutoExposureMode" is set to "MANUAL". However, in reality this is auto exposure mode. When I set it to "AUTO", then it's still in an auto exposure mode, but now the image is exposed somewhat darker... There's also "PRIORITY_SHUTTER" and "PRIORITY_APERTURE". These are also auto exposure modes... None of these modes disable auto exposure and there's no way to get back to the initial default (brighter) auto exposure, unless I unplug the webcam. When I open the Logitech Camera Settings app and hit "Restore Defaults", the image becomes brighter again, but now auto exposure is actually disabled (which it isn't by default!).

Alternatively I can open CameraControl and uncheck "Auto Exposure", to enable manual exposure. This also allows me to re-enable auto exposure (this checkbox works perfectly fine! :) However, the "Exposure Time" slider in CameraControl doesn't work well. Most of the slider range doesn't change exposure. Some spots in the range make the image slightly darker. Moving the slider all the way to the right makes the image super dark, under-exposing so much everything becomes black except for lamps themselves.

Screenshot 2020-02-21 at 01 22 21

This is pretty cool and using the controls from the node-uvc-control web interface don't allow me to under expose this much. With gain and brightness all the way to the left I still see myself sitting in the room. So what does CameraControl do differently that it can under expose so much?

My issue is that exposure control for the C270 webcam doesn't work with node-uvc-control, but it should be possible because CameraControl can enable manual exposure control (and under expose even more). Would it be possible to support this model and what can I do to help?

joelpurra commented 4 years ago

See #60.

joelpurra commented 4 years ago

See #64.