54 cout <<
"[Test_SwissRanger] Camera open, serial #"
59 const double aspect_ratio = cam.
rows() / double(cam.
cols());
64 cout <<
"[Test_SwissRanger] Version: " << ver <<
"\n";
68 bool there_is_obs =
true, hard_error;
72 win3D.setCameraAzimuthDeg(140);
73 win3D.setCameraElevationDeg(20);
74 win3D.setCameraZoom(6.0);
75 win3D.setCameraPointingToPoint(2.5, 0, 0);
88 gl_points->setPointSize(4.5);
92 0.5, -0.5, -0.5 * aspect_ratio, 0.5 * aspect_ratio);
95 0.5, -0.5, -0.5 * aspect_ratio, 0.5 * aspect_ratio);
98 0.5, -0.5, -0.5 * aspect_ratio, 0.5 * aspect_ratio);
104 scene->insert(gl_points);
108 const int VW_WIDTH = 200;
109 const int VW_HEIGHT = 150;
110 const int VW_GAP = 10;
114 win3D.addTextMessage(
115 30, -10 - 1 * (VW_GAP + VW_HEIGHT),
"Range data", 1);
117 scene->createViewport(
"view2d_range");
118 scene->insert(gl_img_range,
"view2d_range");
119 viewRange->setViewportPosition(
120 5, -10 - 1 * (VW_GAP + VW_HEIGHT), VW_WIDTH, VW_HEIGHT);
121 viewRange->setTransparent(
true);
122 viewRange->getCamera().setOrthogonal(
true);
123 viewRange->getCamera().setAzimuthDegrees(90);
124 viewRange->getCamera().setElevationDegrees(90);
125 viewRange->getCamera().setZoomDistance(1.0);
127 win3D.addTextMessage(
128 30, -10 - 2 * (VW_GAP + VW_HEIGHT),
"Intensity data", 2);
130 scene->createViewport(
"view2d_int");
131 scene->insert(gl_img_intensity,
"view2d_int");
132 viewInt->setViewportPosition(
133 5, -10 - 2 * (VW_GAP + VW_HEIGHT), VW_WIDTH, VW_HEIGHT);
134 viewInt->setTransparent(
true);
135 viewInt->getCamera().setOrthogonal(
true);
136 viewInt->getCamera().setAzimuthDegrees(90);
137 viewInt->getCamera().setElevationDegrees(90);
138 viewInt->getCamera().setZoomDistance(1.0);
140 win3D.addTextMessage(
141 30, -10 - 3 * (VW_GAP + VW_HEIGHT),
"Intensity data (undistorted)",
144 scene->createViewport(
"view2d_intrect");
145 scene->insert(gl_img_intensity_rect,
"view2d_intrect");
146 viewIntRect->setViewportPosition(
147 5, -10 - 3 * (VW_GAP + VW_HEIGHT), VW_WIDTH, VW_HEIGHT);
148 viewIntRect->setTransparent(
true);
149 viewIntRect->getCamera().setOrthogonal(
true);
150 viewIntRect->getCamera().setAzimuthDegrees(90);
151 viewIntRect->getCamera().setElevationDegrees(90);
152 viewIntRect->getCamera().setZoomDistance(1.0);
154 win3D.unlockAccess3DScene();
161 bool endLoop =
false;
163 while (there_is_obs && !endLoop && win3D.isOpen())
173 win3D.get3DSceneAndLock();
174 gl_img_range->assignImage(std::move(img));
175 win3D.unlockAccess3DScene();
181 win3D.get3DSceneAndLock();
186 gl_img_intensity_rect->assignImage(undistortImg);
187 win3D.unlockAccess3DScene();
196 CColouredPointsMap::cmFromIntensityImage;
199 win3D.get3DSceneAndLock();
200 gl_points->loadFromPointsMap(&pntsMap);
201 win3D.unlockAccess3DScene();
208 win3D.get3DSceneAndLock();
209 win3D.addTextMessage(
210 0.01, 0.01,
format(
"%.02f Hz", nImgs / tictac.
Tac()), 100);
211 win3D.unlockAccess3DScene();
220 const int key = tolower(win3D.getPushedKey());
244 win3D.get3DSceneAndLock();
245 win3D.addTextMessage(
248 "Keyboard switches: H (hist.equal: %s) | G (convGray: %s) | D "
249 "(denoise: %s) | F (medianFilter: %s)",
255 win3D.unlockAccess3DScene();
257 std::this_thread::sleep_for(1ms);
268 catch (
const std::exception& e)
275 printf(
"Another exception!!");