9
9
#include < realsense_imgui.h>
10
10
11
11
#include " ../src/ds/d400/d400-private.h"
12
+ #include " ../src/ds/d500/d500-private.h"
12
13
13
14
14
15
using namespace rs2 ;
@@ -62,77 +63,77 @@ void calibration_model::draw_int( std::string name, uint16_t & x, const uint16_t
62
63
ImGui::PopStyleColor ();
63
64
}
64
65
65
- void calibration_model::draw_float4x4 (std::string name, float3x3& feild ,
66
+ void calibration_model::draw_float4x4 (std::string name, float3x3& field ,
66
67
const float3x3& original, bool & changed)
67
68
{
68
69
ImGui::SetCursorPosX (10 );
69
70
ImGui::Text (" %s:" , name.c_str ()); ImGui::SameLine ();
70
- ImGui::SetCursorPosX (200 );
71
71
72
72
ImGui::PushItemWidth (120 );
73
+
73
74
ImGui::SetCursorPosX (200 );
74
- draw_float (name + " _XX" , feild .x .x , original.x .x , changed);
75
+ draw_float (name + " _XX" , field .x .x , original.x .x , changed);
75
76
ImGui::SameLine ();
76
- draw_float (name + " _XY" , feild .x .y , original.x .y , changed);
77
+ draw_float (name + " _XY" , field .x .y , original.x .y , changed);
77
78
ImGui::SameLine ();
78
- draw_float (name + " _XZ" , feild .x .z , original.x .z , changed);
79
+ draw_float (name + " _XZ" , field .x .z , original.x .z , changed);
79
80
80
81
ImGui::SetCursorPosX (200 );
81
- draw_float (name + " _YX" , feild .y .x , original.y .x , changed);
82
+ draw_float (name + " _YX" , field .y .x , original.y .x , changed);
82
83
ImGui::SameLine ();
83
- draw_float (name + " _YY" , feild .y .y , original.y .y , changed);
84
+ draw_float (name + " _YY" , field .y .y , original.y .y , changed);
84
85
ImGui::SameLine ();
85
- draw_float (name + " _YZ" , feild .y .z , original.y .z , changed);
86
+ draw_float (name + " _YZ" , field .y .z , original.y .z , changed);
86
87
87
88
ImGui::SetCursorPosX (200 );
88
- draw_float (name + " _ZX" , feild .z .x , original.z .x , changed);
89
+ draw_float (name + " _ZX" , field .z .x , original.z .x , changed);
89
90
ImGui::SameLine ();
90
- draw_float (name + " _ZY" , feild .z .y , original.z .y , changed);
91
+ draw_float (name + " _ZY" , field .z .y , original.z .y , changed);
91
92
ImGui::SameLine ();
92
- draw_float (name + " _ZZ" , feild .z .z , original.z .z , changed);
93
+ draw_float (name + " _ZZ" , field .z .z , original.z .z , changed);
93
94
94
95
ImGui::PopItemWidth ();
95
96
96
97
ImGui::SetCursorPosY (ImGui::GetCursorPosY () + 5 );
97
98
}
98
99
99
- void calibration_model::draw_intrinsics (std::string name, mini_intrinsics& feild ,
100
+ void calibration_model::draw_intrinsics (std::string name, mini_intrinsics& field ,
100
101
const mini_intrinsics& original, bool & changed)
101
102
{
102
103
ImGui::SetCursorPosX (10 );
103
104
ImGui::Text (" %s:" , name.c_str ()); ImGui::SameLine ();
104
- ImGui::SetCursorPosX (200 );
105
105
106
106
ImGui::PushItemWidth (120 );
107
+
107
108
ImGui::SetCursorPosX (200 );
108
109
ImGui::Text (" %s:" , " ppx" ); ImGui::SameLine ();
109
110
ImGui::SetCursorPosX (250 );
110
- draw_float (name + " _ppx" , feild .ppx , original.ppx , changed);
111
+ draw_float (name + " _ppx" , field .ppx , original.ppx , changed);
111
112
ImGui::SameLine ();
112
113
ImGui::SetCursorPosX (400 );
113
114
ImGui::Text (" %s:" , " ppy" ); ImGui::SameLine ();
114
115
ImGui::SetCursorPosX (450 );
115
- draw_float (name + " _ppy" , feild .ppy , original.ppy , changed);
116
+ draw_float (name + " _ppy" , field .ppy , original.ppy , changed);
116
117
117
118
ImGui::SetCursorPosX (200 );
118
119
ImGui::Text (" %s:" , " fx" ); ImGui::SameLine ();
119
120
ImGui::SetCursorPosX (250 );
120
- draw_float (name + " _fx" , feild .fx , original.fx , changed);
121
+ draw_float (name + " _fx" , field .fx , original.fx , changed);
121
122
ImGui::SameLine ();
122
123
ImGui::SetCursorPosX (400 );
123
124
ImGui::Text (" %s:" , " fy" ); ImGui::SameLine ();
124
125
ImGui::SetCursorPosX (450 );
125
- draw_float (name + " _fy" , feild .fy , original.fy , changed);
126
+ draw_float (name + " _fy" , field .fy , original.fy , changed);
126
127
127
128
ImGui::SetCursorPosX (200 );
128
129
ImGui::Text (" %s:" , " width" ); ImGui::SameLine ();
129
130
ImGui::SetCursorPosX (250 );
130
- draw_int (name + " width" , feild .image_width , original.image_width , changed);
131
+ draw_int (name + " width" , field .image_width , original.image_width , changed);
131
132
ImGui::SameLine ();
132
133
ImGui::SetCursorPosX (400 );
133
134
ImGui::Text (" %s:" , " height" ); ImGui::SameLine ();
134
135
ImGui::SetCursorPosX (450 );
135
- draw_int (name + " height" , feild .image_height , original.image_height , changed);
136
+ draw_int (name + " height" , field .image_height , original.image_height , changed);
136
137
137
138
ImGui::PopItemWidth ();
138
139
@@ -212,7 +213,7 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
212
213
config_file cf (fn);
213
214
table->baseline = cf.get (" baseline" );
214
215
215
- auto load_float3x4 = [&](std::string name, librealsense::float3x3& m){
216
+ auto load_float3x3 = [&](std::string name, librealsense::float3x3& m){
216
217
m.x .x = cf.get (std::string ( rsutils::string::from () << name << " .x.x" ).c_str ());
217
218
m.x .y = cf.get (std::string ( rsutils::string::from () << name << " .x.y" ).c_str ());
218
219
m.x .z = cf.get (std::string ( rsutils::string::from () << name << " .x.z" ).c_str ());
@@ -226,10 +227,10 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
226
227
m.z .z = cf.get (std::string ( rsutils::string::from () << name << " .z.z" ).c_str ());
227
228
};
228
229
229
- load_float3x4 (" intrinsic_left" , table->intrinsic_left );
230
- load_float3x4 (" intrinsic_right" , table->intrinsic_right );
231
- load_float3x4 (" world2left_rot" , table->world2left_rot );
232
- load_float3x4 (" world2right_rot" , table->world2right_rot );
230
+ load_float3x3 (" intrinsic_left" , table->intrinsic_left );
231
+ load_float3x3 (" intrinsic_right" , table->intrinsic_right );
232
+ load_float3x3 (" world2left_rot" , table->world2left_rot );
233
+ load_float3x3 (" world2right_rot" , table->world2right_rot );
233
234
234
235
for (int i = 0 ; i < librealsense::ds::max_ds_rect_resolutions; i++)
235
236
{
@@ -264,7 +265,7 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
264
265
config_file cf (fn);
265
266
cf.set (" baseline" , table->baseline );
266
267
267
- auto save_float3x4 = [&](std::string name, librealsense::float3x3& m){
268
+ auto save_float3x3 = [&](std::string name, librealsense::float3x3& m){
268
269
cf.set (std::string ( rsutils::string::from () << name << " .x.x" ).c_str (), m.x .x );
269
270
cf.set (std::string ( rsutils::string::from () << name << " .x.y" ).c_str (), m.x .y );
270
271
cf.set (std::string ( rsutils::string::from () << name << " .x.z" ).c_str (), m.x .z );
@@ -278,10 +279,10 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
278
279
cf.set (std::string ( rsutils::string::from () << name << " .z.z" ).c_str (), m.z .z );
279
280
};
280
281
281
- save_float3x4 (" intrinsic_left" , table->intrinsic_left );
282
- save_float3x4 (" intrinsic_right" , table->intrinsic_right );
283
- save_float3x4 (" world2left_rot" , table->world2left_rot );
284
- save_float3x4 (" world2right_rot" , table->world2right_rot );
282
+ save_float3x3 (" intrinsic_left" , table->intrinsic_left );
283
+ save_float3x3 (" intrinsic_right" , table->intrinsic_right );
284
+ save_float3x3 (" world2left_rot" , table->world2left_rot );
285
+ save_float3x3 (" world2right_rot" , table->world2right_rot );
285
286
286
287
for (int i = 0 ; i < librealsense::ds::max_ds_rect_resolutions; i++)
287
288
{
@@ -437,7 +438,7 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
437
438
}
438
439
if (ImGui::IsItemHovered ())
439
440
{
440
- RsImGui::CustomTooltip (" %s" , " Changing calibration will affect depth quality. Changes are persistent.\n There is an option to get back to factory calibration, but it maybe worse than current calibration\n Before writing to flash, we strongly recommend to make a file backup" );
441
+ RsImGui::CustomTooltip (" %s" , " Changing calibration will affect depth quality. Changes are persistent.\n There is an option to get back to factory calibration, but it may be worse than current calibration\n Before writing to flash, we strongly recommend to make a file backup" );
441
442
}
442
443
443
444
ImGui::SetCursorScreenPos ({ (float )(x0 + w - 230 ), (float )(y0 + h - 30 ) });
@@ -494,7 +495,6 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
494
495
495
496
ImGui::PopStyleColor (2 );
496
497
}
497
- auto streams = dev.query_sensors ()[0 ].get_active_streams ();
498
498
if (changed)
499
499
{
500
500
try
@@ -505,6 +505,7 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
505
505
{
506
506
try
507
507
{
508
+ auto streams = dev.query_sensors ()[0 ].get_active_streams ();
508
509
dev.query_sensors ()[0 ].close ();
509
510
dev.query_sensors ()[0 ].open (streams);
510
511
dev.as <rs2::auto_calibrated_device>().set_calibration_table (_calibration);
@@ -572,7 +573,7 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
572
573
config_file cf (fn);
573
574
table->baseline = cf.get (" baseline" );
574
575
575
- auto load_float3x4 = [&](std::string name, librealsense::float3x3& m){
576
+ auto load_float3x3 = [&](std::string name, librealsense::float3x3& m){
576
577
m.x .x = cf.get (std::string ( rsutils::string::from () << name << " .x.x" ).c_str ());
577
578
m.x .y = cf.get (std::string ( rsutils::string::from () << name << " .x.y" ).c_str ());
578
579
m.x .z = cf.get (std::string ( rsutils::string::from () << name << " .x.z" ).c_str ());
@@ -600,8 +601,8 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
600
601
load_intrinsics ( " left_coefficients_table" , table->left_coefficients_table .base_instrinsics );
601
602
load_intrinsics ( " right_coefficients_table" , table->right_coefficients_table .base_instrinsics );
602
603
load_intrinsics ( " rectified_intrinsics" , table->rectified_intrinsics );
603
- load_float3x4 ( " left_rotation_matrix" , table->left_coefficients_table .rotation_matrix );
604
- load_float3x4 ( " right_rotation_matrix" , table->right_coefficients_table .rotation_matrix );
604
+ load_float3x3 ( " left_rotation_matrix" , table->left_coefficients_table .rotation_matrix );
605
+ load_float3x3 ( " right_rotation_matrix" , table->right_coefficients_table .rotation_matrix );
605
606
606
607
}
607
608
@@ -628,7 +629,7 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
628
629
config_file cf (fn);
629
630
cf.set (" baseline" , table->baseline );
630
631
631
- auto save_float3x4 = [&](std::string name, librealsense::float3x3& m){
632
+ auto save_float3x3 = [&](std::string name, librealsense::float3x3& m){
632
633
cf.set (std::string ( rsutils::string::from () << name << " .x.x" ).c_str (), m.x .x );
633
634
cf.set (std::string ( rsutils::string::from () << name << " .x.y" ).c_str (), m.x .y );
634
635
cf.set (std::string ( rsutils::string::from () << name << " .x.z" ).c_str (), m.x .z );
@@ -656,8 +657,8 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
656
657
save_intrinsics ( " left_coefficients_table" , table->left_coefficients_table .base_instrinsics );
657
658
save_intrinsics ( " right_coefficients_table" , table->right_coefficients_table .base_instrinsics );
658
659
save_intrinsics ( " rectified_intrinsics" , table->rectified_intrinsics );
659
- save_float3x4 ( " left_rotation_matrix" , table->left_coefficients_table .rotation_matrix );
660
- save_float3x4 ( " right_rotation_matrix" , table->right_coefficients_table .rotation_matrix );
660
+ save_float3x3 ( " left_rotation_matrix" , table->left_coefficients_table .rotation_matrix );
661
+ save_float3x3 ( " right_rotation_matrix" , table->right_coefficients_table .rotation_matrix );
661
662
662
663
}
663
664
}
@@ -758,7 +759,7 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
758
759
}
759
760
if (ImGui::IsItemHovered ())
760
761
{
761
- RsImGui::CustomTooltip (" %s" , " Changing calibration will affect depth quality. Changes are persistent.\n There is an option to get back to factory calibration, but it maybe worse than current calibration\n Before writing to flash, we strongly recommend to make a file backup" );
762
+ RsImGui::CustomTooltip (" %s" , " Changing calibration will affect depth quality. Changes are persistent.\n There is an option to get back to factory calibration, but it may be worse than current calibration\n Before writing to flash, we strongly recommend to make a file backup" );
762
763
}
763
764
764
765
ImGui::SetCursorScreenPos ({ (float )(x0 + w - 230 ), (float )(y0 + h - 30 ) });
@@ -815,7 +816,6 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
815
816
816
817
ImGui::PopStyleColor (2 );
817
818
}
818
- auto streams = dev.query_sensors ()[0 ].get_active_streams ();
819
819
if (changed)
820
820
{
821
821
try
@@ -826,6 +826,7 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
826
826
{
827
827
try
828
828
{
829
+ auto streams = dev.query_sensors ()[0 ].get_active_streams ();
829
830
dev.query_sensors ()[0 ].close ();
830
831
dev.query_sensors ()[0 ].open (streams);
831
832
dev.as <rs2::auto_calibrated_device>().set_calibration_table (_calibration);
@@ -844,4 +845,4 @@ void calibration_model::d500_update( ux_window & window, std::string & error_mes
844
845
}
845
846
ImGui::PopStyleColor (3 );
846
847
ImGui::PopStyleVar (2 );
847
- }
848
+ }
0 commit comments