LingDong-/PoseOSC

camera resolution / ratio

stephanschulz opened this issue · 5 comments

Hi.

I love the poseOSC complied app. Works like a charm.
It seems my c920 Logitech gets initialed at 640x480 resolution. Is there a way to make it init with a different res like 1280x720 without having to compile the electron app in to a binary? Maybe a json setting file ... :) ?

Hi Stephan,

I think poseOSC just uses the default resolution, but it can be changed on line:
https://github.com/LingDong-/PoseOSC/blob/master/app.js#L75
using parameters from
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
In the compiled electron app, the source is still available and can be changed in Contents/Resources/app/app.js
But I agree having it in the json setting is convenient. Will add the feature!

so I can just add code to Contents/Resources/app/app.js and the already compiled binary will automatically use those changes?

yup, it's not really compiled, just "wrapped" :)

it works indeed.

var media_constraints = {
    audio: false,
    video: {
        width: { min: 640, ideal: 1280, max: 1920 },
        height: { min: 480, ideal: 720, max: 1080 },
    }
};

navigator.mediaDevices.getUserMedia(media_constraints)
  .then(function(stream) {
    camera.srcObject = stream;
  }).catch(function() {
    alert('could not connect stream');
});

Hi @stephanschulz, just BTW these properties are now tweak-able in the new release from settings.json. https://github.com/LingDong-/PoseOSC/releases/tag/0.0.3

It's just a little bit neater than changing app.js :)

image