[PointCloud] Set texel intrinsic & extrinsic based on selected stream - #12576
Conversation
| { | ||
| 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.
Why do we want the prev filter to be color?
There was a problem hiding this comment.
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.
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:
Colorframe for scenario 1Colorized depthframe for scenario 2- or even
Infraredframe 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.
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.
If we see the flow of the API calls:
Top level API is map_to(frame mapped). refer rs_processing.h
- Here
_stream_filterwill 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.
at line 115 in this same function, it is initialized.
There was a problem hiding this comment.
But it's used in line 113 😄
There was a problem hiding this comment.
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.
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.
yeah, that makes sense. will update.
Tracked on LRS-514.
The PointCloud filter supports generating
rs2::pointsfor below scenarios:Depthframe andColorframeDepthframe andColorized depthframeOverview of the issue:
Depthstream is enabled.ColorandDepthstreams and want to generate pointcloud for scenario 2, then the output doesn't look good.Rootcause:
Colorstream is enabled,Colorsensor's texel intrinsic and extrinsic is getting used instead ofDepthsensor's.