This discussion is archived
0 Replies Latest reply: Feb 6, 2013 9:46 PM by 881879 RSS

I can't draw over a webcam streaming, any help?

881879 Newbie
Currently Being Moderated
Hello, I'm using JMF to capture a webcam streaming, and being able to save a picture from it, it works, however, I want to draw a rectangle to just save that are of the webcam streaming, I have a JPanel with all the rectangle drawing, and it works by running it separately, I'm adding the JPanel into my JFrame containing the video, but it does not work there, I don't know what can I do, this is my code in my webcam capturing:

*public final void startCapture() throws IOException, NoPlayerException, CannotRealizeException{*

String deviceName = "vfw:Microsoft WDM Image Capture (Win32):0";

CaptureDeviceInfo di = CaptureDeviceManager.getDevice(deviceName);
MediaLocator ml = new MediaLocator(deviceName);

Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
player = Manager.createRealizedPlayer(ml);

player.start();
Component comp = player.getVisualComponent();

comp.setBounds(new Rectangle(10, 10, 100, 100));
add(comp);

//This is my JPanel class containing the rectangle drawing
JPanel glassPane = new NewJPanel();
glassPane.setBounds(new Rectangle(0, 0, 500, 500));

this.setGlassPane(glassPane);
glassPane.setVisible(true);
*}*

I would highly appreciate your help, thanks in advanced!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points