Skip to content

Latest commit

 

History

History
112 lines (95 loc) · 3.26 KB

README.md

File metadata and controls

112 lines (95 loc) · 3.26 KB

Integrate OpenCV to Open Harmony4.1_release

Pre-requisite:rk3568, OpenHarmony4.1 standard system,Compile on Ubuntu20.04 LTS

Current configuration only support OH in 32 bit!!!

  1. Download OpenCV Library

Link:OpenHarmony-SIG/third_party_opencv

  1. Add the library to the third_party directory

Put opencv under the third_party directory. Keep cautious about the directory name!

Modify vendor/hihope/RK3568/config.json. Add new component, opncv, under thirdparty subsystem and its corresponding information.

{
      "subsystem": "thirdparty",
      "components": [
        {
          "component": "libuv",
          "features": [
            "use_ffrt = true"
          ]
        },
        {
          "component": "wpa_supplicant",
          "features": [
            "wpa_supplicant_driver_nl80211 = true"
          ]
        },
        {
          "component": "opencv",
          "features":[]
        }
      ]
    },
  1. Compile the code

Compile tutorial: Tutorial

  1. Debugging

Bug1

Exception: //third_party/opencv/3rdparty/ffmpeg/libavcodec:opencv_ffmpeg_avcodec depend part //third_party/opencv/3rdparty/ffmpeg/libavutil:libopencv_avutil, need set part deps opencv info to /home/hzk/Documents/OH4.1/OpenHarmony-v4.1-Release/OpenHarmony/build/bundle.json.

Solution: modify the build/bundle.json

 "deps": {
      "components": [],
        "third_party": [
        "musl",
        "markupsafe",
        "jinja2",
        "e2fsprogs",
        "f2fs-tools",
        "opencv"
      ]
    },
    "build": {
      "sub_component": [
        "//build/common:common_packages",
        "//build/rust:default",
        "//third_party/f2fs-tools:f2fs-tools_host_toolchain",
        "//third_party/opencv/3rdparty/ffmpeg/libavutil:libopencv_avutil",
        "//third_party/opencv/3rdparty/ffmpeg/libswresample:libopencv_swresample"
      ],
    }

Bug2

[OHOS ERROR] Exception: //third_party/opencv/napi:opencv_napi depend part //third_party/bounds_checking_function:libsec_static, need set part deps bounds_checking_function info to /home/hzk/Documents/OH4.1/OpenHarmony-v4.1-Release/OpenHarmony/third_party/opencv/bundle.json.

Solution:add bounds_checking_functionand libuv to 'opencv/bundle.json', clear the derivative path in 'third_party' section

"deps": {
        "components": [
            "ability_base",
            "ability_runtime",
            "access_token",
            "bundle_framework",
            "c_utils",
            "certificate_manager",
            "common_event_service",
            "hisysevent",
            "hilog",
            "huks",
            "ipc",
            "napi",
            "netmanager_base",
            "safwk",
            "samgr",
            "data_share",
            "hdf_core",
            "hicollie",
            "relational_store",
            "bounds_checking_function",
            "libuv"
        ],
        "third_party": [
            "bounds_checking_function",
            "libuv"
        ]
      },

For details and mandarian tutorial, please refer to my blog on csdn.