#1 2016-06-02 14:52:09

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

How to scale the captured image with an WebCam control

Hello David,
I have just tried the new Webcam control with Firefox and Opera but the taken picture doesn't respect the original image's proportions.

Is it just on my part (a problem with my webcam perhaps) ?

Many thanks

Last edited by svanneste (2016-06-02 15:39:39)

Offline

#2 2016-06-02 15:01:16

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to scale the captured image with an WebCam control

Hello Samuel,

No; it's not a problem with your webcam, Samuel, don't worry about that. The possible problem is we play with the video size in order to made the video capture. This information is only available at runtime, and the captured image size is the same than the video one. However, if we need to shown the captured image (not always needed) and we use for that an Image control (that's the way) then probably the image appear not well scaled, since the Image control sizes may is not the same than the video/captured image size.

If we maintain the application without scaling there the problem is reduced. However, I want to put available in runtime the video size (width and height) in a couple of new WebCam control variables. Then may we can use such information along the "SetStyle" action to set, if we wanted, the size of the Image control. I will inform here when this update are available Samuel.

If you need more help or have any further question, please, post it here.

P.S. Below we can see a capture of the WebCam sample application running here in my system, with a "Fake camera" program, just for another comparison.

7XKwOXK.png

Offline

#3 2016-06-02 15:39:04

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: How to scale the captured image with an WebCam control

Thanks a lot David, this makes sense. I am so used with other controls where the preview image provides the resulted one that I did not thought of this smile

Offline

#4 2016-06-02 15:53:30

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to scale the captured image with an WebCam control

Hello Samuel,

You're welcome. Honestly I am not an expert in the field, but we play here three different sizes:

1º The video size, who probably does not match the WebCam control size, but scaled

2º The captured video image, who have exactly the same dimensions than the video "says"

3º The Image control, who can shown the captured image, but not neccesary have the same size

I probably we need to think into the Image capture as a preview of the video capture. If I am not wrong, the Base64 representation of the captured image have the right size, that is, the video size, that is, independently of the Image control.

Again I want to say that, at least in some cases, having the real video size (the offered by the involved API) can be useful, so I want to put the appropiate "width" and "height" variables for the WebCam control. So we can use it if needed.

Offline

#5 2016-06-02 16:36:50

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to scale the captured image with an WebCam control

Hello Samuel,

You can upgrade your App Builder copy. Now the WebCam control have a new "Metadata" event and the "runtime" variables "VideoWidth" and "VideoHeight". I modify a bit the WebCam app sample so you can take a look if you wanted.

Offline

#6 2016-06-02 17:14:14

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: How to scale the captured image with an WebCam control

Hello David,
YES!  It is working very well now. Thanks a lot for that great improvement big_smile

Offline

#7 2016-06-02 17:14:51

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to scale the captured image with an WebCam control

You're welcome Samuel!

Offline

#8 2016-09-10 09:49:27

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to scale the captured image with an WebCam control

Hello Samuel,

Certainly using the video measures information/variables provided by App Builder (in the WebCam's control's Metadata event, but not necessary using that event, we can scale the WebCam captured image. I add a kind of "scale" app's function in the "WebCam" app sample, so maybe you want to take a look. wink

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.