Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: JFM Registry error

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JFM Registry error

    Hi all,
    I've just installed JMF and i wanted to add a device(a webcam) so i could use it in my app,because if I don't add it I cannot use it as a data source.
    After the installation i opened JMF Registry and tryed to click the "add" button in "capture devices" and it keeps sending my error "could not add item".
    What should I do?(I've tried to click add in other tabs but it keeps sending me that error).
    Thanks


  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JFM Registry error

    Hi again,
    Recently i've been succesful in capturing the camera with jmf studio and see myself.
    but when i try to capture the device with java code it doest allow me, it shows that there are no devices.
    But I am able to catch the device with my jmf studio.
    what should i do?

  3. #3
    Junior Member
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JFM Registry error

    Hi again
    My jmf studio is recognizing my web cam but I use this code: CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
    if(deviceInfo==null)
    {
    System.out.println("null");
    }
    else
    System.out.println(deviceInfo.getName());

    and i allways get null.
    why?

  4. #4
    Junior Member
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JFM Registry error

    Hi i wanted to post my code that i am using so you can see what is the problem
    public static void main(String[] args) throws Exception
    {
    // Create capture device
    CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
    Player player = Manager.createRealizedPlayer(deviceInfo.getLocator ());
    player.start();

    // Wait a few seconds for camera to initialise (otherwise img==null)
    Thread.sleep(2500);
    //
    // // Grab a frame from the capture device
    FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.med ia.control.FrameGrabbingControl");
    Buffer buf = frameGrabber.grabFrame();

    // Convert frame to an buffered image so it can be processed and saved
    Image img = (new BufferToImage((VideoFormat)buf.getFormat()).create Image(buf));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    g.drawImage(img, null, null);

    // Overlay curent time on image
    g.setColor(Color.RED);
    g.setFont(new Font("Verdana", Font.BOLD, 16));
    g.drawString((new Date()).toString(), 10, 25);

    // Save image to disk as PNG
    ImageIO.write(buffImg, "png", new File("c:\\webcam.png"));

    // Stop usin webcam
    player.close();
    player.deallocate();
    System.exit(0);

    CaptureDeviceInfo device = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
    if(device==null)
    {
    System.out.println("no device");
    }
    else
    System.out.println("device exists");


    Ignore the "//". when i am trying it it says "Exception in thread "main" java.lang.NullPointerException
    at capture.main(capture.java:25)"
    its like it doesnt know the device exists even though i can use it through the JMF studio.
    what should i do?

  5. #5
    Junior Member
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JFM Registry error

    ignore the "ignore //"