Skip to content

Commit

Permalink
Merge pull request #1825 from ev-mp/current
Browse files Browse the repository at this point in the history
Rectify decimation filter/many-to-many operation mode
  • Loading branch information
ev-mp authored Jun 4, 2018
2 parents 911ae9c + 58d89bc commit 14a317e
Show file tree
Hide file tree
Showing 7 changed files with 938 additions and 894 deletions.
35 changes: 24 additions & 11 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ namespace rs2
float(dev->algo_roi.max_x - dev->algo_roi.min_x),
float(dev->algo_roi.max_y - dev->algo_roi.min_y) };

r = r.normalize(_normalized_zoom.unnormalize(get_stream_bounds())).unnormalize(stream_rect).cut_by(stream_rect);
r = r.normalize(_normalized_zoom.unnormalize(get_original_stream_bounds())).unnormalize(stream_rect).cut_by(stream_rect);

glColor3f(yellow.x, yellow.y, yellow.z);
draw_rect(r, 2);
Expand Down Expand Up @@ -3016,10 +3016,10 @@ namespace rs2
{
for (auto&& s : viewer.streams)
{
if(!s.second.dev) continue;
if (!s.second.dev) continue;
auto dev = s.second.dev;

if(s.second.original_profile.unique_id() == f.get_profile().unique_id())
if (s.second.original_profile.unique_id() == f.get_profile().unique_id())
{
if (dev->post_processing_enabled)
{
Expand Down Expand Up @@ -3051,20 +3051,33 @@ namespace rs2
f = hole_filling->invoke(f);
}

return f;
break;
}
}
}
}

// Override the the first pixel in Depth->RGB map to be used as a mark when occlusion filter is active
if ((f.get_profile().stream_type() == RS2_STREAM_COLOR))
// Override the zero pixel in texture frame with black color for occlusion invalidation
// TODO - this is a temporal solution to be refactored from the app level into the core library
switch (stream_type)
{
case RS2_STREAM_COLOR:
{
auto rgb_stream = const_cast<uint8_t*>(static_cast<const uint8_t*>(f.get_data()));
memset(rgb_stream, 0, 3); // Override the zero pixel with black color for occlusion marking
// Alternatively, enable the next two lines to render invalidation with magenta color for inspection
//rgb_stream[0] = rgb_stream[2] = 0xff; // Use magenta to highlight the occlusion areas
//rgb_stream[1] = 0;
auto rgb_stream = const_cast<uint8_t*>(static_cast<const uint8_t*>(f.get_data()));
memset(rgb_stream, 0, 3);
// Alternatively, enable the next two lines to render invalidation with magenta color for inspection
//rgb_stream[0] = rgb_stream[2] = 0xff; // Use magenta to highlight the occlusion areas
//rgb_stream[1] = 0;
}
break;
case RS2_STREAM_INFRARED:
{
auto ir_stream = const_cast<uint8_t*>(static_cast<const uint8_t*>(f.get_data()));
memset(ir_stream, 0, 2); // Override the first two bytes to cover Y8/Y16 formats
}
break;
default:
break;
}

return f;
Expand Down
2 changes: 1 addition & 1 deletion common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ namespace rs2
float3 target = { 0.0f, 0.0f, 0.0f };
float3 up;
bool fixed_up = true;
bool render_quads = false;
bool render_quads = true;

float view[16];
bool texture_wrapping_on = true;
Expand Down
2 changes: 2 additions & 0 deletions common/rendering.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ namespace rs2
if (auto colorized_frame = colorize->colorize(frame).as<video_frame>())
{
data = colorized_frame.get_data();
// Override the first pixel in the colorized image for occlusion invalidation.
memset((void*)data,0, colorized_frame.get_bytes_per_pixel());
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
colorized_frame.get_width(),
colorized_frame.get_height(),
Expand Down
2 changes: 1 addition & 1 deletion src/proc/colorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace librealsense
{
{
std::lock_guard<std::mutex> lock(_mutex);
if (!_stream)
if (!_stream || (f.get_profile().get() != _stream->get()))
{
_stream = std::make_shared<rs2::stream_profile>(f.get_profile().clone(RS2_STREAM_DEPTH, 0, RS2_FORMAT_RGB8));
environment::get_instance().get_extrinsics_graph().register_same_extrinsics(*_stream->get()->profile, *f.get_profile().get()->profile);
Expand Down
Loading

0 comments on commit 14a317e

Please sign in to comment.