|
@@ -90,21 +90,24 @@ int main() {
|
|
|
cuInit(0);
|
|
cuInit(0);
|
|
|
create_cuda_context(&cuda_ctx);
|
|
create_cuda_context(&cuda_ctx);
|
|
|
|
|
|
|
|
- // working staffs
|
|
|
|
|
- std::unique_ptr<stereo_camera> st_cam;
|
|
|
|
|
- texture_renderer tex_renderer;
|
|
|
|
|
- frame_sender sender;
|
|
|
|
|
- std::atomic_flag idr_flag;
|
|
|
|
|
-
|
|
|
|
|
- std::unique_ptr<frame_buffer_helper> output_fbo;
|
|
|
|
|
-// output_fbo.initialize(output_frame_width, output_frame_height);
|
|
|
|
|
-
|
|
|
|
|
- video_encoder encoder;
|
|
|
|
|
- encoder.initialize();
|
|
|
|
|
|
|
+ // make VTK happy
|
|
|
|
|
+ auto vtk_external = vtkSmartPointer<ExternalVTKWidget>::New();
|
|
|
|
|
|
|
|
-// raw_file_saver raw_saver;
|
|
|
|
|
-// raw_saver.start(raw_save_prefix);
|
|
|
|
|
-// camera.set_raw_saver(&raw_saver);
|
|
|
|
|
|
|
+ // config augment renderers
|
|
|
|
|
+ auto left_remap_file = mapped_file{"left_proj.dat", boost::iostreams::mapped_file_base::readonly};
|
|
|
|
|
+ auto right_remap_file = mapped_file{"right_proj.dat", boost::iostreams::mapped_file_base::readonly};
|
|
|
|
|
+ auto left_cam_info = augment_renderer::camera_info{
|
|
|
|
|
+ .width = 2463, .height = 2048, .angle = 47.53009170028617,
|
|
|
|
|
+ .remap_data = (void *) left_remap_file.const_data()
|
|
|
|
|
+ };
|
|
|
|
|
+ auto right_cam_info = augment_renderer::camera_info{
|
|
|
|
|
+ .width = 2427, .height = 2048, .angle = 48.0713681473623,
|
|
|
|
|
+ .remap_data = (void *) right_remap_file.const_data()
|
|
|
|
|
+ };
|
|
|
|
|
+ auto left_ar = augment_renderer{&left_cam_info, stereo_camera::get_output_size()};
|
|
|
|
|
+ auto right_ar = augment_renderer{&right_cam_info, stereo_camera::get_output_size()};
|
|
|
|
|
+ left_remap_file.close();
|
|
|
|
|
+ right_remap_file.close();
|
|
|
|
|
|
|
|
// config sophiar
|
|
// config sophiar
|
|
|
using namespace sophiar;
|
|
using namespace sophiar;
|
|
@@ -118,8 +121,6 @@ int main() {
|
|
|
// auto probe_pose_id = var_io.add_variable("probe_in_tracker", VT_transform, VD_Input);
|
|
// auto probe_pose_id = var_io.add_variable("probe_in_tracker", VT_transform, VD_Input);
|
|
|
var_io.connect("127.0.0.1", 5278);
|
|
var_io.connect("127.0.0.1", 5278);
|
|
|
|
|
|
|
|
- auto vtk_external = vtkSmartPointer<ExternalVTKWidget>::New();
|
|
|
|
|
-
|
|
|
|
|
scene_manager scene;
|
|
scene_manager scene;
|
|
|
scene.var_io = &var_io;
|
|
scene.var_io = &var_io;
|
|
|
auto femur_actor = scene.add_actor("femur.stl", femur_pose_id);
|
|
auto femur_actor = scene.add_actor("femur.stl", femur_pose_id);
|
|
@@ -132,28 +133,32 @@ int main() {
|
|
|
// for debug;
|
|
// for debug;
|
|
|
// scene.add_actor("/home/tpx/data/stls/GlassProbe_4Ball_3.STL", probe_pose_id);
|
|
// scene.add_actor("/home/tpx/data/stls/GlassProbe_4Ball_3.STL", probe_pose_id);
|
|
|
|
|
|
|
|
- augment_renderer left_ar, right_ar;
|
|
|
|
|
- auto left_remap_file = mapped_file{"left_proj.dat", boost::iostreams::mapped_file_base::readonly};
|
|
|
|
|
- auto right_remap_file = mapped_file{"right_proj.dat", boost::iostreams::mapped_file_base::readonly};
|
|
|
|
|
- auto left_cam_info = augment_renderer::camera_intrinsics{
|
|
|
|
|
- .width = 2463, .height = 2048, .angle = 47.53009170028617,
|
|
|
|
|
- .remap_data = (void *) left_remap_file.const_data()
|
|
|
|
|
- };
|
|
|
|
|
- auto right_cam_info = augment_renderer::camera_intrinsics{
|
|
|
|
|
- .width = 2427, .height = 2048, .angle = 48.0713681473623,
|
|
|
|
|
- .remap_data = (void *) right_remap_file.const_data()
|
|
|
|
|
- };
|
|
|
|
|
- left_ar.initialize(&tex_renderer, &left_cam_info);
|
|
|
|
|
- right_ar.initialize(&tex_renderer, &right_cam_info);
|
|
|
|
|
-// left_ar.set_background(&camera.left_rgb_image);
|
|
|
|
|
-// right_ar.set_background(&camera.right_rgb_image);
|
|
|
|
|
|
|
+ // for debug; config sophiar
|
|
|
|
|
+// auto probe_pose_id = var_io.add_variable("probe_in_tracker", VT_transform, VD_Input);
|
|
|
|
|
+ var_io.connect("127.0.0.1", 5278);
|
|
|
augment_renderer::add_scene(&scene);
|
|
augment_renderer::add_scene(&scene);
|
|
|
- left_remap_file.close();
|
|
|
|
|
- right_remap_file.close();
|
|
|
|
|
|
|
|
|
|
|
|
+ // immutable staffs
|
|
|
|
|
+ auto encoder = video_encoder{};
|
|
|
|
|
+ auto sender = frame_sender{};
|
|
|
|
|
+
|
|
|
|
|
+ // mutable staffs
|
|
|
|
|
+ std::unique_ptr<stereo_camera> st_cam;
|
|
|
|
|
+ std::unique_ptr<frame_buffer_helper> output_fbo;
|
|
|
|
|
+
|
|
|
|
|
+// raw_file_saver raw_saver;
|
|
|
|
|
+// raw_saver.start(raw_save_prefix);
|
|
|
|
|
+// camera.set_raw_saver(&raw_saver);
|
|
|
|
|
+
|
|
|
|
|
+ std::atomic_flag idr_flag;
|
|
|
int camera_fps = default_camera_fps;
|
|
int camera_fps = default_camera_fps;
|
|
|
- float exposure_time_ms = default_camera_exposure_time_ms;
|
|
|
|
|
- float analog_gain = default_camera_analog_gain;
|
|
|
|
|
|
|
+ bool use_hdr = false;
|
|
|
|
|
+ mvs_camera::capture_config cap_conf{
|
|
|
|
|
+ default_camera_exposure_time_ms, default_camera_analog_gain
|
|
|
|
|
+ };
|
|
|
|
|
+ mvs_camera::capture_config hdr_cap_conf{
|
|
|
|
|
+ default_camera_exposure_time_ms, default_camera_analog_gain
|
|
|
|
|
+ };
|
|
|
float output_bitrate_mbps = default_video_stream_bitrate / 1e6f;
|
|
float output_bitrate_mbps = default_video_stream_bitrate / 1e6f;
|
|
|
int sender_port = 5279;
|
|
int sender_port = 5279;
|
|
|
|
|
|
|
@@ -183,7 +188,6 @@ int main() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// ImGui::ShowDemoWindow();
|
|
// ImGui::ShowDemoWindow();
|
|
|
|
|
|
|
|
if (ImGui::Begin("Remote AR Control")) {
|
|
if (ImGui::Begin("Remote AR Control")) {
|
|
@@ -199,28 +203,32 @@ int main() {
|
|
|
if (ImGui::Button("Open")) {
|
|
if (ImGui::Button("Open")) {
|
|
|
st_cam = std::make_unique<stereo_camera>();
|
|
st_cam = std::make_unique<stereo_camera>();
|
|
|
auto [left_img, right_img] = st_cam->get_output_image();
|
|
auto [left_img, right_img] = st_cam->get_output_image();
|
|
|
- left_ar.set_background(&left_img);
|
|
|
|
|
- right_ar.set_background(&right_img);
|
|
|
|
|
|
|
+ left_ar.set_background(left_img);
|
|
|
|
|
+ right_ar.set_background(right_img);
|
|
|
}
|
|
}
|
|
|
} else { // st_cam != nullptr
|
|
} else { // st_cam != nullptr
|
|
|
if (ImGui::Button("Close")) {
|
|
if (ImGui::Button("Close")) {
|
|
|
st_cam.reset();
|
|
st_cam.reset();
|
|
|
- }
|
|
|
|
|
- ImGui::SameLine();
|
|
|
|
|
- if (!st_cam->is_capturing()) {
|
|
|
|
|
- if (ImGui::Button("Start")) {
|
|
|
|
|
- st_cam->set_fps(camera_fps);
|
|
|
|
|
- st_cam->start();
|
|
|
|
|
-// camera.start_capture(1000 * exposure_time_ms, analog_gain, camera_fps);
|
|
|
|
|
- }
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- if (ImGui::Button("Stop")) {
|
|
|
|
|
- st_cam->stop();
|
|
|
|
|
- }
|
|
|
|
|
- if (!auto_save_raw) {
|
|
|
|
|
- ImGui::SameLine();
|
|
|
|
|
- if (ImGui::Button("Capture")) {
|
|
|
|
|
|
|
+ assert(st_cam != nullptr);
|
|
|
|
|
+ ImGui::SameLine();
|
|
|
|
|
+ if (!st_cam->is_capturing()) {
|
|
|
|
|
+ if (ImGui::Button("Start")) {
|
|
|
|
|
+ st_cam->set_fps(camera_fps);
|
|
|
|
|
+ st_cam->set_hdr_config(0, cap_conf);
|
|
|
|
|
+ st_cam->set_hdr_config(1, hdr_cap_conf);
|
|
|
|
|
+ st_cam->set_hdr_enabled(use_hdr);
|
|
|
|
|
+ st_cam->start();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (ImGui::Button("Stop")) {
|
|
|
|
|
+ st_cam->stop();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!auto_save_raw) {
|
|
|
|
|
+ ImGui::SameLine();
|
|
|
|
|
+ if (ImGui::Button("Capture")) {
|
|
|
// camera.request_save_raw();
|
|
// camera.request_save_raw();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -230,27 +238,35 @@ int main() {
|
|
|
if (st_cam != nullptr) {
|
|
if (st_cam != nullptr) {
|
|
|
ImGui::SeparatorText("Configs");
|
|
ImGui::SeparatorText("Configs");
|
|
|
|
|
|
|
|
- // don't allow config change wile camera is capturing
|
|
|
|
|
- if (st_cam->is_capturing()) {
|
|
|
|
|
- ImGui::BeginDisabled();
|
|
|
|
|
|
|
+ if (ImGui::SliderInt("Frame Rate (fps)", &camera_fps, 1, 60)) {
|
|
|
|
|
+ st_cam->set_fps(camera_fps);
|
|
|
}
|
|
}
|
|
|
- ImGui::SliderInt("Frame Rate (fps)", &camera_fps, 1, 60);
|
|
|
|
|
- if (st_cam->is_capturing()) {
|
|
|
|
|
- ImGui::EndDisabled();
|
|
|
|
|
|
|
+ if (ImGui::DragFloat("Exposure Time (ms)", &cap_conf.exposure_time_ms,
|
|
|
|
|
+ 0.1, 0.1, 1e3f / (float) camera_fps, "%.01f")) {
|
|
|
|
|
+ st_cam->set_hdr_config(0, cap_conf);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ImGui::DragFloat("Analog Gain (dB)", &cap_conf.analog_gain_db,
|
|
|
|
|
+ 0.1, 0, 23.5, "%.01f")) {
|
|
|
|
|
+ st_cam->set_hdr_config(0, cap_conf);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ImGui::DragFloat("Exposure Time (ms)", &exposure_time_ms,
|
|
|
|
|
- 0.1, 0.1, 1e3f / (float) camera_fps, "%.01f");
|
|
|
|
|
- ImGui::DragFloat("Analog Gain (dB)", &analog_gain, 0.1, 0, 23.5, "%.01f");
|
|
|
|
|
|
|
+ if (ImGui::Checkbox("Use HDR", &use_hdr)) {
|
|
|
|
|
+ st_cam->set_hdr_enabled(use_hdr);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (use_hdr) {
|
|
|
|
|
+ ImGui::PushID("HDR Config");
|
|
|
|
|
+ if (ImGui::DragFloat("Exposure Time (ms)", &hdr_cap_conf.exposure_time_ms,
|
|
|
|
|
+ 0.1, 0.1, 1e3f / (float) camera_fps, "%.01f")) {
|
|
|
|
|
+ st_cam->set_hdr_config(1, hdr_cap_conf);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ImGui::DragFloat("Analog Gain (dB)", &hdr_cap_conf.analog_gain_db,
|
|
|
|
|
+ 0.1, 0, 23.5, "%.01f")) {
|
|
|
|
|
+ st_cam->set_hdr_config(1, hdr_cap_conf);
|
|
|
|
|
+ }
|
|
|
|
|
+ ImGui::PopID();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (st_cam->is_capturing()) {
|
|
if (st_cam->is_capturing()) {
|
|
|
- // capture config
|
|
|
|
|
- mvs_camera::capture_config conf{
|
|
|
|
|
- 1000 * exposure_time_ms, analog_gain
|
|
|
|
|
- };
|
|
|
|
|
- st_cam->set_hdr_config(0, conf);
|
|
|
|
|
-// camera.set_capture_config(1000 * exposure_time_ms, analog_gain);
|
|
|
|
|
-
|
|
|
|
|
// preview config
|
|
// preview config
|
|
|
ImGui::SeparatorText("Preview Camera");
|
|
ImGui::SeparatorText("Preview Camera");
|
|
|
ImGui::RadioButton("Left", &preview_cam, 0);
|
|
ImGui::RadioButton("Left", &preview_cam, 0);
|
|
@@ -296,61 +312,68 @@ int main() {
|
|
|
ImGui::PopID();
|
|
ImGui::PopID();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (st_cam != nullptr && st_cam->is_capturing() && ImGui::CollapsingHeader("AR Config")) {
|
|
|
|
|
- ImGui::PushID("AR");
|
|
|
|
|
|
|
+ // AR configs
|
|
|
|
|
+ if (st_cam != nullptr && st_cam->is_capturing()) {
|
|
|
|
|
+ if (ImGui::CollapsingHeader("AR Config")) {
|
|
|
|
|
+ ImGui::PushID("AR");
|
|
|
|
|
|
|
|
- static int femur_opacity = 100;
|
|
|
|
|
- static int tibia_opacity = 100;
|
|
|
|
|
- ImGui::DragInt("Femur Transparency", &femur_opacity, 1, 0, 100);
|
|
|
|
|
- ImGui::DragInt("Tibia Transparency", &tibia_opacity, 1, 0, 100);
|
|
|
|
|
- femur_actor->GetProperty()->SetOpacity(0.01 * femur_opacity);
|
|
|
|
|
- tibia_actor->GetProperty()->SetOpacity(0.01 * tibia_opacity);
|
|
|
|
|
|
|
+ static int femur_opacity = 100;
|
|
|
|
|
+ static int tibia_opacity = 100;
|
|
|
|
|
+ ImGui::DragInt("Femur Transparency", &femur_opacity, 1, 0, 100);
|
|
|
|
|
+ ImGui::DragInt("Tibia Transparency", &tibia_opacity, 1, 0, 100);
|
|
|
|
|
+ femur_actor->GetProperty()->SetOpacity(0.01 * femur_opacity);
|
|
|
|
|
+ tibia_actor->GetProperty()->SetOpacity(0.01 * tibia_opacity);
|
|
|
|
|
|
|
|
- ImGui::PopID();
|
|
|
|
|
|
|
+ ImGui::PopID();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// video streamer control
|
|
// video streamer control
|
|
|
- if (st_cam != nullptr && st_cam->is_capturing() && ImGui::CollapsingHeader("Video Encoder")) {
|
|
|
|
|
- ImGui::PushID("Encoder");
|
|
|
|
|
|
|
+ if (st_cam != nullptr && st_cam->is_capturing()) {
|
|
|
|
|
+ if (ImGui::CollapsingHeader("Video Encoder")) {
|
|
|
|
|
+ ImGui::PushID("Encoder");
|
|
|
|
|
|
|
|
- ImGui::SeparatorText("Actions");
|
|
|
|
|
- if (!encoder.is_encoding()) {
|
|
|
|
|
- if (ImGui::Button("Start")) {
|
|
|
|
|
- output_fbo = std::make_unique<frame_buffer_helper>();
|
|
|
|
|
- if (full_resolution) {
|
|
|
|
|
- output_fbo->initialize(2 * raw_image_width, raw_image_height);
|
|
|
|
|
- } else {
|
|
|
|
|
- output_fbo->initialize(output_frame_width, output_frame_height);
|
|
|
|
|
|
|
+ ImGui::SeparatorText("Actions");
|
|
|
|
|
+ if (!encoder.is_encoding()) {
|
|
|
|
|
+ if (ImGui::Button("Start")) {
|
|
|
|
|
+ if (full_resolution) {
|
|
|
|
|
+ auto cam_size = mvs_camera::get_output_size();
|
|
|
|
|
+ output_fbo = std::make_unique<frame_buffer_helper>(
|
|
|
|
|
+ cv::Size{cam_size.width * 2, cam_size.height});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ output_fbo = std::make_unique<frame_buffer_helper>(
|
|
|
|
|
+ cv::Size{output_frame_width, output_frame_height});
|
|
|
|
|
+ }
|
|
|
|
|
+ encoder.start_encode(output_fbo->tex_size,
|
|
|
|
|
+ camera_fps, (int) (output_bitrate_mbps * 1e6),
|
|
|
|
|
+ save_video, save_frame_length);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (ImGui::Button("Close")) {
|
|
|
|
|
+ encoder.stop_encode();
|
|
|
}
|
|
}
|
|
|
- encoder.start_encode(output_fbo->tex_width, output_fbo->tex_height,
|
|
|
|
|
- camera_fps, (int) (output_bitrate_mbps * 1e6),
|
|
|
|
|
- save_video, save_frame_length);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- if (ImGui::Button("Close")) {
|
|
|
|
|
- encoder.stop_encode();
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- ImGui::SeparatorText("Configs");
|
|
|
|
|
- if (encoder.is_encoding()) {
|
|
|
|
|
- ImGui::BeginDisabled();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ImGui::SeparatorText("Configs");
|
|
|
|
|
+ if (encoder.is_encoding()) {
|
|
|
|
|
+ ImGui::BeginDisabled();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- ImGui::DragFloat("Bitrate (Mbps)", &output_bitrate_mbps, 0.1, 1, 20, "%.01f");
|
|
|
|
|
- ImGui::Checkbox("Full Resolution", &full_resolution);
|
|
|
|
|
- ImGui::SameLine();
|
|
|
|
|
- ImGui::Checkbox("Save Video", &save_video);
|
|
|
|
|
- if (save_video) {
|
|
|
|
|
|
|
+ ImGui::DragFloat("Bitrate (Mbps)", &output_bitrate_mbps, 0.1, 1, 20, "%.01f");
|
|
|
|
|
+ ImGui::Checkbox("Full Resolution", &full_resolution);
|
|
|
ImGui::SameLine();
|
|
ImGui::SameLine();
|
|
|
- ImGui::Checkbox("Save Frame Length", &save_frame_length);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ImGui::Checkbox("Save Video", &save_video);
|
|
|
|
|
+ if (save_video) {
|
|
|
|
|
+ ImGui::SameLine();
|
|
|
|
|
+ ImGui::Checkbox("Save Frame Length", &save_frame_length);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (encoder.is_encoding()) {
|
|
|
|
|
- ImGui::EndDisabled();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (encoder.is_encoding()) {
|
|
|
|
|
+ ImGui::EndDisabled();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- ImGui::PopID();
|
|
|
|
|
|
|
+ ImGui::PopID();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (ImGui::CollapsingHeader("Frame Sender")) {
|
|
if (ImGui::CollapsingHeader("Frame Sender")) {
|
|
@@ -420,13 +443,15 @@ int main() {
|
|
|
if (encoder.is_encoding()) {
|
|
if (encoder.is_encoding()) {
|
|
|
// draw frame for streaming
|
|
// draw frame for streaming
|
|
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, output_fbo->fbo);
|
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, output_fbo->fbo);
|
|
|
- glViewport(0, 0, output_fbo->tex_width, output_fbo->tex_height);
|
|
|
|
|
|
|
+ glViewport(0, 0, output_fbo->tex_size.width, output_fbo->tex_size.height);
|
|
|
if (full_resolution) {
|
|
if (full_resolution) {
|
|
|
left_ar.render({-1, -1, 1, 2});
|
|
left_ar.render({-1, -1, 1, 2});
|
|
|
right_ar.render({0, -1, 1, 2});
|
|
right_ar.render({0, -1, 1, 2});
|
|
|
} else {
|
|
} else {
|
|
|
- left_ar.render({-0.5 - ar_width_normal / 2, -1, ar_width_normal, 2});
|
|
|
|
|
- right_ar.render({0.5 - ar_width_normal / 2, -1, ar_width_normal, 2});
|
|
|
|
|
|
|
+ float ar_width_normal = stereo_camera::get_output_size().aspectRatio()
|
|
|
|
|
+ / output_fbo->tex_size.aspectRatio();
|
|
|
|
|
+ left_ar.render({-0.5f - ar_width_normal / 2, -1, ar_width_normal, 2});
|
|
|
|
|
+ right_ar.render({0.5f - ar_width_normal / 2, -1, ar_width_normal, 2});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// send IDR frame occasionally to prevent broken video frame
|
|
// send IDR frame occasionally to prevent broken video frame
|
|
@@ -457,15 +482,16 @@ int main() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int frame_width, frame_height;
|
|
|
|
|
|
|
+ cv::Size frame_size;
|
|
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
|
|
- glfwGetFramebufferSize(main_window, &frame_width, &frame_height);
|
|
|
|
|
- glViewport(0, 0, frame_width, frame_height);
|
|
|
|
|
|
|
+ glfwGetFramebufferSize(main_window, &frame_size.width, &frame_size.height);
|
|
|
|
|
+ glViewport(0, 0, frame_size.width, frame_size.height);
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
if (st_cam != nullptr && st_cam->is_capturing()) {
|
|
if (st_cam != nullptr && st_cam->is_capturing()) {
|
|
|
// draw frame in the screen
|
|
// draw frame in the screen
|
|
|
- float width_normal = 1.0f * frame_height * raw_image_width / frame_width / raw_image_height;
|
|
|
|
|
|
|
+ float width_normal = stereo_camera::get_output_size().aspectRatio()
|
|
|
|
|
+ / frame_size.aspectRatio();
|
|
|
if (preview_cam == 0) { // left cam
|
|
if (preview_cam == 0) { // left cam
|
|
|
left_ar.render({-width_normal, 1, 2 * width_normal, -2});
|
|
left_ar.render({-width_normal, 1, 2 * width_normal, -2});
|
|
|
} else {
|
|
} else {
|