|
-
Jun 13th, 2017, 07:53 AM
#1
Thread Starter
Junior Member
Can't access TABLET webcam(s) through code. PLEASE HELP!!
Hello everyone! I am again begging some help from the experts.
I am writing an application that captures an image from the back-facing webcam of a tablet, while the user is entering data. The problem is that I cannot access either of the webcams of the tablet through code. Thus far I have tried three different models of new dell tablets, all running Windows 10, and it simply doesn't work.
If I run the application on a desktop computer with an attached webcam, the webcam video shows up perfectly within the picturebox control, a frame is successfully grabbed and saved, etc. However, when I put the software on a tablet, it is almost as if it cannot talk to the integrated webcams. If I plug in an external webcam to the USB port on the tablet, it works! It just will not work with the integrated webcams.
The behavior is very specific. There are two webcams, one front-facing, one back-facing. If you run the program on a tablet, when the code initiates the webcam stream Microsoft's little "video source selector" dialog box pops up which asks which webcam you want to use. Once you pick one and either hit apply or OK, the box goes away and nothing appears within the picturebox - it's just empty. In a couple seconds the "video source selector" dialog box pops up again, and it's a repetitive cycle. If I disable one of the two webcams through device manager, the assumption is the ONLY available webcam would be used. Unfortunately, the "video source selector" dialog still pops up, and as expected only has the one remaining webcam listed as available. Still, however, no video appears.
I have tried several libraries, but settled on two for testing. First, the WebCam_Capture.dll library, and second, the DirectShowLib-2005.dll library. I do not like the DirectShow library - the video quality is very poor compared to the WebCam_Capture library. I have an HD webcam that is on my computer, and DirectShow only has options up to 640x480. WebCam_Capture shows full HD (which I need). Regardless of library selection, the issue lies deeper I fear. Everything works fine on a desktop - and then the video fails on the tablets.
As a test I have done extensive Google searching for VB.net example programs that make use of webcams (ANYTHING that uses a webcam for any purpose). I have found about 5 full program samples online, complete with libraries, solution, etc., and I have compiled them on my desktop. They all work fine with the USB webcam. I then move them to the tablets, and all have failed with only the integrated webcam(s) available. I have tried compiling them through Visual Studio 2013 (installed on the tablets) and the video fails, and I have tried simply moving the compiled executable over to the tablets, and that fails as well. I plug the USB webcam into the tablet, and the video works fine. For whatever reason, there is something different about the integrated webcams, and I desperately need some help figuring this out. Please!!
I have stripped down some test code to what is shown below - absolutely nothing out of the ordinary or strange. This code is found within my much larger program, and there are some additional features and tasks performed. This minimal code, however, should simply show the webcam video in picturebox1 on a form. As mentioned, it works fine on a desktop computer with a USB webcam, but fails on a tablet. I am using this fragment of code (and the respective dll library) for all of my testing until I can figure out what is up with the tablets.
Can anyone point me in a direction to help identify what is going wrong with the tablet webcams? Just to clarify, people may suggest other libraries, etc., but I have tried about 5 libraries in total for webcam processing, and the two that worked "best" in the desktop environment are the two listed at the top of this post - for my application the WebCam_Capture library fuctions far better than the rest. However, NONE of them worked on a tablet. I feel there is a deeper problem here than what library is used but having never worked with video processing in VB.net, I don't have any answers.
Thank you in advance to anyone who can assist!!!
Code:
Option Explicit On
Imports WebCam_Capture
Public Class Form1
WithEvents MyWebcam As WebCamCapture
Private Sub MyWebcam_ImageCaptured(source As Object, e As WebcamEventArgs) Handles MyWebcam.ImageCaptured
PictureBox1.Image = e.WebCamImage
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized 'Runs in a maximized window
StartWebcam()
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
'Stop button to stop webcam and return to previous form
StopWebcam()
Form3.Show()
Me.Close()
End Sub
Private Sub StartWebcam()
Try
StopWebcam()
MyWebcam = New WebCamCapture
MyWebcam.Start(0)
Catch ex As Exception
End Try
End Sub
Private Sub StopWebcam()
Try
MyWebcam.Stop()
MyWebcam.Dispose()
Catch ex As Exception
End Try
End Sub
End Class
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|