将Android与Halcon集成

时间:2016-04-08 16:44:31

标签: android android-ndk

我想将Android NDK与Halcon集成。

我尝试使用libs(头文件)来唤起Halcon方法。

例如:

#include <jni.h>
#include "com_example_joseubuntu_integrationhalcon_MainActivity.h"
#  include "HALCONCpp/HalconCpp.h"
#  include "HALCONCpp/HDevThread.h"

using namespace HalconCpp;

JNIEXPORT void JNICALL Java_com_example_joseubuntu_integrationhalcon_MainActivity_testFunction(JNIEnv * env, jobject obj)
{

    HTuple  hv_BarCodeHandle;

    HTuple  hv_DecodedDataStrings;

    HObject  ho_Image,ho_SymbolRegions;

    CreateBarCodeModel(HTuple(), HTuple(), &hv_BarCodeHandle);

    SetBarCodeParam(hv_BarCodeHandle, "stop_after_result_num", 1);

    ReadImage(&ho_Image, "/res/drawable/codebar");

    FindBarCode(ho_Image, &ho_SymbolRegions, hv_BarCodeHandle, "EAN-13", &hv_DecodedDataStrings);

    WriteImage(ho_SymbolRegions, "png", "0xffff00", "Teste.png");

}

是一个读取barCodes的简单示例,我不知道这是否有效,因为我有这个错误:

Error:error: undefined reference to 'HalconCpp::HTuple::~HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple(char const*)'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::~HTuple()'
Error:error: undefined reference to 'HalconCpp::HObjectBase::HObjectBase()'
Error:error: undefined reference to 'HalconCpp::CreateBarCodeModel(HalconCpp::HTuple const&, HalconCpp::HTuple const&, HalconCpp::HTuple*)'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::~HTuple()'
Error:error: undefined reference to 'HalconCpp::SetBarCodeParam(HalconCpp::HTuple const&, HalconCpp::HTuple const&, HalconCpp::HTuple const&)'
Error:error: undefined reference to 'HalconCpp::HObjectBase::HObjectBase()'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple(int)'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::~HTuple()'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple(char const*)'
Error:error: undefined reference to 'HalconCpp::ReadImage(HalconCpp::HObject*, HalconCpp::HTuple const&)'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple(char const*)'
Error:error: undefined reference to 'HalconCpp::FindBarCode(HalconCpp::HObject const&, HalconCpp::HObject*, HalconCpp::HTuple const&, HalconCpp::HTuple const&, HalconCpp::HTuple*)'
Error:error: undefined reference to 'HalconCpp::HTuple::HTuple(char const*)'
Error:error: undefined reference to 'HalconCpp::WriteImage(HalconCpp::HObject const&, HalconCpp::HTuple const&, HalconCpp::HTuple const&, HalconCpp::HTuple const&)'
Error:error: undefined reference to 'HalconCpp::HObjectBase::~HObjectBase()'
Error:error: undefined reference to 'HalconCpp::HObjectBase::~HObjectBase()'

谢谢!

1 个答案:

答案 0 :(得分:0)

你有android的halcon库吗?

如果您使用的库不适用于Android,则无法使用。

如果你有android的库,你应该在Android.mk中导入so库,如下所示:

include $(CLEAR_VARS)

LOCAL_MODULE := libhalcon

LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libhalcon.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libhalconcpp

LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libhalconcpp.so

include $(PREBUILT_SHARED_LIBRARY)