本文介绍了如何在winforms c#中检测窗口平板电脑中的前后摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在winforms中使用aforge进行视频录制。我想在窗口平板电脑上录制视频(前置和后置摄像头)。我能够找到视频捕获设备的列表,但不能识别哪个是前置或后置摄像头。 我已经看到了我发现的视频捕获设备代码片段。 我使用的名称空间和部分代码.. I'm using aforge in winforms for video recording. I wanna to record video both (front and back camera) in window tablet. I have able to find list of Video Capture Device but not identify which is front or rear camera.I have sawed you my finding video capture device snippet of code.Name space whose i use and some part of code..using AForge.Video;using AForge.Video.DirectShow; public VideoCaptureDevice cam = null; public FilterInfoCollection usbCams; usbCams = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (usbCams.Count == 1) { cam = new VideoCaptureDevice(usbCams[0].MonikerString); } else if (usbCams.Count == 2) { cam = new VideoCaptureDevice(usbCams[1].MonikerString); }cam.NewFrame += new NewFrameEventHandler(cam_NewFrame); cam.Start();private void cam_NewFrame(object sender, NewFrameEventArgs eventArgs) { Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone(); ImgContainer.Image = bitmap; } 我已经在iball和lenovo等不同设备上测试过瑜伽8.我发现一个原因是在Iball平板电脑中返回第一个前置摄像头名称和第二个后置摄像头但在联想平板电脑中返回第一个后置摄像头和第二个前置摄像头。我完全糊涂了。如何识别前后摄像头? 我尝试过: 我已经尝试了上面的代码,但没有成功找到前后摄像头。I have tested in different devices like iball and lenovo yoga 8. I have found one reason is that in Iball tablet return first front camera name and second rear camera but in lenovo tablet return first rear camera and second front camera. I have total confused. How to identify front and rear camera ?What I have tried:I have tried above code but not success to find front and rear camera.推荐答案 请参阅我对这个问题的评论我在哪里解释为什么这些信息可能不是可用,但原因很简单:没有这样的概念。 我有一个不同的想法:如果你的应用程序是交互式的,并显示一些窗口,你可以解决适当的网页设计的问题。这个想法很简单;我希望你能通过以下提示得到它: Please see my comment to the question where I explain why such information is probably not available, but a simple reason: there is no such concept.I have a different idea: if your application is interactive and show some window, you can work around the problem by proper Web design. The idea is fairly simple; I hope you can get it by the following hint: Biker的T恤背面读着:Biker's T-shirt reads on the back:如果你能看到这个,那个婊子掉了If you can read this, the bitch fell off实际的设计就在你身上。 :-) -SA The actual design is on you. :-)—SA 这篇关于如何在winforms c#中检测窗口平板电脑中的前后摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 23:31