bonjour , j'ai une interface qui contient plusieurs JInternalFrame , actuellement , je travail sur 2 JInternalFrame, tout ce que je veux c'est d'importer le flux capturé de caméra (cam intégré + cam USB) dans ces deux JInternalFrame , mais le probléme il m'affiche qu'une seul cam (soit cam USB ,soit cam intégré)

voilà le code que j'ai écrit :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
 
JDesktopPane dp2 = new JDesktopPane();
 
        this.setContentPane(dp2);
 
        //
 
// Caméra 1
 
        JInternalFrame cam2 = new JInternalFrame("CAM1", false, true, false, false);
 
        cam2.setVisible(true); // pour rendre la fenêtre visible
 
        cam2.setBounds(0, 0, 620, 633);
 
        //   cam2.add(new test_camera());
 
//iFrame.add(capture(panel));
 
        dp2.add(cam2, capture(cam2));
 
// Caméra 2
 
        JInternalFrame cam3 = new JInternalFrame("CAM2", false, true, false, false);
 
        cam3.setVisible(true); // pour rendre la fenêtre visible
 
        cam3.setBounds(620, 0, 620, 633);
 
        // cam3.add(new test_camera());
 
        dp2.add(cam3, capture_USB(cam3));
capture , capture_USB sont deux méthodes qui se trouve dans le méme classe que ces JInternalFrame

voilà leur code

capture :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public JInternalFrame capture(JInternalFrame f) {
        String str1 = "vfw://0";
        CaptureDeviceInfo di = CaptureDeviceManager.getDevice("vfw://0");
        CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo();
        //now we are extracting the medialoctor of this device
        MediaLocator webcamMediaLocator = webcamInfooo.getLocator();
        Player player,player1;
        try {
            // now we are creating the player but this time using the medialocator of the cam
            player = Manager.createRealizedPlayer(webcamMediaLocator);//Creating Player
                   Component comp;//for Getting Visual Player Component of Camera
            if ((comp = player.getVisualComponent()) != null) {
                f.setLayout(new BorderLayout());
                f.add(comp, BorderLayout.CENTER);
                f.add(player.getControlPanelComponent(), BorderLayout.SOUTH);
 
 
                f.setVisible(true);
                player.start();
            }
        } catch (Exception x) {
            x.printStackTrace();
        }
        return (f);
    }
capture USB

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public JInternalFrame capture_USB(JInternalFrame f) {
        String str1 = "vfw:Microsoft WDM Image Capture (Win64):0";
        CaptureDeviceInfo di = CaptureDeviceManager.getDevice(str1);
        CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator(str1), null);
        //now we are extracting the medialoctor of this device
        MediaLocator webcamMediaLocator = webcamInfooo.getLocator();//MediaLocator for Camera
        Player player = null;
        try {
            // now we are creating the player but this time using the medialocator of the cam
            player = Manager.createRealizedPlayer(webcamMediaLocator);
            Component comp;
            if ((comp = player.getVisualComponent()) != null) {
                f.setLayout(new BorderLayout());
                f.add(comp, BorderLayout.CENTER);
                f.add(player.getControlPanelComponent(), BorderLayout.SOUTH);
 
 
                f.setVisible(true);
                player.start();
            }
        } catch (Exception x) {
            x.printStackTrace();
        }
        return (f);
    }
je veux afficher ces deux cam en méme temps dans des JInternalFrame différent .....est ce qu'il y a quelqu'un qui peut m'aider !!!