Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions src/platform-camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@ class platform_camera_sensor : public synthetic_sensor

} // namespace

void platform_camera::initialize()
{
auto const n_sensors = get_sensors_count();
for (auto i = 0; i < n_sensors; ++i)
{
if (auto sensor = dynamic_cast<platform_camera_sensor*>(&(get_sensor(i))))
{
if (sensor->get_device().get_info(RS2_CAMERA_INFO_NAME) == "Platform Camera")
{
sensor->try_register_pu(RS2_OPTION_BACKLIGHT_COMPENSATION);
sensor->try_register_pu(RS2_OPTION_BRIGHTNESS);
sensor->try_register_pu(RS2_OPTION_CONTRAST);
sensor->try_register_pu(RS2_OPTION_EXPOSURE);
sensor->try_register_pu(RS2_OPTION_GAMMA);
sensor->try_register_pu(RS2_OPTION_HUE);
sensor->try_register_pu(RS2_OPTION_SATURATION);
sensor->try_register_pu(RS2_OPTION_SHARPNESS);
sensor->try_register_pu(RS2_OPTION_WHITE_BALANCE);
sensor->try_register_pu(RS2_OPTION_ENABLE_AUTO_EXPOSURE);
sensor->try_register_pu(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE);
}
}
}
}

platform_camera::platform_camera( std::shared_ptr< const device_info > const & dev_info,
const std::vector< platform::uvc_device_info > & uvc_infos,
Expand Down Expand Up @@ -118,20 +142,13 @@ platform_camera::platform_camera( std::shared_ptr< const device_info > const & d
color_ep->register_metadata( RS2_FRAME_METADATA_FRAME_TIMESTAMP,
make_uvc_header_parser( &platform::uvc_header::timestamp ) );

color_ep->try_register_pu( RS2_OPTION_BACKLIGHT_COMPENSATION );
color_ep->try_register_pu( RS2_OPTION_BRIGHTNESS );
color_ep->try_register_pu( RS2_OPTION_CONTRAST );
color_ep->try_register_pu( RS2_OPTION_EXPOSURE );
color_ep->try_register_pu( RS2_OPTION_GAMMA );
color_ep->try_register_pu( RS2_OPTION_HUE );
color_ep->try_register_pu( RS2_OPTION_SATURATION );
color_ep->try_register_pu( RS2_OPTION_SHARPNESS );
color_ep->try_register_pu( RS2_OPTION_WHITE_BALANCE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_EXPOSURE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE );
// Create a thread to call initialize after a delay
std::thread([this]() {
std::this_thread::sleep_for(std::chrono::seconds(2)); // Delay for 2 seconds
this->initialize();
}).detach(); // Detach the thread to let it run independently
}


std::vector< tagged_profile > platform_camera::get_profiles_tags() const
{
std::vector< tagged_profile > markers;
Expand Down
3 changes: 3 additions & 0 deletions src/platform-camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class platform_camera : public backend_device
virtual rs2_intrinsics get_intrinsics( unsigned int, const stream_profile & ) const { return rs2_intrinsics{}; }

std::vector< tagged_profile > get_profiles_tags() const override;

private:
void initialize();
};


Expand Down
11 changes: 6 additions & 5 deletions tools/realsense-viewer/realsense-viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void add_playback_device( context & ctx,
// This function is called every frame
// If between the frames there was an asyncronous connect/disconnect event
// the function will pick up on this and add the device to the viewer
bool refresh_devices(std::mutex& m,
void refresh_devices(std::mutex& m,
context& ctx,
device_changes& devices_connection_changes,
std::vector<device>& current_connected_devices,
Expand All @@ -139,9 +139,10 @@ bool refresh_devices(std::mutex& m,
viewer_model& viewer_model,
std::string& error_message)
{

event_information info({}, {});
if (!devices_connection_changes.try_get_next_changes(info))
return false;
return ;
try
{
//Remove disconnected
Expand Down Expand Up @@ -283,7 +284,7 @@ bool refresh_devices(std::mutex& m,
{
error_message = "Unknown error";
}
return true;
return;
}


Expand Down Expand Up @@ -372,7 +373,7 @@ int main(int argc, const char** argv) try
// Closing the window
while (window)
{
auto device_changed = refresh_devices(m, ctx, devices_connection_changes, connected_devs,
refresh_devices(m, ctx, devices_connection_changes, connected_devs,
device_names, *device_models, viewer_model, error_message);

auto output_height = viewer_model.get_output_height();
Expand Down Expand Up @@ -504,7 +505,7 @@ int main(int argc, const char** argv) try

ImGui::PopStyleColor();
ImGui::EndPopup();
}
}
ImGui::PopFont();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
Expand Down
Loading