Showing webcam preview in picturebox Problem....
-
i need to show a preview of my webcam in a picture box when i connected to the webcam. im using WIA. how can i show preview of my webcam in a picturebox. here is my code to connect to webcam...
private void btnDecode_Click_1(object sender, EventArgs e)
{
try
{
Cursor.Current = Cursors.WaitCursor;
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
i++;
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;imagefile.SaveFile("d:\\\\" + i + ".jpg"); Bitmap image = new Bitmap("d:\\\\" + i + ".jpg"); Bitmap bm = new Bitmap(image, 200, 150); Gray(bm);
-
i need to show a preview of my webcam in a picture box when i connected to the webcam. im using WIA. how can i show preview of my webcam in a picturebox. here is my code to connect to webcam...
private void btnDecode_Click_1(object sender, EventArgs e)
{
try
{
Cursor.Current = Cursors.WaitCursor;
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
i++;
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;imagefile.SaveFile("d:\\\\" + i + ".jpg"); Bitmap image = new Bitmap("d:\\\\" + i + ".jpg"); Bitmap bm = new Bitmap(image, 200, 150); Gray(bm);
Well, what does it do, and not do ? I know how to do this, but not with WIA, so you'll need to tell us what's going wrong.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
Well, what does it do, and not do ? I know how to do this, but not with WIA, so you'll need to tell us what's going wrong.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
as my code show previous i take a picture of a QR barcode using my webcam. so i need to show a preview of my webcam befor take the picture of barcode. bcz that will be easy to user to show the barcode properly to the webcam. so i can get perfect image to process. that is the purpose.
A S E L A
-
as my code show previous i take a picture of a QR barcode using my webcam. so i need to show a preview of my webcam befor take the picture of barcode. bcz that will be easy to user to show the barcode properly to the webcam. so i can get perfect image to process. that is the purpose.
A S E L A
So, wait, all this code works, but you can't work out how to set the properties of a picturebox to show the image ? I thought this was a web app ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
So, wait, all this code works, but you can't work out how to set the properties of a picturebox to show the image ? I thought this was a web app ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
yaa untill now every thing work fine. can take image and as you told me earlierday doing image processing and filtering and convert to gray scale and adjust brightness and contrast. after process can deocde barcode to. some times got few errors. but now only problem is i have to take few images untill i get the fine image. bcz its very dificult to show QR properly without a preview of webcam. my plane to user a another picturebox to show the preview of webcam. sorry i forgot to tell you. this is not web app...just a windows app...
A S E L A
-
yaa untill now every thing work fine. can take image and as you told me earlierday doing image processing and filtering and convert to gray scale and adjust brightness and contrast. after process can deocde barcode to. some times got few errors. but now only problem is i have to take few images untill i get the fine image. bcz its very dificult to show QR properly without a preview of webcam. my plane to user a another picturebox to show the preview of webcam. sorry i forgot to tell you. this is not web app...just a windows app...
A S E L A
So, you have a picturebox, it has a property, called source or image. I forget which. Set it to point to your bitmap.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
So, you have a picturebox, it has a property, called source or image. I forget which. Set it to point to your bitmap.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
what ? A picturebox shows pictures, and it does it in a pretty standard way. If you want to show video, then you need a timer to update the picture. A picturebox plainly is not a video control.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp