- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody,
using Java (Eclipse) and a recorded video file *.rssdk, how can I simply show the video?
Currently I tried this according to the documentation examples:
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import javax.swing.JFrame;
import javax.swing.JPanel;
import intel.rssdk.PXCMCapture;
import intel.rssdk.PXCMImage.Access;
import intel.rssdk.PXCMImage.ImageData;
import intel.rssdk.PXCMSenseManager;
import intel.rssdk.pxcmStatus;
public class MainClass {
public static int nframes = 1000000;
public static void main(String s[]) {
String filename = "C:\\1_RealSense\\Videos\\rec2.rssdk";
// Create a SenseManager instance
PXCMSenseManager sm = PXCMSenseManager.CreateInstance();
// Set file playback name
sm.QueryCaptureManager().SetFileName(filename, false);
// Enable stream and Initialize
sm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, 0, 0);
sm.Init();
// Set realtime=true and pause=false
sm.QueryCaptureManager().SetRealtime(false);
sm.QueryCaptureManager().SetPause(true);
JFrame window = new JFrame("Haupttitel");
window.setSize(1000, 800);
window.setBackground(Color.white);
window.setLocationRelativeTo(null);
JPanel videoPanel = new JPanel();
videoPanel.setSize(640, 480);
videoPanel.setBackground(Color.black);
videoPanel.setLocation(new Point(10,10));
window.add(videoPanel);
// window.pack();
window.setVisible(true);
// Streaming loop
for (int i = 0; i < nframes; i+=3) {
// Set to work on every 3rd frame of data
sm.QueryCaptureManager().SetFrameByIndex(i);
sm.FlushFrame();
// Ready for the frame to be ready
pxcmStatus sts = sm.AcquireFrame(true);
if (sts.compareTo( pxcmStatus.PXCM_STATUS_NO_ERROR)>0) break;
// Retrieve the sample and work on it. The image is in sample->color.
PXCMCapture.Sample sample = sm.QuerySample();
Graphics g = videoPanel.getGraphics();
ImageData id = new ImageData();
sample.rgb.AcquireAccess(Access.ACCESS_READ, id);
Image img=null;
g.drawImage(img, 0, 0, null);
// Resume processing the next frame
sm.ReleaseFrame();
}
// Clean up
sm.FlushFrame();
}
}
I try to get each 3. frame from the rgb images (in the docs it says color, but that does not work, so I took rgb instead) and draw it on the JPanel. So far, this doesnt work. Can you help me in any way? Is it even possible to convert from PXCMImage to java.awt.image ?
The debugger also says that the sample.depth / ir / left / right are null. Only sample.rgb shows a PXCMImage
best regards,
J.
Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page