Go to Post Read the manual! - Trent B [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-10-2014, 14:15
dawonn's Avatar
dawonn dawonn is offline
Mentor
AKA: Dereck
FRC #2586 (Calumet Copperbots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Auburn Hills, Mi
Posts: 53
dawonn is an unknown quantity at this point
Angry Java, OpenCV, & an Axis Camera

I grabbed the latest copy of the JDK, OpenCV, and Eclipse and I want to simply read in the live video stream from an Axis M1013 camera and display it.

I've spent a few hours at it and found plenty of other posts with code they used to connect to the camera but it appears to be no luck for me.

Here's what I have:
Code:
import org.opencv.core.Core;
import org.opencv.highgui.VideoCapture;

public class HelloCV {

    public static void main(String[] args) {
        System.out.println("Welcome to OpenCV " + Core.VERSION);
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        
        VideoCapture capture = new VideoCapture();
        capture.open("http://10.25.86.11/mjpg/video.mjpg");

        if (capture.isOpened()) 
            System.out.println("Video link open.");
        else 
            System.out.println("Video link not open.");    
    }

}
But the connection never opens, here's the output:
Code:
Welcome to OpenCV 2.4.10.0
Video link not open.

I can use that url in VLC to view the live stream, so I am of the belief that the camera is correctly configured and the network is properly set up. Suggestions greatly appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-10-2014, 16:52
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Java, OpenCV, & an Axis Camera

Try waiting a few seconds between calling capture.open(); and checking to see if it's open. This sort of process can take a few seconds to finish up.
Reply With Quote
  #3   Spotlight this post!  
Unread 14-10-2014, 16:54
dawonn's Avatar
dawonn dawonn is offline
Mentor
AKA: Dereck
FRC #2586 (Calumet Copperbots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Auburn Hills, Mi
Posts: 53
dawonn is an unknown quantity at this point
Unhappy Re: Java, OpenCV, & an Axis Camera

I polled the isOpened() command for a while, and added a delay after the open, same result.

The open() command returns false, is that normal?

I also set up a test in python, with the same results.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-10-2014, 17:48
dawonn's Avatar
dawonn dawonn is offline
Mentor
AKA: Dereck
FRC #2586 (Calumet Copperbots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Auburn Hills, Mi
Posts: 53
dawonn is an unknown quantity at this point
Red face Re: Java, OpenCV, & an Axis Camera

As an update, I found this chunk of code, and it showed the video feed:
http://www.chiefdelphi.com/forums/sh...96&postcount=3

Although that snippet is in python, that's one step closer to solving the mystery here. I still want to know how to use the opencv VideoCapture class so that I can program in Java, suggestions very much appreciated.
Reply With Quote
  #5   Spotlight this post!  
Unread 14-10-2014, 18:09
dawonn's Avatar
dawonn dawonn is offline
Mentor
AKA: Dereck
FRC #2586 (Calumet Copperbots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Auburn Hills, Mi
Posts: 53
dawonn is an unknown quantity at this point
Smile Re: Java, OpenCV, & an Axis Camera

The solution for python was on:
https://stackoverflow.com/questions/...11998#24211998

But I still need a java solution.... Any help would be appreciated.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-10-2014, 09:31
dawonn's Avatar
dawonn dawonn is offline
Mentor
AKA: Dereck
FRC #2586 (Calumet Copperbots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Auburn Hills, Mi
Posts: 53
dawonn is an unknown quantity at this point
Talking Re: Java, OpenCV, & an Axis Camera

I finally have it working in Java and python. I simply copied opencv/sources/3rdparty/ffmgeg/opencv_ffmpeg_64.dll to c:\windows\system32\opencv_ffmpeg2410_64.dll
and ran the java application and it worked as expected~!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi