@@ -1894,16 +1894,19 @@ static gboolean gst_zedsrc_start( GstBaseSrc * bsrc )
1894
1894
src->roi_w != -1 &&
1895
1895
src->roi_h != -1 ) {
1896
1896
int roi_x_end = src->roi_x + src->roi_w ;
1897
- int roi_y_end = src->roi_y + src->roi_y ;
1897
+ int roi_y_end = src->roi_y + src->roi_h ;
1898
1898
sl::Resolution resolution = sl::getResolution (init_params.camera_resolution );
1899
1899
if (src->roi_x < 0 || src->roi_x >= resolution.width ||
1900
1900
src->roi_y < 0 || src->roi_y >= resolution.height ||
1901
1901
roi_x_end >= resolution.width || roi_y_end >= resolution.height ) {
1902
- sl::Mat roi_mask (resolution, sl::MAT_TYPE::U8_C1);
1903
- roi_mask.setTo (0 .f );
1904
- for (int i = src->roi_x ; i < roi_x_end; i++)
1905
- for (int j = src->roi_y ; j < roi_y_end; j++)
1906
- roi_mask.setValue (i, j, 1 .f );
1902
+
1903
+ sl::uchar1 uint0 = 0 ;
1904
+ sl::uchar1 uint1 = 1 ;
1905
+ sl::Mat roi_mask (resolution, sl::MAT_TYPE::U8_C1, sl::MEM::CPU);
1906
+ roi_mask.setTo (uint0);
1907
+ for (int row = src->roi_y ; row < roi_y_end; row++)
1908
+ for (int col = src->roi_y ; col < roi_x_end; col++)
1909
+ roi_mask.setValue (col, row, uint1);
1907
1910
1908
1911
GST_INFO (" * ROI mask: (%d,%d)-%dx%d" ,
1909
1912
src->roi_x , src->roi_y , src->roi_w , src->roi_h );
@@ -1945,13 +1948,26 @@ static gboolean gst_zedsrc_start( GstBaseSrc * bsrc )
1945
1948
1946
1949
sl::Translation init_pos (src->init_pose_x ,src->init_pose_y , src->init_pose_z );
1947
1950
sl::Rotation init_or;
1948
- init_or.setEulerAngles ( sl::float3 (src->init_orient_roll ,src->init_orient_pitch ,src->init_orient_yaw ), false );
1949
- pos_trk_params.initial_world_transform = sl::Transform (init_or,init_pos);
1951
+ switch (init_params.coordinate_system ) {
1952
+ case sl::COORDINATE_SYSTEM::IMAGE:
1953
+ case sl::COORDINATE_SYSTEM::LEFT_HANDED_Y_UP:
1954
+ case sl::COORDINATE_SYSTEM::RIGHT_HANDED_Y_UP:
1955
+ init_or.setEulerAngles ( sl::float3 (src->init_orient_pitch ,src->init_orient_yaw ,src->init_orient_roll ), false );
1956
+ break ;
1957
+ case sl::COORDINATE_SYSTEM::RIGHT_HANDED_Z_UP:
1958
+ init_or.setEulerAngles ( sl::float3 (src->init_orient_pitch ,src->init_orient_roll ,src->init_orient_yaw ), false );
1959
+ break ;
1960
+ case sl::COORDINATE_SYSTEM::LEFT_HANDED_Z_UP:
1961
+ case sl::COORDINATE_SYSTEM::RIGHT_HANDED_Z_UP_X_FWD:
1962
+ init_or.setEulerAngles ( sl::float3 (src->init_orient_roll ,src->init_orient_pitch ,src->init_orient_yaw ), false );
1963
+ break ;
1964
+ }
1965
+
1966
+ pos_trk_params.initial_world_transform = sl::Transform (init_or,init_pos);
1950
1967
GST_INFO (" * Initial world transform: T(%g,%g,%g) OR(%g,%g,%g)" ,
1951
1968
src->init_pose_x ,src->init_pose_y , src->init_pose_z ,
1952
1969
src->init_orient_roll ,src->init_orient_pitch ,src->init_orient_yaw );
1953
1970
1954
-
1955
1971
ret = src->zed .enablePositionalTracking (pos_trk_params);
1956
1972
if (ret!=sl::ERROR_CODE::SUCCESS) {
1957
1973
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
0 commit comments