Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Visual Basic C# webcam

Status
Not open for further replies.

adrianvon

Member
Hi all,

I found the tutorial in the link below which helped me interface a webcam with Visual Studio:

http://www.youtube.com/watch?v=CaYQLq72ZN4

The coding was download from this link: **broken link removed**

Now my problem is to resize the webcam video box to make it fit in a picturebox. Can someone help me whit that please??

Thanks in advance.
 
I remember seeing a good tutorial on codeproject.. Not sure if it is this one: https://www.codeproject.com/Articles/285964/WPF-Webcam-Control
Anyway I hope that you can find what you are looking for if you look at the source code of that project. It is not easy to interface "low-level" drivers through C#..
 
Have you set the picturebox background image layout mode to Stretch, like in the example? If the library is simply setting the BackgroundImage, then you should be able to simply resize the picturebox to change the display size. If this doesn't work and the library is paint directly to the screen, then you may need to reinitialise the library when you resize (which would be very annoying), or retrieve the frame buffer every frame and paint the picturebox yourself (or assign the buffer image to the backgroundImage of the picturebox yourself)
 
So, this is not about resizing captured image/video, but about how to resize GUI control/container?
 
So, this is not about resizing captured image/video, but about how to resize GUI control/container?
I believe he wants to change how the image is displayed in the picturebox. The control can be set up to automatically scale the image on display, regardless of the size of the actual image displayed.
 
I believe he wants to change how the image is displayed in the picturebox. The control can be set up to automatically scale the image on display, regardless of the size of the actual image displayed.

Yeah.. I don't have time to go through all the documentation, but I think there are all kinds of options. Maybe the "PictureBos.SizeMode" provides some good options.. I don't know how it works with the webcam-library the OP is using.. need more info what exactly is the problem.
https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.aspx
 
Hi,

Thanks for the replies. I did set the picturebox background image layout mode to Stretch but it did not work.
 
Hi,

Thanks for the replies. I did set the picturebox background image layout mode to Stretch but it did not work.

What exactly is the problem you are having.. what are you trying to do? Are you trying to resize the webcam feed?
 
I just watched the video you posted (in the first post) and even that tutorial could not show that the thing works.. "Just copy-paste these settings and it should work, but it is not working at my computer right now.. enjoy". Is this kind of education common in India?
 
Last edited:
Thanks for the replies. I did set the picturebox background image layout mode to Stretch but it did not work.
In form1, set the SizeMode to StretchImage to make it fill the whole picturebox or specify SizeMode of Zoom to resize it while maintaining aspect ratio. It works with the WebCam library.
 
In form1, set the SizeMode to StretchImage to make it fill the whole picturebox or specify SizeMode of Zoom to resize it while maintaining aspect ratio. It works with the WebCam library.

Finally that worked :) Thanks all for your help.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top