Ask Your Question

Kristian's profile - activity

2016-06-15 02:17:54 -0600 commented answer Only a few video codecs

} } } } }

private void initComponents() {
    if (cameraID != 42) {
        camSource = new VideoCapture(cameraID);
    } else {
        camSource = new VideoCapture(cameraIP);
    }
    if (!camSource.isOpened()) {
        System.out.println("Camera Error");
    } else {
        System.out.println("Camera OK");
    }

    Size frameSize = new Size((int) camSource.get(Videoio.CAP_PROP_FRAME_WIDTH),
            (int) camSource.get(Videoio.CAP_PROP_FRAME_HEIGHT));

    //int fourCC = oVideoWriter.fourcc('X', '2', '6', '4');
    //System.out.println("FourCC:" +fourCC);        
    oVideoWriter = new VideoWriter("test.avi", -1, 20, frameSize, true);

}

}

2016-06-15 02:17:27 -0600 commented answer Only a few video codecs

this.cameraID = 1; this.fileName = fileName; frame = new Mat(); mem = new MatOfByte(); }

@Override
public void run() {
    System.out.println("Run");
    synchronized (this) {
        while (true) {
            if (camSource.grab()) {
                try {
                    camSource.retrieve(frame);
                    Imgcodecs.imencode(".bmp", frame, mem);
                    Image im = ImageIO.read(new ByteArrayInputStream(mem.toArray()));
                    BufferedImage buff = (BufferedImage) im;
                    this.setVisible(true);
                    Graphics g = this.getGraphics();
                    oVideoWriter.write(frame);
                    System.out.println("Width: " +this.getWidth() +" Height: "+this.getHeight());
                    if(g.drawImage(buff, 0, 0, this.getWidth(), this.getHeight(), 0, 0, this.getWidth(), this.getHeight(), null));
                } catch (Exception ex) {
                    ex.printStackTrace();
2016-06-15 02:16:36 -0600 commented answer Only a few video codecs

import org.opencv.core.MatOfByte; import org.opencv.core.Size; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.videoio.VideoCapture; import org.opencv.videoio.VideoWriter; import org.opencv.videoio.Videoio;

public class KriPanel extends JPanel implements Runnable {

private int count = 0;
private VideoCapture camSource = null;
private Mat frame;
private MatOfByte mem;
private VideoWriter oVideoWriter;
private int cameraID;
private String cameraIP;
private Boolean run = false;
private String fileName;

public KriPanel(int cameraID, String cameraIP, String fileName) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME); // load native library of opencv
    this.setSize(105, 160);
    this.setVisible(true);
    initComponents();
    this.cameraID = cameraID;
    this.cameraIP = cameraIP;
2016-06-15 02:14:58 -0600 commented answer Only a few video codecs

I installed OpenCV the way it is descriped here.

Than I configured Eclipse like they say here.

Than I copied the .dll to the place you sugested.

I still can only select one of these codecs:

  • Microsoft RLE
  • Microsoft Video 1
  • Intel IYUV Codec
  • Intel IYUV Codec (Yes, twice)
  • Cinepac Codec from Radius
  • Uncompressed

Here is my code:

import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.io.ByteArrayInputStream;

import javax.imageio.ImageIO; import javax.swing.JPanel;

import org.opencv.core.Core; import org.opencv.core.Mat;

2016-06-13 06:01:05 -0600 answered a question Only a few video codecs

Hello,

thank you for your hint.

I downloaded the openh264-1.5.0-win64msvc.dll but I can't find a way to install it onto my Windows system.

Do you can help me out?

2016-06-13 03:18:54 -0600 received badge  Editor (source)
2016-06-09 08:48:18 -0600 asked a question Only a few video codecs

Hello,

I am using OpenCV with java to record a Webcam video. If I use the "-1" fourCC prameter creating the video writer I get a list of all useable codecs at runtime. In my case this list only contains ca. 5 codecs. No MPEG, no h.264... I already installed codec packs like KLite but I won't get more codecs.

Can anybody tell me how to get more codecs?

Thank you. Kristian

P.s.: I am using Eclipse