Point cloud flicker as rendering On Android
Hi,
As I render a point cloud I encounter the flickering sometimes. I have two threads. The main thread process the frames to generate the point cloud and then feed it to the OpenGL thread. The OpenGL thread does the rendering for the point cloud.
In the main thread I feed the processed points frame to the OpenGL thread as below:
try(FrameSet processed = applyFilters(frameSet, filters)){
processed.foreach(new FrameCallback() {
@Override
public void onFrame(Frame f) {
if(f.is(Extension.POINTS))
render.setFrame(f)
}
});
}
in the Class Render I have two methods. One method is used to allow the main thread to feed the frame:
public synchronized void setFrame(Frame frame) {
if (this.mFrame != null) {
this.mFrame.close();
}
this.mFrame = frame.clone();
}
The other method is use to do rendering in the OpenGL thread.
public synchronized void doRender(){
Points points = mFrame.as(Extension.POINTS);
if(points.getCount() == 0){//many frames have zeroes and I think this is the reason //causing flickering
Log.d(TAG, "The point cloud is empty in rendering thread");
}
else
{
Log.d(TAG, "The point cloud is NOT empty in rendering thread");
}
float[] data = points.getVertices();
float[] tex = createTexture(points);//texture point cloud
if(data == null || tex == null) {
Log.d(TAG, "no model or texture fed...");
return;
}
draw(data, tex);
}
The problem is the point cloud flicker sometimes (not always).
When it flickered I found many points frames have points.getCount() == 0.
I think this is reason causing flickering. But do not know how it can happen.
Many thanks.
Yixun
-
Hi Yxliuwm,
Thanks for reaching out to us.
Could you please refer to the following links and see if the issue can be resolved?- SR300 depth image and point cloud data is flickering in rviz
- D435i Camera pointcloud coordinate frame keeps shifting (flickering) in ROS rviz
- OpenGL flickering issue in rendering
Regards,
Wan
Please sign in to leave a comment.
Comments
2 comments