Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By gimbal2

Thread: Javacv :: MPEG_2 video to iplimage

  1. #1
    AhmedFathi is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Javacv :: MPEG_2 video to iplimage

    0 down vote favorite


    I'm using a Tv camera ,and a TV_TO_USB device to get video on my labtop

    I want video to be used in a javacv program

    due to some problems , I couldn't get the video instantaneously to the program (Although it worked for the internal and external webcams) , computer crashes with a blue screen

    so I tried to begin recording and saving video using the software that came with the USB , which does work , and then , while recording , taking the recorded video into my javacv program

    it worked , but after some seconds , it stops and shows the following error

    "

    OpenCV Error: Assertion failed (src.type() == dst.type()) in cvResize, file ..\..\..\..\opencv\modules\imgproc\src\imgwarp.cpp , line 3927
    Exception in thread "main" java.lang.RuntimeException: ..\..\..\..\opencv\modules\imgproc\src\imgwarp.cpp :3927: error: (-215) src.type() == dst.type() in function cvResize

    at com.googlecode.javacv.cpp.opencv_imgproc.cvResize( Native Method)
    at com.googlecode.javacv.cpp.opencv_imgproc.cvResize( opencv_imgproc.java:736)
    at returnToWork.ReturnToWork.main(ReturnToWork.java:1 74)


    VIDEOINPUT SPY MODE

    SETUP: Looking For Capture Devices
    SETUP: 0) CyberLink Webcam Splitter
    SETUP: 1) HP Webcam-50
    SETUP: 2) USB TV Device
    SETUP: 3 Device(s) found

    [mpeg2video @ 0000000000238400] ac-tex damaged at 1 4
    [mpeg2video @ 0000000000238400] Warning MVs not available


    "

    The code is :-

    "

    public static void main(String[] args) throws Exception {


    IplImage img ;

    CvCapture capture3 = cvCreateFileCapture("02_13_17_05_10.mpeg");
    final Vector v = new Vector<>() ;
    Image i ;
    ImageIcon ic;
    JPA j1 ;
    if(!capture3.isNull())
    {
    img = cvQueryFrame(capture3);
    i = img.getBufferedImage();
    ic= new ImageIcon(i);
    j1 = new JPA(ic ,933,700);
    JFrame jf = new JFrame();
    jf.setTitle("HE");
    jf.setSize(j1.getWidth(), j1.getHeight());
    jf.setVisible(true);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    jf.addMouseListener(new ForMouse());

    for(;;)
    {

    img = cvQueryFrame(capture3);


    IplImage image = IplImage.create(933, 700, 8, 3);
    //resize the image
    cvResize(img,image);
    i = image.getBufferedImage();
    ic= new ImageIcon(i);

    j1.jl.setIcon(ic);
    j1.add(j1.jl);
    jf.add(j1);
    jf.validate();




    char c = (char) cvWaitKey(15);

    if (c=='q')break;

    }
    }
    }
    }


    "

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Javacv :: MPEG_2 video to iplimage

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    AhmedFathi is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Re: Javacv :: MPEG_2 video to iplimage

    yes , 6 days ago , nobody helped

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Javacv :: MPEG_2 video to iplimage

    Kevin forgets to mention WHY he's posting that link: its just a service you yourself should provide; post links to your crossposts so people can follow it and see what has already been answered.

    In any case you're not going to get an answer in generic programming forums, you'll have to see if you can get help from the actual developers of this tech. It looks like a crash in native code of that opencv package.
    KevinWorkman likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    AhmedFathi is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Re: Javacv :: MPEG_2 video to iplimage

    Well sorry then

    I found the problem and it is solved .. the problem was that " cvWaitKey(milliseconds) function Didn't work ( may be it works only for cvnamedwindow) , so the frame rate of my program was larger ( Video faster ) than the video recorded by the camera .. the problem was solved when I used Thread.sleep(30); instead
    Last edited by AhmedFathi; 02-19-2014 at 07:44 PM.

Similar Threads

  1. JavaCV and windows librraries
    By heatblazer in forum Advanced Java
    Replies: 0
    Last Post: 12-13-2013, 07:29 PM
  2. Replies: 3
    Last Post: 11-02-2013, 02:36 PM
  3. making packets of video and then video of packets
    By Sardar Najam in forum Networking
    Replies: 0
    Last Post: 03-05-2013, 11:43 PM
  4. How to add a video?
    By hades7 in forum New To Java
    Replies: 2
    Last Post: 02-25-2012, 02:44 PM
  5. Video using JMF
    By morris4019 in forum AWT / Swing
    Replies: 0
    Last Post: 03-30-2011, 07:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •