无法在opencv 3.3rc上为android创建find_package(Opencv):

时间:2017-07-13 08:05:09

标签: opencv android-ndk

我正在尝试集成新的Opencv3.3rc标记以使用OpenCV dnn模块。 https://github.com/opencv/opencv/tree/3.3.0-rc

我可以交叉编译OpenCV库,但是当我尝试使FindOpencv需要时,我有这个错误:

  

此导出集中的某些(但不是全部)目标已定义。

注册的唯一目标是 cpufeatures ,如您所见:

let profiles = [
    {
        name:"1+ Adults in Household",
        qualifiers: [
            {
                name: 'Number of adults in the household'
            }
        ]
    },
    {
      name: '75k',
      qualifiers: [
        {
          name: 'Division'
        },
        {
          name: 'Income'
        }
      ]
  },
  {
      name: 'Time Warner',
      qualifiers: [
          {
              name: 'Division'
          }
      ]
  }
];

let subscription = [
  "Cinemax Subscription", 
  "Disney Subscription", 
  "Encore Subscription", 
  "Epix Subscription", 
  "HBO Subscription", 
  "MLB Subscription", 
  "NBA Subscription", 
  "NHL Subscription", 
  "Division"
];

let profilesFiltered = profiles.filter(function (a) {
  // first filter all element in the profiles array 
  // check if their qualifiers array is not empty
  return a.qualifiers.some(function (b) {
    // filter the qualifiers array by checking the property name 
    // is it muching any element from subscription array
    return subscription.indexOf(b.name)!==-1;
  });
});

console.log(profilesFiltered);

正如我在 OpenCVconfig.cmake 配置文件中所看到的,目前有两种方法可以找到OpenCV:

这个:

  Targets Defined: cpufeatures
  Targets not yet defined:
  libtiff;libjpeg;libwebp;libjasper;libpng;IlmImf;tegra_hal;libprotobuf;opencv_core;opencv_flann;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_video;opencv_dnn;opencv_imgcodecs;opencv_shape;opencv_videoio;opencv_highgui;opencv_superres;opencv_features2d;opencv_calib3d;opencv_java;opencv_stitching;opencv_videostab

或定义模块:

find_package(OpenCV REQUIRED)

但它们都不起作用。

错误来自此代码段OpenCVModules.cmake

find_package(OpenCV REQUIRED core videoio)

有人知道这会怎么样吗?

1 个答案:

答案 0 :(得分:1)

我找到了答案:

之前我正在定义cpu-features库,所以这段代码是CMakelists.txt中的冲突部分。

add_library(cpufeatures STATIC
            ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)

删除此部分,问题解决了。