-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PointCloud] Set texel intrinsic & extrinsic based on selected stream #12576
[PointCloud] Set texel intrinsic & extrinsic based on selected stream #12576
Conversation
src/proc/pointcloud.cpp
Outdated
@@ -141,7 +141,8 @@ namespace librealsense | |||
sensor_interface & s = dev->get_sensor( x ); | |||
for( auto const & sp : s.get_active_streams() ) | |||
{ | |||
if( sp->get_stream_type() == RS2_STREAM_COLOR ) | |||
if(( sp->get_stream_type() == RS2_STREAM_COLOR ) && | |||
( _prev_stream_filter.stream == RS2_STREAM_COLOR )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want the prev filter to be color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I read it:
- Whenever Color stream is enabled, Color sensor's texel intrinsic and extrinsic is getting used instead of Depth sensor's.
That means that we want to take the color intrinsics only when we have scenario 1: we actually want to use Color.
What I don't quite understand is why that's reflected in _prev_stream_filter
, but I guess we just have to stare at the code some more :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I read it:
- Whenever Color stream is enabled, Color sensor's texel intrinsic and extrinsic is getting used instead of Depth sensor's.
That means that we want to take the color intrinsics only when we have scenario 1: we actually want to use Color.
Yes, @maloel. That's right.
What I don't quite understand is why that's reflected in _prev_stream_filter, but I guess we just have to stare at the code some more :)
If we look at this function inspect_other_frame(...)
, user will pass the required frame:
Color
frame for scenario 1Colorized depth
frame for scenario 2- or even
Infrared
frame also possible I think
Some default intrinsic and extrinsic values are set for the first time at line 191 and 192 in this same function.
Then, later in this callback, if the Color stream is enabled, they are overwritten by Color sensor's intrinsic and extrinsic.
So, to prevent this overwrite, added a condition to check whether the user want's Color
stream or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code surrounding _prev_stream_filter
is very fishy:
- Not initialized that I can see...
- I'm still unclear about its usage -- is it simply a way of saying "we want to do this only once and never again"??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we see the flow of the API calls:
Top level API is map_to(frame mapped)
. refer rs_processing.h
- Here
_stream_filter
will be set as per user's need- Color for scenario 1
- Depth for scenario 2
- Then,
process(...)
function is called- which in turn calls
inspect_other_frame(...)
and it sets_prev_stream_filter
- which in turn calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at line 115 in this same function, it is initialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's used in line 113 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like, it is getting initialized with default values (RS2_STREAM_ANY
, RS2_FORMAT_ANY
, ...) in the constructor stream_filter
class in synthetic-stream.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm right you are.
Then why compare the previous stream filter and not simply _stream_filter
? I think that would be preferable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that makes sense. will update.
Tracked on LRS-514.
The PointCloud filter supports generating
rs2::points
for below scenarios:Depth
frame andColor
frameDepth
frame andColorized depth
frameOverview of the issue:
Depth
stream is enabled.Color
andDepth
streams and want to generate pointcloud for scenario 2, then the output doesn't look good.Rootcause:
Color
stream is enabled,Color
sensor's texel intrinsic and extrinsic is getting used instead ofDepth
sensor's.