Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libxcam for openSUSE:Factory checked in at 2021-12-26 13:30:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libxcam (Old) and /work/SRC/openSUSE:Factory/.libxcam.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libxcam" Sun Dec 26 13:30:34 2021 rev:7 rq:942570 version:1.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libxcam/libxcam.changes 2021-10-26 20:14:37.186039156 +0200 +++ /work/SRC/openSUSE:Factory/.libxcam.new.2520/libxcam.changes 2021-12-26 13:30:53.738975653 +0100 @@ -1,0 +2,10 @@ +Fri Dec 17 22:27:31 UTC 2021 - Stefan Br??ns <[email protected]> + +- Really build against OpenCV4 (on TW), add + * 0001-gl-stitch_support_EGL_initialize_by_GBM.patch + * 0001-New_features_camera_tunning_and_fixes.patch + * 0001-pkg_config_check_opencv_module_version.patch +- Fix ODR violation, add + * 0001-Fix-multiple-definitions-of-XCam-ShaderID-ODR-violat.patch + +------------------------------------------------------------------- New: ---- 0001-Fix-multiple-definitions-of-XCam-ShaderID-ODR-violat.patch 0001-New_features_camera_tunning_and_fixes.patch 0001-gl-stitch_support_EGL_initialize_by_GBM.patch 0001-pkg_config_check_opencv_module_version.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libxcam.spec ++++++ --- /var/tmp/diff_new_pack.42qEc6/_old 2021-12-26 13:30:54.242976004 +0100 +++ /var/tmp/diff_new_pack.42qEc6/_new 2021-12-26 13:30:54.246976007 +0100 @@ -26,6 +26,14 @@ Group: Development/Libraries/C and C++ URL: https://github.com/01org/libxcam Source0: https://github.com/01org/libxcam/archive/release_%{version}.tar.gz +# PATCH-FIX-UPSTREAM OpenCV 4.x support, part 1 +Patch0: https://github.com/intel/libxcam/commit/b40c249bcfbf85da66fba416c6480d5ac6ff2ecb.patch#/0001-gl-stitch_support_EGL_initialize_by_GBM.patch +# PATCH-FIX-UPSTREAM OpenCV 4.x support, part 2 +Patch1: https://github.com/intel/libxcam/commit/6a20559b402493ff29eac7368b5d7b4569a64884.patch#/0001-New_features_camera_tunning_and_fixes.patch +# PATCH-FIX-UPSTREAM OpenCV 4.x support, part 3 +Patch2: https://github.com/intel/libxcam/commit/ea99d89082c2473c2e22c848bff4f9f537af3fde.patch#/0001-pkg_config_check_opencv_module_version.patch +# PATCH-FIX-UPSTREAM Fix ODR violation +Patch3: 0001-Fix-multiple-definitions-of-XCam-ShaderID-ODR-violat.patch BuildRequires: Mesa-libGLESv3-devel BuildRequires: autoconf BuildRequires: automake @@ -40,7 +48,11 @@ BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libdrm_intel) %endif +%if 0%{?suse_version} >= 1550 +BuildRequires: pkgconfig(opencv4) +%else BuildRequires: pkgconfig(opencv) +%endif BuildRequires: pkgconfig(vulkan) %description @@ -71,7 +83,7 @@ developing applications that use %{name}. %prep -%setup -q -n %{name}-release_%{version} +%autosetup -p1 -n %{name}-release_%{version} %build autoreconf -fiv ++++++ 0001-Fix-multiple-definitions-of-XCam-ShaderID-ODR-violat.patch ++++++ >From d30b792aa9fb08ca755d27f62b859bc321c5eac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]> Date: Sat, 18 Dec 2021 00:17:23 +0100 Subject: [PATCH] Fix multiple definitions of XCam::ShaderID (ODR violation) The IDs are only required inside the respective private namespaces, so move it. This matches e.g. gl_blender.cpp and vk_blender.cpp. --- modules/gles/gl_fastmap_blender.cpp | 12 ++++++------ modules/gles/gl_geomap_handler.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/gles/gl_fastmap_blender.cpp b/modules/gles/gl_fastmap_blender.cpp index 3ee6bab..d100f7f 100644 --- a/modules/gles/gl_fastmap_blender.cpp +++ b/modules/gles/gl_fastmap_blender.cpp @@ -24,12 +24,6 @@ namespace XCam { -enum ShaderID { - ShaderFastmapBlendY = 0, - ShaderFastmapBlendUVNV12, - ShaderFastmapBlendUVYUV420 -}; - static const GLShaderInfo shaders_info[] = { { GL_COMPUTE_SHADER, @@ -53,6 +47,12 @@ static const GLShaderInfo shaders_info[] = { namespace GLFastmapBlendPriv { +enum ShaderID { + ShaderFastmapBlendY = 0, + ShaderFastmapBlendUVNV12, + ShaderFastmapBlendUVYUV420 +}; + class Impl { public: diff --git a/modules/gles/gl_geomap_handler.cpp b/modules/gles/gl_geomap_handler.cpp index 342d271..fd88bf0 100644 --- a/modules/gles/gl_geomap_handler.cpp +++ b/modules/gles/gl_geomap_handler.cpp @@ -27,14 +27,6 @@ namespace XCam { -enum ShaderID { - ShaderComMapNV12 = 0, // NV12 common mapping - ShaderComMapYUV420, // YUV420 common mapping - ShaderFastMapY, // Y planar fast mapping - ShaderFastMapUVNV12, // NV12 UV planar fast mapping - ShaderFastMapUVYUV420 // YUV420 UV planar fast mapping -}; - static const GLShaderInfo shaders_info[] = { { GL_COMPUTE_SHADER, @@ -70,6 +62,14 @@ static const GLShaderInfo shaders_info[] = { namespace GLGeoMapPriv { +enum ShaderID { + ShaderComMapNV12 = 0, // NV12 common mapping + ShaderComMapYUV420, // YUV420 common mapping + ShaderFastMapY, // Y planar fast mapping + ShaderFastMapUVNV12, // NV12 UV planar fast mapping + ShaderFastMapUVYUV420 // YUV420 UV planar fast mapping +}; + class ComMap { public: -- 2.34.1 ++++++ 0001-New_features_camera_tunning_and_fixes.patch ++++++ >From 6a20559b402493ff29eac7368b5d7b4569a64884 Mon Sep 17 00:00:00 2001 From: zihengchang <[email protected]> Date: Thu, 9 Sep 2021 15:47:43 +0800 Subject: [PATCH] New features, camera tunning and fixes Support 6 camera input and output 8k video Support opecv4.x Add json file calibration data of new insta camera Fix code indentation --- configure.ac | 5 +- m4/xcam-utils.m4 | 4 +- modules/gles/gl_stitcher.cpp | 4 + modules/ocv/cv_capi_feature_match.cpp | 2 + modules/ocv/cv_capi_feature_match.h | 2 + modules/soft/Makefile.am | 2 +- modules/soft/soft_stitcher.cpp | 2 + modules/vulkan/vk_stitcher.cpp | 4 + tests/camera_calibration_insta.json | 115 +++++++++++++++++++++++ tests/test-surround-view.cpp | 8 +- tests/test_sv_params.h | 129 ++++++++++++++++++++++++++ xcore/interface/stitcher.cpp | 2 +- 12 files changed, 271 insertions(+), 8 deletions(-) create mode 100644 tests/camera_calibration_insta.json diff --git a/configure.ac b/configure.ac index 0319a700..0161e947 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ AC_SUBST(XCAM_LT_LDFLAGS) # xcam required OpenCV version [XCAM_REQUIRE_CV_MIN, XCAM_REQUIRE_CV_MAX) XCAM_REQUIRE_CV_MIN=3.0.0 -XCAM_REQUIRE_CV_MAX=4.0.0 +XCAM_REQUIRE_CV_MAX=5.0.0 # xcam required OpenSceneGraph version XCAM_REQUIRE_OSG_MIN=3.3.2 @@ -81,7 +81,7 @@ XCAM_CHECK_DOXYGEN($enable_docs, [], enable_docs="no") XCAM_CHECK_AVX512($enable_avx512, ENABLE_AVX512=1, ENABLE_AVX512=0) XCAM_CHECK_OSG($enable_render, $XCAM_REQUIRE_OSG_MIN, ENABLE_RENDER=1, ENABLE_RENDER=0) XCAM_CHECK_DNN($enable_dnn, $OPENVINO_IE_INC_PATH, $OPENVINO_IE_LIBS_PATH, ENABLE_DNN=1, ENABLE_DNN=0) -XCAM_CHECK_OPENCV($enable_opencv, $XCAM_REQUIRE_CV_MIN, $XCAM_REQUIRE_CV_MAX, HAVE_OPENCV=1, HAVE_OPENCV=0) +XCAM_CHECK_OPENCV($enable_opencv, $XCAM_REQUIRE_CV_MIN, $XCAM_REQUIRE_CV_MAX, HAVE_OPENCV=1, HAVE_OPENCV=0, OPENCV_VERSION3=1, OPENCV_VERSION3=0) XCAM_CHECK_OCV_VIDEOSTAB($HAVE_OPENCV, ENABLE_DVS=1, ENABLE_DVS=0) XCAM_CHECK_DVS_OCL($HAVE_OPENCV, ENABLE_DVS_CL_PATH=1, ENABLE_DVS_CL_PATH=0) XCAM_CHECK_GST($enable_gst, $GST_API_VERSION, $GST_VERSION_MIN, ENABLE_GST=1, ENABLE_GST=0) @@ -116,6 +116,7 @@ XCAM_DEFINE_MACOR(ENABLE_AVX512, $ENABLE_AVX512, have avx instruction) XCAM_DEFINE_MACOR(ENABLE_RENDER, $ENABLE_RENDER, enable texture render) XCAM_DEFINE_MACOR(ENABLE_DNN, $ENABLE_DNN, have dnn) XCAM_DEFINE_MACOR(HAVE_OPENCV, $HAVE_OPENCV, have opencv) +XCAM_DEFINE_MACOR(OPENCV_VERSION3, $OPENCV_VERSION3, opencv version3) XCAM_DEFINE_MACOR(ENABLE_DVS, $ENABLE_DVS, have dvs) XCAM_DEFINE_MACOR(ENABLE_DVS_CL_PATH, $ENABLE_DVS_CL_PATH, enable dvs cl path) XCAM_DEFINE_MACOR(ENABLE_CAPI, $ENABLE_CAPI, enable capi) diff --git a/m4/xcam-utils.m4 b/m4/xcam-utils.m4 index aefaf907..a93c45c6 100644 --- a/m4/xcam-utils.m4 +++ b/m4/xcam-utils.m4 @@ -55,7 +55,7 @@ AC_DEFUN([XCAM_CHECK_DOXYGEN], [$3]) ]) -# XCAM_CHECK_OPENCV([$1:value], [$2:ocv-min], [$3:ocv-max], [$4:if-found], [$5:if-not-found]) +# XCAM_CHECK_OPENCV([$1:value], [$2:ocv-min], [$3:ocv-max], [$4:if-found], [$5:if-not-found]??? [$6:if-opencv3.x], [$7:if-not-opencv3.x]) AC_DEFUN([XCAM_CHECK_OPENCV], [ AS_IF([test "x$1" = "xyes"], @@ -72,6 +72,8 @@ AC_DEFUN([XCAM_CHECK_OPENCV], [AC_MSG_ERROR(OpenCV required version: >= $2 && < $3)]) ], [$5]) + AS_IF([test $ocv_major_version == 3], [$6], [$7]) + AC_MSG_NOTICE(OPENCV_major_version: $ocv_major_version) ]) # XCAM_CHECK_OCV_VIDEOSTAB([$1:value], [$2:if-found], [$3:if-not-found]) diff --git a/modules/gles/gl_stitcher.cpp b/modules/gles/gl_stitcher.cpp index 1cdf46ad..22ac110a 100644 --- a/modules/gles/gl_stitcher.cpp +++ b/modules/gles/gl_stitcher.cpp @@ -746,15 +746,19 @@ StitcherImpl::create_feature_match (SmartPtr<FeatureMatch> &matcher) case FMCluster: matcher = FeatureMatch::create_cluster_feature_match (); break; +#if OPENCV_VERSION3 case FMCapi: matcher = FeatureMatch::create_capi_feature_match (); break; +#endif default: XCAM_LOG_ERROR ("gl-stitcher unsupported feature match mode: %d", fm_mode); return XCAM_RETURN_ERROR_PARAM; } #else +#if OPENCV_VERSION3 matcher = FeatureMatch::create_capi_feature_match (); +#endif #endif XCAM_ASSERT (matcher.ptr ()); diff --git a/modules/ocv/cv_capi_feature_match.cpp b/modules/ocv/cv_capi_feature_match.cpp index d478f3c0..e24416b7 100644 --- a/modules/ocv/cv_capi_feature_match.cpp +++ b/modules/ocv/cv_capi_feature_match.cpp @@ -22,6 +22,7 @@ #include "cv_capi_feature_match.h" +#if OPENCV_VERSION3 #define XCAM_CV_CAPI_FM_DEBUG 0 namespace XCam { @@ -249,3 +250,4 @@ FeatureMatch::create_capi_feature_match () } } +#endif diff --git a/modules/ocv/cv_capi_feature_match.h b/modules/ocv/cv_capi_feature_match.h index f1f87948..26c60629 100644 --- a/modules/ocv/cv_capi_feature_match.h +++ b/modules/ocv/cv_capi_feature_match.h @@ -31,6 +31,7 @@ #include <cv.h> #else #include <opencv2/imgproc/imgproc_c.h> +#if OPENCV_VERSION3 #include <opencv2/video/tracking_c.h> #endif @@ -72,3 +73,4 @@ class CVCapiFeatureMatch } #endif // CV_CAPI_FEATURE_MATCH_H +#endif diff --git a/modules/soft/Makefile.am b/modules/soft/Makefile.am index 9c4fbdb9..fa398221 100644 --- a/modules/soft/Makefile.am +++ b/modules/soft/Makefile.am @@ -31,7 +31,7 @@ xcam_soft_sources = \ soft_geo_tasks_priv.cpp \ soft_copy_task.cpp \ soft_stitcher.cpp \ - $(NULL) + $(NULL) libxcam_soft_la_SOURCES = \ $(xcam_soft_sources) \ diff --git a/modules/soft/soft_stitcher.cpp b/modules/soft/soft_stitcher.cpp index 35081216..dde33d19 100644 --- a/modules/soft/soft_stitcher.cpp +++ b/modules/soft/soft_stitcher.cpp @@ -470,8 +470,10 @@ StitcherImpl::init_feature_match (uint32_t idx) _overlaps[idx].matcher = FeatureMatch::create_default_feature_match (); else if (fm_mode == FMCluster) _overlaps[idx].matcher = FeatureMatch::create_cluster_feature_match (); +#if OPENCV_VERSION3 else if (fm_mode == FMCapi) _overlaps[idx].matcher = FeatureMatch::create_capi_feature_match (); +#endif else { XCAM_LOG_ERROR ("unsupported FeatureMatchMode: %d", fm_mode); XCAM_ASSERT (false); diff --git a/modules/vulkan/vk_stitcher.cpp b/modules/vulkan/vk_stitcher.cpp index 06ec8a77..9e12fd7c 100644 --- a/modules/vulkan/vk_stitcher.cpp +++ b/modules/vulkan/vk_stitcher.cpp @@ -423,15 +423,19 @@ StitcherImpl::init_feature_matchers () matcher = FeatureMatch::create_default_feature_match (); else if (fm_mode == FMCluster) matcher = FeatureMatch::create_cluster_feature_match (); +#if OPENCV_VERSION3 else if (fm_mode == FMCapi) matcher = FeatureMatch::create_capi_feature_match (); +#endif else { XCAM_LOG_ERROR ( "vk-stitcher(%s) unsupported FeatureMatchMode: %d", XCAM_STR (_stitcher->get_name ()), fm_mode); } #else +#if OPENCV_VERSION3 matcher = FeatureMatch::create_capi_feature_match (); +#endif #endif XCAM_ASSERT (matcher.ptr ()); diff --git a/tests/camera_calibration_insta.json b/tests/camera_calibration_insta.json new file mode 100644 index 00000000..9d7fae84 --- /dev/null +++ b/tests/camera_calibration_insta.json @@ -0,0 +1,115 @@ +{ + "info": "", + "sn": "", + "model": 2, + "rig": [ + 0.0, + 0.0, + 0.0 + ], + "cameras": { + "camera":[ + { + "type": 25, + "radius": 2040.0, + "cx": 1900.0, + "cy": 1410.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 92.3, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ 0.0, + 0.0, + 0.0 + ] + }, + { + "type": 25, + "radius": 1984.0, + "cx": 1920.0, + "cy": 1440.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 90.2, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "type": 25, + "radius": 1984.0, + "cx": 1860.0, + "cy": 1480.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 89.3, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "type": 25, + "radius": 1984.0, + "cx": 1944.0, + "cy": 1460.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 90.8, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "type": 25, + "radius": 1984.0, + "cx": 1910.0, + "cy": 1420.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 90.5, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "type": 25, + "radius": 1984.0, + "cx": 1928.0, + "cy": 1440.0, + "yaw": 0.0, + "pitch": 0.0, + "roll": 89.7, + "w": 3840, + "h": 2880, + "fov": 200.0, + "t": [ + 0.0, + 0.0, + 0.0 + ] + } + ] + } +} diff --git a/tests/test-surround-view.cpp b/tests/test-surround-view.cpp index 1e7297df..2fff0a3e 100644 --- a/tests/test-surround-view.cpp +++ b/tests/test-surround-view.cpp @@ -528,7 +528,7 @@ static void usage(const char* arg0) "\t--in-format optional, pixel format, select from [nv12/yuv], default: nv12\n" "\t--fisheye-num optional, the number of fisheye lens, default: 4\n" "\t--cam-model optional, camera model\n" - "\t select from [cama2c1080p/camb4c1080p/camc3c8k/camd3c8k], default: camb4c1080p\n" + "\t select from [cama2c1080p/camb4c1080p/camc3c8k/camc6c8k/camd3c8k], default: camb4c1080p\n" "\t--blend-pyr-levels optional, the pyramid levels of blender, default: 2\n" "\t--dewarp-mode optional, fisheye dewarp mode, select from [sphere/bowl], default: bowl\n" "\t--scopic-mode optional, scopic mode, select from [mono/stereoleft/stereoright], default: mono\n" @@ -705,6 +705,8 @@ int main (int argc, char *argv[]) cam_model = CamB4C1080P; else if (!strcasecmp (optarg, "camc3c8k")) cam_model = CamC3C8K; + else if (!strcasecmp (optarg, "camc6c8k")) + cam_model = CamC6C8K; else if (!strcasecmp (optarg, "camd3c8k")) cam_model = CamD3C8K; else { @@ -852,7 +854,7 @@ int main (int argc, char *argv[]) printf ("input%d file:\t\t%s\n", i, ins[i]->get_file_name ()); } printf ("camera model:\t\t%s\n", cam_model == CamA2C1080P ? "cama2c1080p" : - (cam_model == CamB4C1080P ? "camb4c1080p" : (cam_model == CamC3C8K ? "camc3c8k" : "camd3c8k"))); + (cam_model == CamB4C1080P ? "camb4c1080p" : (cam_model == CamC3C8K ? "camc3c8k" : (cam_model == CamC6C8K ? "camc6c8k" : "camd3c8k")))); printf ("fisheye number:\t\t%d\n", fisheye_num); printf ("stitch module:\t\t%s\n", module == SVModuleGLES ? "GLES" : (module == SVModuleVulkan ? "Vulkan" : (module == SVModuleSoft ? "Soft" : "Unknown"))); @@ -931,7 +933,7 @@ int main (int argc, char *argv[]) } #if ENABLE_FISHEYE_IMG_ROI - if (module == SVModuleGLES && (cam_model == CamC3C8K || cam_model == CamD3C8K)) { + if (module == SVModuleGLES && (cam_model == CamC3C8K || cam_model == CamC6C8K || cam_model == CamD3C8K)) { StitchInfo info = (module == SVModuleSoft) ? soft_stitch_info (cam_model, scopic_mode) : gl_stitch_info (cam_model, scopic_mode); diff --git a/tests/test_sv_params.h b/tests/test_sv_params.h index 7610aa1b..25e70534 100644 --- a/tests/test_sv_params.h +++ b/tests/test_sv_params.h @@ -30,6 +30,7 @@ enum CamModel { CamA2C1080P = 0, CamB4C1080P, CamC3C8K, + CamC6C8K, CamD3C8K }; @@ -57,6 +58,7 @@ static const char *extrinsic_names[] = { static const char *camera_calibration_json_names[] = { "", "", + "camera_calibration_insta.json", "", "k_camera_calibration.json" }; @@ -94,6 +96,15 @@ get_fisheye_img_roi_radius ( } break; } + case CamC6C8K: { + roi_radius[0] = 1787; + roi_radius[1] = 1787; + roi_radius[2] = 1787; + roi_radius[3] = 1787; + roi_radius[4] = 1787; + roi_radius[5] = 1787; + break; + } case CamD3C8K: { switch (scopic_mode) { case ScopicStereoLeft: { @@ -169,6 +180,15 @@ viewpoints_range (CamModel model, float *range) range[2] = 144.0f; break; } + case CamC6C8K: { + range[0] = 72.0f; + range[1] = 72.0f; + range[2] = 72.0f; + range[3] = 72.0f; + range[4] = 72.0f; + range[5] = 72.0f; + break; + } case CamD3C8K: { range[0] = 132.0f; range[1] = 132.0f; @@ -203,6 +223,13 @@ fm_region_ratio (CamModel model) ratio.height = 1.0f / 3.0f; break; } + case CamC6C8K: { + ratio.pos_x = 0.0f; + ratio.width = 1.0f; + ratio.pos_y = 1.0f / 3.0f; + ratio.height = 1.0f / 3.0f; + break; + } case CamD3C8K: { ratio.pos_x = 0.0f; ratio.width = 1.0f; @@ -260,6 +287,17 @@ soft_fm_config (CamModel model) cfg.max_track_error = 6.0f; break; } + case CamC6C8K: { + cfg.stitch_min_width = 136; + cfg.min_corners = 4; + cfg.offset_factor = 0.95f; + cfg.delta_mean_offset = 256.0f; + cfg.recur_offset_error = 4.0f; + cfg.max_adjusted_offset = 24.0f; + cfg.max_valid_offset_y = 20.0f; + cfg.max_track_error = 6.0f; + break; + } case CamD3C8K: { cfg.stitch_min_width = 256; cfg.min_corners = 4; @@ -394,6 +432,46 @@ soft_stitch_info (CamModel model, StitchScopicMode scopic_mode) } break; } + case CamC6C8K: { + info.merge_width[0] = 256; + info.merge_width[1] = 256; + info.merge_width[2] = 256; + info.merge_width[3] = 256; + info.merge_width[4] = 256; + info.merge_width[5] = 256; + + info.fisheye_info[0].intrinsic.cx = 1907.0f; + info.fisheye_info[0].intrinsic.cy = 1440.0f; + info.fisheye_info[0].intrinsic.fov = 200.0f; + info.fisheye_info[0].radius = 1984.0f; + info.fisheye_info[0].extrinsic.roll = 90.3f; + info.fisheye_info[1].intrinsic.cx = 1920.0f; + info.fisheye_info[1].intrinsic.cy = 1440.0f; + info.fisheye_info[1].intrinsic.fov = 200.0f; + info.fisheye_info[1].radius = 1984.0f; + info.fisheye_info[1].extrinsic.roll = 90.0f; + info.fisheye_info[2].intrinsic.cx = 1920.0f; + info.fisheye_info[2].intrinsic.cy = 1440.0f; + info.fisheye_info[2].intrinsic.fov = 200.0f; + info.fisheye_info[2].radius = 1984.0f; + info.fisheye_info[2].extrinsic.roll = 90.2f; + info.fisheye_info[3].intrinsic.cx = 1920.0f; + info.fisheye_info[3].intrinsic.cy = 1440.0f; + info.fisheye_info[3].intrinsic.fov = 200.0f; + info.fisheye_info[3].radius = 1984.0f; + info.fisheye_info[3].extrinsic.roll = 90.0f; + info.fisheye_info[4].intrinsic.cx = 1920.0f; + info.fisheye_info[4].intrinsic.cy = 1440.0f; + info.fisheye_info[4].intrinsic.fov = 200.0f; + info.fisheye_info[4].radius = 1984.0f; + info.fisheye_info[4].extrinsic.roll = 91.2f; + info.fisheye_info[5].intrinsic.cx = 1914.0f; + info.fisheye_info[5].intrinsic.cy = 1440.0f; + info.fisheye_info[5].intrinsic.fov = 200.0f; + info.fisheye_info[5].radius = 1984.0f; + info.fisheye_info[5].extrinsic.roll = 90.1f; + break; + } case CamD3C8K: { switch (scopic_mode) { case ScopicStereoLeft: { @@ -494,6 +572,17 @@ gl_fm_config (CamModel model) cfg.max_track_error = 6.0f; break; } + case CamC6C8K: { + cfg.stitch_min_width = 136; + cfg.min_corners = 4; + cfg.offset_factor = 0.95f; + cfg.delta_mean_offset = 256.0f; + cfg.recur_offset_error = 4.0f; + cfg.max_adjusted_offset = 24.0f; + cfg.max_valid_offset_y = 20.0f; + cfg.max_track_error = 6.0f; + break; + } case CamD3C8K: { cfg.stitch_min_width = 256; cfg.min_corners = 4; @@ -584,6 +673,46 @@ gl_stitch_info (CamModel model, StitchScopicMode scopic_mode) } break; } + case CamC6C8K: { + info.merge_width[0] = 256; + info.merge_width[1] = 256; + info.merge_width[2] = 256; + info.merge_width[3] = 256; + info.merge_width[4] = 256; + info.merge_width[5] = 256; + + info.fisheye_info[0].intrinsic.cx = 1907.0f; + info.fisheye_info[0].intrinsic.cy = 1440.0f; + info.fisheye_info[0].intrinsic.fov = 200.0f; + info.fisheye_info[0].radius = 1984.0f; + info.fisheye_info[0].extrinsic.roll = 90.3f; + info.fisheye_info[1].intrinsic.cx = 1920.0f; + info.fisheye_info[1].intrinsic.cy = 1440.0f; + info.fisheye_info[1].intrinsic.fov = 200.0f; + info.fisheye_info[1].radius = 1984.0f; + info.fisheye_info[1].extrinsic.roll = 90.0f; + info.fisheye_info[2].intrinsic.cx = 1920.0f; + info.fisheye_info[2].intrinsic.cy = 1440.0f; + info.fisheye_info[2].intrinsic.fov = 200.0f; + info.fisheye_info[2].radius = 1984.0f; + info.fisheye_info[2].extrinsic.roll = 90.2f; + info.fisheye_info[3].intrinsic.cx = 1920.0f; + info.fisheye_info[3].intrinsic.cy = 1440.0f; + info.fisheye_info[3].intrinsic.fov = 200.0f; + info.fisheye_info[3].radius = 1984.0f; + info.fisheye_info[3].extrinsic.roll = 90.0f; + info.fisheye_info[4].intrinsic.cx = 1920.0f; + info.fisheye_info[4].intrinsic.cy = 1440.0f; + info.fisheye_info[4].intrinsic.fov = 200.0f; + info.fisheye_info[4].radius = 1984.0f; + info.fisheye_info[4].extrinsic.roll = 91.2f; + info.fisheye_info[5].intrinsic.cx = 1914.0f; + info.fisheye_info[5].intrinsic.cy = 1440.0f; + info.fisheye_info[5].intrinsic.fov = 200.0f; + info.fisheye_info[5].radius = 1984.0f; + info.fisheye_info[5].extrinsic.roll = 90.1f; + break; + } case CamD3C8K: { switch (scopic_mode) { case ScopicStereoLeft: { diff --git a/xcore/interface/stitcher.cpp b/xcore/interface/stitcher.cpp index 0f79a9cc..40f1cc28 100644 --- a/xcore/interface/stitcher.cpp +++ b/xcore/interface/stitcher.cpp @@ -336,7 +336,7 @@ Stitcher::estimate_round_slices () return XCAM_RETURN_NO_ERROR; XCAM_FAIL_RETURN ( - ERROR, _camera_num && _camera_num < XCAM_STITCH_MAX_CAMERAS, XCAM_RETURN_ERROR_PARAM, + ERROR, _camera_num && _camera_num <= XCAM_STITCH_MAX_CAMERAS, XCAM_RETURN_ERROR_PARAM, "stitcher: camera num was not set, or camera num(%d) exceed max camera value(%d)", _camera_num, XCAM_STITCH_MAX_CAMERAS); ++++++ 0001-gl-stitch_support_EGL_initialize_by_GBM.patch ++++++ >From b40c249bcfbf85da66fba416c6480d5ac6ff2ecb Mon Sep 17 00:00:00 2001 From: Zong Wei <[email protected]> Date: Thu, 11 Mar 2021 16:28:35 +0800 Subject: [PATCH] gl-stitch: support EGL initialize by GBM * allow gles program to run without requiring a window system --- configure.ac | 2 ++ modules/gles/Makefile.am | 4 +++ modules/gles/egl/egl_base.cpp | 49 ++++++++++++++++++++++++++++++++--- modules/gles/egl/egl_base.h | 12 ++++++++- tests/test-surround-view.cpp | 25 ++++++++++++++---- 5 files changed, 83 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 0e80aab9..0319a700 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,7 @@ XCAM_ARG_ENABLE(json, --enable-json, enable_json, no, enable camera calibration XCAM_CHECK_MODULE($enable_drm, libdrm, LIBDRM, HAVE_LIBDRM=1, HAVE_LIBDRM=0) XCAM_CHECK_MODULE($enable_libcl, OpenCL, LIBCL, HAVE_LIBCL=1, HAVE_LIBCL=0) XCAM_CHECK_MODULE($enable_gles, gl, LIBGL, HAVE_GLES=1, HAVE_GLES=0) +XCAM_CHECK_MODULE($enable_gles, gbm, LIBGBM, HAVE_GBM=1, HAVE_GBM=0) XCAM_CHECK_MODULE($enable_vulkan, vulkan, LIBVULKAN, HAVE_VULKAN=1, HAVE_VULKAN=0) XCAM_CHECK_GAWK($HAVE_LIBCL, $HAVE_GLES) @@ -109,6 +110,7 @@ XCAM_DEFINE_MACOR(ENABLE_PROFILING, $ENABLE_PROFILING, enable profiling) XCAM_DEFINE_MACOR(HAVE_LIBDRM, $HAVE_LIBDRM, have libdrm) XCAM_DEFINE_MACOR(HAVE_LIBCL, $HAVE_LIBCL, have libcl) XCAM_DEFINE_MACOR(HAVE_GLES, $HAVE_GLES, have gles) +XCAM_DEFINE_MACOR(HAVE_GBM, $HAVE_GBM, have gbm) XCAM_DEFINE_MACOR(HAVE_VULKAN, $HAVE_VULKAN, have vulkan) XCAM_DEFINE_MACOR(ENABLE_AVX512, $ENABLE_AVX512, have avx instruction) XCAM_DEFINE_MACOR(ENABLE_RENDER, $ENABLE_RENDER, enable texture render) diff --git a/modules/gles/Makefile.am b/modules/gles/Makefile.am index 2c6acd43..5bc05904 100644 --- a/modules/gles/Makefile.am +++ b/modules/gles/Makefile.am @@ -17,6 +17,10 @@ if HAVE_OPENCV XCAM_GLES_LIBS += $(top_builddir)/modules/ocv/libxcam_ocv.la endif +if HAVE_GBM +XCAM_GLES_LIBS += $(LIBGL_LIBS) -lgbm +endif + xcam_gles_sources = \ gles_std.cpp \ gl_buffer.cpp \ diff --git a/modules/gles/egl/egl_base.cpp b/modules/gles/egl/egl_base.cpp index 694ac54b..835e0c52 100644 --- a/modules/gles/egl/egl_base.cpp +++ b/modules/gles/egl/egl_base.cpp @@ -26,6 +26,10 @@ EGLBase::EGLBase () : _display (EGL_NO_DISPLAY) , _context (EGL_NO_CONTEXT) , _surface (EGL_NO_SURFACE) +#if HAVE_GBM + , _node_name (NULL) + , _gbm_device (NULL) +#endif { } @@ -47,11 +51,19 @@ EGLBase::~EGLBase () } } + bool -EGLBase::init () +EGLBase::init (const char* node_name) { - bool ret = get_display (EGL_DEFAULT_DISPLAY, _display); - XCAM_FAIL_RETURN (ERROR, ret, false, "EGLInit: get display failed"); + bool ret = false; + if (NULL != node_name) { + XCAM_LOG_DEBUG ("EGL init: %s", node_name); + ret = get_display (node_name, _display); + XCAM_FAIL_RETURN (ERROR, ret, false, "EGLInit: get display failed"); + } else { + ret = get_display (EGL_DEFAULT_DISPLAY, _display); + XCAM_FAIL_RETURN (ERROR, ret, false, "EGLInit: get display failed"); + } EGLint major, minor; ret = initialize (_display, &major, &minor); @@ -74,6 +86,37 @@ EGLBase::init () return true; } +bool +EGLBase::get_display (const char *node_name, EGLDisplay &display) +{ +#if HAVE_GBM + if (!node_name) { + XCAM_LOG_ERROR ("get disply device node name is NULL!"); + return false; + } + _node_name = strndup (node_name, XCAM_MAX_STR_SIZE); + + int32_t fd = open (_node_name, O_RDWR); + XCAM_FAIL_RETURN (ERROR, fd > 0, false, "EGLInit: EGL open device node:%s failed", _node_name); + + _gbm_device = gbm_create_device (fd); + XCAM_FAIL_RETURN (ERROR, _gbm_device != NULL, false, "EGLInit: EGL create gbm device failed"); + + display = eglGetPlatformDisplay (EGL_PLATFORM_GBM_MESA, _gbm_device, NULL); + XCAM_FAIL_RETURN ( + ERROR, display != EGL_NO_DISPLAY, false, + "EGLInit: get display failed"); + return true; +#else + XCAM_UNUSED (node_name); + display = eglGetDisplay (EGL_DEFAULT_DISPLAY); + XCAM_FAIL_RETURN ( + ERROR, display != EGL_NO_DISPLAY, false, + "EGLInit: get display failed"); + return true; +#endif +} + bool EGLBase::get_display (NativeDisplayType native_display, EGLDisplay &display) { diff --git a/modules/gles/egl/egl_base.h b/modules/gles/egl/egl_base.h index baa9a10c..152aa53c 100644 --- a/modules/gles/egl/egl_base.h +++ b/modules/gles/egl/egl_base.h @@ -23,6 +23,11 @@ #include <gles/egl/egl_utils.h> +#if HAVE_GBM +#include <gbm.h> +#include <fcntl.h> +#endif + namespace XCam { class EGLBase { @@ -30,8 +35,9 @@ class EGLBase { explicit EGLBase (); ~EGLBase (); - bool init (); + bool init (const char* node_name = NULL); + bool get_display (const char *node_name, EGLDisplay &display); bool get_display (NativeDisplayType native_display, EGLDisplay &display); bool initialize (EGLDisplay display, EGLint *major, EGLint *minor); bool choose_config ( @@ -54,6 +60,10 @@ class EGLBase { EGLDisplay _display; EGLContext _context; EGLSurface _surface; +#if HAVE_GBM + char *_node_name; + gbm_device *_gbm_device; +#endif }; } diff --git a/tests/test-surround-view.cpp b/tests/test-surround-view.cpp index cf378525..8bd0ae13 100644 --- a/tests/test-surround-view.cpp +++ b/tests/test-surround-view.cpp @@ -526,6 +526,7 @@ int main (int argc, char *argv[]) CamModel cam_model = CamB4C1080P; FrameMode frame_mode = FrameMulti; SVModule module = SVModuleNone; + const char* device_node = NULL; GeoMapScaleMode scale_mode = ScaleSingleConst; FeatureMatchMode fm_mode = FMNone; FisheyeDewarpMode dewarp_mode = DewarpBowl; @@ -545,6 +546,7 @@ int main (int argc, char *argv[]) const struct option long_opts[] = { {"module", required_argument, NULL, 'm'}, + {"device-node", required_argument, NULL, 'D'}, {"input", required_argument, NULL, 'i'}, {"output", required_argument, NULL, 'o'}, {"in-w", required_argument, NULL, 'w'}, @@ -591,6 +593,11 @@ int main (int argc, char *argv[]) return -1; } break; + case 'D': + XCAM_ASSERT (optarg); + device_node = optarg; + break; + case 'i': XCAM_ASSERT (optarg); PUSH_STREAM (SVStream, ins, optarg); @@ -785,6 +792,12 @@ int main (int argc, char *argv[]) for (uint32_t i = 0; i < ins.size (); ++i) { printf ("input%d file:\t\t%s\n", i, ins[i]->get_file_name ()); } + printf ("camera model:\t\t%s\n", cam_model == CamA2C1080P ? "cama2c1080p" : + (cam_model == CamB4C1080P ? "camb4c1080p" : (cam_model == CamC3C8K ? "camc3c8k" : "camd3c8k"))); + printf ("fisheye number:\t\t%d\n", fisheye_num); + printf ("stitch module:\t\t%s\n", module == SVModuleGLES ? "GLES" : + (module == SVModuleVulkan ? "Vulkan" : (module == SVModuleSoft ? "Soft" : "Unknown"))); + printf ("device node:\t\t%s\n", device_node != NULL ? device_node : "Not specified, use default model"); printf ("output file:\t\t%s\n", outs[IdxStitch]->get_file_name ()); printf ("input width:\t\t%d\n", input_width); printf ("input height:\t\t%d\n", input_height); @@ -793,9 +806,6 @@ int main (int argc, char *argv[]) printf ("topview width:\t\t%d\n", topview_width); printf ("topview height:\t\t%d\n", topview_height); printf ("input format:\t\t%s\n", input_format == V4L2_PIX_FMT_YUV420 ? "yuv" : "nv12"); - printf ("fisheye number:\t\t%d\n", fisheye_num); - printf ("camera model:\t\t%s\n", cam_model == CamA2C1080P ? "cama2c1080p" : - (cam_model == CamB4C1080P ? "camb4c1080p" : (cam_model == CamC3C8K ? "camc3c8k" : "camd3c8k"))); printf ("blend pyr levels:\t%d\n", blend_pyr_levels); printf ("dewarp mode: \t\t%s\n", dewarp_mode == DewarpSphere ? "sphere" : "bowl"); printf ("scopic mode:\t\t%s\n", (scopic_mode == ScopicMono) ? "mono" : @@ -825,7 +835,12 @@ int main (int argc, char *argv[]) egl = new EGLBase (); XCAM_ASSERT (egl.ptr ()); - XCAM_FAIL_RETURN (ERROR, egl->init (), -1, "init EGL failed"); + + if (NULL == device_node) { + XCAM_FAIL_RETURN (ERROR, egl->init (), -1, "init EGL failed"); + } else { + XCAM_FAIL_RETURN (ERROR, egl->init (device_node), -1, "init EGL failed"); + } } #else if (module == SVModuleGLES) { @@ -856,7 +871,7 @@ int main (int argc, char *argv[]) #if ENABLE_FISHEYE_IMG_ROI if (module == SVModuleGLES && (cam_model == CamC3C8K || cam_model == CamD3C8K)) { StitchInfo info = (module == SVModuleSoft) ? - soft_stitch_info (cam_model, scopic_mode) : gl_stitch_info (cam_model, scopic_mode); + soft_stitch_info (cam_model, scopic_mode) : gl_stitch_info (cam_model, scopic_mode); get_fisheye_info (cam_model, scopic_mode, info.fisheye_info); ++++++ 0001-pkg_config_check_opencv_module_version.patch ++++++ >From ea99d89082c2473c2e22c848bff4f9f537af3fde Mon Sep 17 00:00:00 2001 From: Zong Wei <[email protected]> Date: Mon, 25 Oct 2021 15:52:32 +0800 Subject: [PATCH] pkg-config: check opencv module version --- m4/xcam-utils.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/m4/xcam-utils.m4 b/m4/xcam-utils.m4 index a93c45c6..236fdda8 100644 --- a/m4/xcam-utils.m4 +++ b/m4/xcam-utils.m4 @@ -62,6 +62,7 @@ AC_DEFUN([XCAM_CHECK_OPENCV], [ ocv_version=`opencv_version` AS_IF([test -z $ocv_version], [ocv_version=`$PKG_CONFIG --modversion opencv`]) + AS_IF([test -z $ocv_version], [ocv_version=`$PKG_CONFIG --modversion opencv4`]) AC_MSG_NOTICE(OpenCV version: $ocv_version) ocv_module=opencv
