LingDong- / PoseOSC

📹🤸‍♂️🤾‍♀️🤺 PoseNet + OSC: send realtime human pose estimation data to your apps
MIT License
77 stars 17 forks source link

camera resolution / ratio #5

Open stephanschulz opened 3 years ago

stephanschulz commented 3 years ago

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 ... :) ?

LingDong- commented 3 years ago

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!

stephanschulz commented 3 years ago

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

LingDong- commented 3 years ago

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

stephanschulz commented 3 years ago

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');
});
LingDong- commented 3 years ago

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