node-v4l2camera icon indicating copy to clipboard operation
node-v4l2camera copied to clipboard

missing controls?

Open smremde opened this issue 7 years ago • 9 comments

node-v4l2camera: 1.0.4 v4l2: 1.6.0-2 distro rasbian (arm6 Bus 001 Device 005: ID 045e:0772 Microsoft Corp. LifeCam Studio

$ v4l2-ctl  -l
                     brightness (int)    : min=30 max=255 step=1 default=-8193 value=102
                       contrast (int)    : min=0 max=10 step=1 default=57343 value=5
                     saturation (int)    : min=0 max=200 step=1 default=57343 value=103
 white_balance_temperature_auto (bool)   : default=1 value=1
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2500 max=10000 step=1 default=57343 value=4500 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=57343 value=25
         backlight_compensation (int)    : min=0 max=10 step=1 default=57343 value=0
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=1 max=10000 step=1 default=156 value=156 flags=inactive
                   pan_absolute (int)    : min=-529200 max=529200 step=3600 default=0 value=0
                  tilt_absolute (int)    : min=-432000 max=432000 step=3600 default=0 value=0
                 focus_absolute (int)    : min=0 max=40 step=1 default=57343 value=18
                     focus_auto (bool)   : default=1 value=0
                  zoom_absolute (int)    : min=0 max=317 step=1 default=57343 value=0
                     brightness (int)    : min=30 max=255 step=1 default=-8193 value=102
                       contrast (int)    : min=0 max=10 step=1 default=57343 value=5
                     saturation (int)    : min=0 max=200 step=1 default=57343 value=103
 white_balance_temperature_auto (bool)   : default=1 value=1
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2500 max=10000 step=1 default=57343 value=4500 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=57343 value=25
         backlight_compensation (int)    : min=0 max=10 step=1 default=57343 value=0

But when i use node-v4l2camera, I only see the first seven...

[
  {
    "id": 9963776,
    "name": "Brightness",
    "type": "int",
    "min": 30,
    "max": 255,
    "step": 1,
    "default": -8193,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963777,
    "name": "Contrast",
    "type": "int",
    "min": 0,
    "max": 10,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963778,
    "name": "Saturation",
    "type": "int",
    "min": 0,
    "max": 200,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963788,
    "name": "White Balance Temperature, Auto",
    "type": "bool",
    "min": 0,
    "max": 1,
    "step": 1,
    "default": 1,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963800,
    "name": "Power Line Frequency",
    "type": "menu",
    "min": 0,
    "max": 2,
    "step": 1,
    "default": 2,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": [
      "Disabled",
      "50 Hz",
      "60 Hz"
    ]
  },
  {
    "id": 9963802,
    "name": "White Balance Temperature",
    "type": "int",
    "min": 2500,
    "max": 10000,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": true,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963803,
    "name": "Sharpness",
    "type": "int",
    "min": 0,
    "max": 50,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963804,
    "name": "Backlight Compensation",
    "type": "int",
    "min": 0,
    "max": 10,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  }
]

smremde avatar Oct 18 '16 19:10 smremde

Your camera is using the v4l2 extended api, i'm currently working on a patch :)

iglosiggio avatar Oct 18 '16 19:10 iglosiggio

Awesome - thanks.

smremde avatar Oct 18 '16 19:10 smremde

Try using https://github.com/iglosiggio/node-v4l2camera/ y wrote the patch half an hour ago but i think it'll work.

npm install iglosiggio/node-v4l2camera

iglosiggio avatar Oct 18 '16 19:10 iglosiggio

This seems to work! I haven't tested fully, but the controls now appear and I can get/set them. I won't have time till this evening to test if that are actually changing (but you might know if getting/setting is enough to prove this works.)

Warning during build:

make: Entering directory '/home/pi/LaserPI/node_modules/v4l2camera/build'
  CC(target) Release/obj.target/v4l2camera/capture.o
../capture.c: In function ‘camera_controls_menus’:
../capture.c:468:13: warning: passing argument 1 of ‘error’ discards ‘const’ qualifier from pointer target type
       error(camera, "VIDIOC_QUERYMENU");
             ^
../capture.c:28:13: note: expected ‘struct camera_t *’ but argument is of type ‘const struct camera_t *’
 static bool error(camera_t* camera, const char * msg)
             ^
  CXX(target) Release/obj.target/v4l2camera/v4l2camera.o
  SOLINK_MODULE(target) Release/obj.target/v4l2camera.node
  COPY Release/v4l2camera.node
make: Leaving directory '/home/pi/LaserPI/node_modules/v4l2camera/build'

smremde avatar Oct 19 '16 07:10 smremde

Repaired, now compiles cleanly! :dancer:

iglosiggio avatar Oct 19 '16 14:10 iglosiggio

This works perfectly.

smremde avatar Oct 21 '16 19:10 smremde

If you need to always have an RGB or YUV format you can try with this branch https://github.com/iglosiggio/node-v4l2camera/tree/libv4l2 (requires libv4l which emulates the other outputs)

iglosiggio avatar Oct 24 '16 12:10 iglosiggio

Is there any reason you don't make a pull request for your extended API patch?

JeffJassky avatar Dec 03 '19 05:12 JeffJassky

Is there any reason you don't make a pull request for your extended API patch?

I did a PR a few years ago. I'm not currently using the library and iirc modern node extensions do not use NAN. I'm not sure if my fork compiles against a modern node.

iglosiggio avatar Dec 03 '19 17:12 iglosiggio