Align color frame to Depth and get colored point cloud on Android with Java
Hi,
On Android I need to align the color frame with the depth frame to get the wrapped color frame from the depth point of view. I also need to get the colored point cloud defined in the depth frame space.
I use the following code snip:
ArrayList mFilters = new ArrayList<>();
mFilters.add(new Pointcloud(StreamType.COLOR));
mFilters.add(new Align(StreamType.DEPTH));
private FrameSet applyFilters(FrameSet frameSet, List<Filter> filters) {
if (filters == null)
return frameSet;
frameSet = frameSet.clone();
for (FilterInterface f : filters) {
FrameSet newSet = frameSet.applyFilter(f);
frameSet.close();
frameSet = newSet;
}
return frameSet;
}
FrameSet processed = applyFilters(frames, mFilters);
DepthFrame depthFrame = processed .first(StreamType.DEPTH).as(Extension.DEPTH_FRAME);
VideoFrame videoFframe = processed.first(StreamType.COLOR).as(Extension.VIDEO_FRAME);
I have two questions:
1. Is the original color frame in the processed frameset? If yes how to distinguish it from
the wrapped color frame?
2. If I align the depth frame to the color frame is the point cloud defined in the color
frame space or the depth frame space?
Thank you.
Yixun
-
Hi Yixun Liu Thanks for your questions.
1. If you wish to be able to access the original color frame at will then you would likely have to store the frame in a unique frame reference name (such as 'videoFrame_original') before depth to color alignment is performed. Then you should be able to access the original unaligned color frame after alignment has taken place.
2. The point cloud will be based on the color coordinates because the origin of depth changes from the center-line of the left IR sensor to the center-line of the RGB color sensor when depth to color alignment is performed.
Please sign in to leave a comment.
Comments
2 comments