Click here to Skip to main content
15,919,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..

C#
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;



        }


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.
Posted
Updated 9-Feb-16 21:56pm
v2
Comments
Sergey Alexandrovich Kryukov 10-Feb-16 4:04am    
What would you expect? Do you want the interface to tell you the front from the rare? But the OS does not have such concept. Some Web/USB cameras will be neither front nor rare...
I would suggest some workaround.
—SA
Surendra Kandira 10-Feb-16 4:10am    
I will expect to give me any solution and way to find front and rear camera in winforms (in window tablets).
Sergey Alexandrovich Kryukov 10-Feb-16 4:17am    
I gave you some idea in Solution 1. Hope you get it.
—SA
Philippe Mori 12-Feb-16 22:35pm    
Try to make best guess and let the user select another one if you guess it wrong.

1 solution

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's T-shirt reads on the back:
If you can read this, the bitch fell off
The actual design is on you. :-)

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900