justadudewhohacks / justadudewhohacks/opencv4nodejs

Can't set specific width and height on capture

Open
#444 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

Hi,

I can't manage to set width and height for capture. Here's my code:
```
cap = new cv.VideoCapture(options.videoDeviceId);

console.log(cap.get(cv.CAP_PROP_FRAME_WIDTH));
console.log(cap.get(cv.CAP_PROP_FRAME_HEIGHT));

# Apply new camera size
cap.set(cv.CAP_PROP_FRAME_WIDTH, 1280);
cap.set(cv.CAP_PROP_FRAME_HEIGHT, 720);

console.log(cap.get(cv.CAP_PROP_FRAME_WIDTH));
console.log(cap.get(cv.CAP_PROP_FRAME_HEIGHT));
```
Which gives me the following output:

```
640
480
640
480
```

Am I doing something wrong ?

PS: Normally, my webcam should support the resolution 1280x720:
```
lsusb -s 001:003 -v | egrep "Width|Height"
Couldn't open device, some information will be missing
wWidth 640
wHeight 360
wWidth 640
wHeight 480
wWidth 176
wHeight 144
wWidth 320
wHeight 240
wWidth 352
wHeight 288
wWidth 1280
wHeight 720
wWidth 640
wHeight 360
wWidth 640
wHeight 480
wWidth 176
wHeight 144
wWidth 320
wHeight 240
wWidth 352
wHeight 288
```

EDIT: I initially put a Coffeescript snippet, I changed it to Javascript.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.