Hi,
I’m using OpenNI2, Java and a Orbbec Astra S to generate pointclouds. Mirroring the videostream via
VideoStream.setMirroringEnabled(true);
basically works. At a resolution of 1028x1024 pixels the image is cut in half. The left half is then moved to the right, the left half is moved to the left. See this picture for further details.
This only happens at this high resolution. The error also shows at the simpleviewer.jar example. Any ideas how to fix this?
Best regards
Philipp
Code sniplets:
public class astraReader {
private static VideoStream VideoStream;
private static String astraUri;
private static float nullValue = 0.00001f;
static VideoFrameRef LastFrame;
public astraReader(){
OpenNI.initialize();
List<DeviceInfo> devicesInfo = OpenNI.enumerateDevices();
astraUri = devicesInfo.get(0).getUri();
Device device = Device.open(astraUri);
device.setDepthColorSyncEnabled(true);
VideoStream = org.openni.VideoStream.create(device, SensorType.DEPTH);
VideoMode mode = new VideoMode(640, 480, 30, PixelFormat.DEPTH_1_MM.toNative());
VideoStream.setVideoMode(mode);
VideoStream.setMirroringEnabled(true);
}
public pointcloud readCloud(){
VideoStream.start();
LastFrame = VideoStream.readFrame();
VideoStream.stop();
ShortBuffer pixels = LastFrame.getData().asShortBuffer();
pointcloud cloud = new pointcloud();
Point3D<Float> p;
for (int y = 0; y < LastFrame.getHeight(); y++)
{
for (int x = 0; x < LastFrame.getWidth(); x++)
{
p = CoordinateConverter.convertDepthToWorld(VideoStream, x, y, pixels.get(y * LastFrame.getWidth() + x));
if( Math.abs(p.getX()) > nullValue && Math.abs(p.getY()) > nullValue && Math.abs(p.getZ()) > nullValue ){
cloud.addPoint(p);
}
}
}
return cloud;
}
}