8 #define intrinsics_string(res) #res << "\t" << array2str((float_4&)table->rect_params[res]) << endl 26 auto table = check_calib<ds::coefficients_table>(raw_data);
29 <<
"baseline = " <<
table->baseline <<
" mm" << endl
30 <<
"Rect params: \t fX\t\t fY\t\t ppX\t\t ppY \n" 44 if (width == 848 && height == 100)
58 if ((rect_params.x == rect_params.y) && (rect_params.z == rect_params.w))
60 rect_params.
x = rect_params.y = intrinsics.
width * 1.5f;
61 rect_params.z = intrinsics.
width * 0.5f;
62 rect_params.w = intrinsics.
height * 0.5f;
64 intrinsics.
fx = rect_params[0];
65 intrinsics.
fy = rect_params[1];
66 intrinsics.
ppx = rect_params[2];
67 intrinsics.
ppy = rect_params[3];
72 if (width == 848 && height == 100)
75 intrinsics.
ppy -= 190;
88 auto rect_params =
static_cast<const float4>(
table->rect_params[resolution]);
90 if ((rect_params.x == rect_params.y) && (rect_params.z == rect_params.w))
92 rect_params.
x = rect_params.y = intrinsics.
width * 1.5f;
93 rect_params.z = intrinsics.
width * 0.5f;
94 rect_params.w = intrinsics.
height * 0.5f;
98 if (width == 256 && height == 144)
100 intrinsics.
fx = rect_params[0];
101 intrinsics.
fy = rect_params[1];
102 intrinsics.
ppx = rect_params[2] - 832;
103 intrinsics.
ppy = rect_params[3] - 468;
114 memset(intrinsics.
coeffs, 0,
sizeof(intrinsics.
coeffs));
122 auto table = check_calib<ds::fisheye_calibration_table>(raw_data);
127 intrinsics.fy =
intrin(1,1);
128 intrinsics.ppx =
intrin(2,0);
129 intrinsics.ppy =
intrin(2,1);
132 intrinsics.height =
height;
133 intrinsics.width =
width;
144 auto table = check_calib<ds::rgb_calibration_table>(raw_data);
148 float calib_aspect_ratio = 9.f / 16.f;
150 if (
table->calib_width &&
table->calib_height)
151 calib_aspect_ratio = float(
table->calib_height) / float(
table->calib_width);
154 LOG_WARNING(
"RGB Calibration resolution is not specified, using default 16/9 Aspect ratio");
158 float actual_aspect_ratio = height / (float)width;
159 if (actual_aspect_ratio < calib_aspect_ratio)
161 intrin(1, 1) *= calib_aspect_ratio / actual_aspect_ratio;
162 intrin(2, 1) *= calib_aspect_ratio / actual_aspect_ratio;
166 intrin(0, 0) *= actual_aspect_ratio / calib_aspect_ratio;
167 intrin(2, 0) *= actual_aspect_ratio / calib_aspect_ratio;
172 static_cast<int>(
width),
173 static_cast<int>(height),
174 ((1 +
intrin(2, 0))*width) / 2.f,
175 ((1 +
intrin(2, 1))*height) / 2.f,
176 intrin(0, 0) * width / 2.f,
177 intrin(1, 1) * height / 2.f,
181 LOG_DEBUG(endl <<
array2str((
float_4&)(calc_intrinsic.fx, calc_intrinsic.fy, calc_intrinsic.ppx, calc_intrinsic.ppy)) << endl);
187 << std::setprecision(3) <<
intrin(0, 0) <<
", " <<
intrin(1, 1)
188 <<
". Fx,Fy = " << calc_intrinsic.
fx <<
"," << calc_intrinsic.fy);
189 ref = calc_intrinsic;
192 return calc_intrinsic;
204 auto&& item = items[
i];
205 if (item.width == width && item.height == height)
209 result->
ppx = item.ppx;
210 result->
ppy = item.ppy;
211 result->
fx = item.fx;
212 result->
fy = item.fy;
245 auto table = check_calib<fisheye_extrinsics_table>(raw_data);
247 auto rot =
table->rotation;
248 auto trans =
table->translation;
250 pose ex = {{rot(0,0), rot(1,0),rot(2,0),rot(1,0), rot(1,1),rot(2,1),rot(0,2), rot(1,2),rot(2,2)},
251 {trans[0], trans[1], trans[2]}};
257 auto table = check_calib<rgb_calibration_table>(raw_data);
260 float trans_scale = -0.001f;
262 trans_vector.
x *= trans_scale;
263 trans_vector.
y *= trans_scale;
264 trans_vector.z *= trans_scale;
266 return{ rect_rot_mat,trans_vector };
272 for (
auto it = devices.begin();
it != devices.end(); ++
it)
289 found = (result.
mi == 3);
293 found = (result.
mi == 4);
299 found = (result.
mi == 6);
305 found = (result.
mi == 5);
309 << std::hex << info.
pid <<
":" << info.
vid << std::dec <<
" is not supported.");
327 std::vector<platform::uvc_device_info> results;
331 case d400_caps::CAP_FISHEYE_SENSOR:
332 std::copy_if(devices.begin(),devices.end(),std::back_inserter(results),
338 <<
"Capability filters are not implemented for val " 339 << std::hex << caps << std::dec);
346 switch (flash_version)
349 case 100:
return { 2, { 17, 10, 40, 29, 30, 54} };
350 case 101:
return { 3, { 10, 16, 40, 29, 18, 19, 30, 20, 21, 54 } };
351 case 102:
return { 3, { 9, 10, 16, 40, 29, 18, 19, 30, 20, 21, 54 } };
352 case 103:
return { 4, { 9, 10, 16, 40, 29, 18, 19, 30, 20, 21, 54 } };
353 case 104:
return { 4, { 9, 10, 40, 29, 18, 19, 30, 20, 21, 54 } };
354 case 105:
return { 5, { 9, 10, 40, 29, 18, 19, 30, 20, 21, 54 } };
355 case 106:
return { 5, { 15, 9, 10, 16, 40, 29, 18, 19, 30, 20, 21, 54 } };
356 case 107:
return { 6, { 15, 9, 10, 16, 40, 29, 18, 19, 30, 20, 21, 54 } };
358 throw std::runtime_error(
"Unsupported flash version: " +
std::to_string(flash_version));
364 switch (flash_version)
367 case 100:
return { 2, { 134, 25 } };
369 throw std::runtime_error(
"Unsupported flash version: " +
std::to_string(flash_version));
378 memcpy(&rv.
header, flash_buffer.data() + header_offset,
sizeof(rv.
header));
rs2_intrinsics get_intrinsic_by_resolution_coefficients_table(const std::vector< uint8_t > &raw_data, uint32_t width, uint32_t height)
flash_section parse_flash_section(const std::vector< uint8_t > &flash_buffer, flash_table toc, flash_structure s)
bool try_get_intrinsic_by_resolution_new(const vector< uint8_t > &raw_data, uint32_t width, uint32_t height, rs2_intrinsics *result)
std::string array2str(T &data)
rs2_intrinsics get_intrinsic_fisheye_table(const std::vector< uint8_t > &raw_data, uint32_t width, uint32_t height)
pose get_fisheye_extrinsics_data(const vector< uint8_t > &raw_data)
#define LOG_DEBUG_THERMAL_LOOP(...)
const uint16_t RS435_RGB_PID
static const std::set< std::uint16_t > fisheye_pid
static std::map< ds5_rect_resolutions, int2 > resolutions_list
ds5_rect_resolutions width_height_to_ds5_rect_resolutions(uint32_t width, uint32_t height)
const uint16_t RS400_IMU_PID
def info(name, value, persistent=False)
const uint16_t RS416_RGB_PID
const uint16_t RS405U_PID
bool try_fetch_usb_device(std::vector< platform::usb_device_info > &devices, const platform::uvc_device_info &info, platform::usb_device_info &result)
flash_structure get_ro_flash_structure(const uint32_t flash_version)
flash_section read_write_section
GLint GLsizei GLsizei height
const uint32_t FLASH_RW_TABLE_OF_CONTENT_OFFSET
rs2_intrinsics get_intrinsic_by_resolution(const vector< uint8_t > &raw_data, calibration_table_id table_id, uint32_t width, uint32_t height)
const uint16_t RS_USB2_PID
rs2_intrinsics get_color_stream_intrinsic(const std::vector< uint8_t > &raw_data, uint32_t width, uint32_t height)
flash_table parse_table_of_contents(const std::vector< uint8_t > &flash_buffer, uint32_t toc_offset)
flash_structure get_rw_flash_structure(const uint32_t flash_version)
#define intrinsics_string(res)
GLenum GLenum GLsizei void * table
const uint16_t RS420_MM_PID
const uint16_t RS435I_PID
flash_section read_only_section
const uint32_t FLASH_INFO_HEADER_OFFSET
const uint32_t FLASH_RO_TABLE_OF_CONTENT_OFFSET
std::vector< platform::uvc_device_info > filter_device_by_capability(const std::vector< platform::uvc_device_info > &devices, d400_caps caps)
pose get_color_stream_extrinsic(const std::vector< uint8_t > &raw_data)
const uint16_t RS430I_PID
const uint16_t RS430_MM_PID
void copy(void *dst, void const *src, size_t size)
flash_info get_flash_info(const std::vector< uint8_t > &flash_buffer)
std::string to_string(T value)