Search Unity

[RELEASED] OpenCV ObjectDetector

Discussion in 'Assets and Asset Store' started by EnoxSoftware, Oct 29, 2014.

  1. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    OpenCV ObjectDetector
    http://u3d.as/content/enox-software/open-cv-object-detector

    big_precise.png




    Requires Unity 4.5.5 or higher.

    [NEW] Support for Unity5


    Works with Unity Free & Pro
    iOS
    & Android support
    Win & Mac Standalone support
    Support for preview in the Editor

    More advanced OpenCV Asset is published.Please check OpenCV for Unity.


    OpenCV ObjectDetector can detect(Sync or Async) an object from Texture2D using OpenCV.
    SampleCode | Demo Application(FaceDetection) | Tutorial & Demo Video(Unity4 Unity5) | Forum

    e-mail
    enox.software@gmail.com



    Features:
    • You can get a processing result of detectMultiScale() of OpenCV using cascade file that you specified.
    • Object detection parameters (same as the parameters of detectMultiScale()) can be set in JSON format, You can get in JSON format Object detection result.


    Overview of the method call steps:
    1. LoadCascade (string filename)
    2. AddObjectDetectorParam (string param)
    3. Detect (Texture2D texture, string callbackGameObjectName, string callbackMethodName)


    System Requirements:
    Build Win Standalone & Preview Editor : Windows7 or later
    Build Mac Standalone & Preview Editor : OSX 10.8 or later


    Release Notes:
    1.1.9

    [iOS]Fixed libopencvobjectdetector.a Bitcode Setting.
    1.1.8
    [iOS]Enabled Bitcode.
    1.1.7
    [Common] Fixed the bug that occurs in the editor.
    1.1.6
    [iOS]Move “OpenCVObjectDetector/ iOSforXcode/opencv2.framework”to “OpenCVObjectDetector/Plugins/iOS/”folder.
    1.1.5
    [Common]Add SampleScene Setup Tutorial Video for Unity5.
    1.1.4
    [Common]Add OpenCVObjectDetectorMenuItem.cs.( This script set plugin import settings automatically from MenuItem.)
    [iOS]Move “OpenCVObjectDetector/ iOSforXcode/iOS_BuildPostprocessor.cs” to “OpenCVObjectDetector/Editor”folder.
    1.1.3
    [Common]Update to OpenCV2.4.11
    1.1.2
    [Common]Divide asset for Unity4 and Unity5.
    1.1.1
    [Common]Support for Unity5.
    1.1.0
    [Common]Update to OpenCV2.4.10
    1.0.9
    [iOS]Support for arm64 build target.(Unity 4.6.1p3 or higher)
    1.0.8
    [Android]Support for x86 build target.(Unity 4.6 or higher)
    1.0.7
    [Common]Update SampleScene(Process of converting results of object detection to the 3D position).
    1.0.6
    [Common]Support for preview in the Editor.(Pro only)
    [Common]Support for Win & Mac Standalone.(Pro only)
    [Android]Change of location of the cascade file.Changed to use“Aseets/StreamingAssets/” folder.
    [iOS] Add the cascade file to Xcode project is no longer required.Changed to use“Aseets/StreamingAssets/” folder.
     
    Last edited: Feb 18, 2016
  2. thed-venth

    thed-venth

    Joined:
    Aug 13, 2014
    Posts:
    7
    is this compatible with web player build?
     
  3. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    This asset is not compatible to the WebPlayer.

    http://docs.unity3d.com/Manual/Plugins.html
    Note: On the desktop platforms, plugins are a pro-only feature. For security reasons, plugins are not usable with webplayers.
     
  4. thed-venth

    thed-venth

    Joined:
    Aug 13, 2014
    Posts:
    7
    ok, thanks for the answer :)

    by the way, is there any way to do face tracking in web player
    I'm already stuck on this for weeks
     
  5. Yasuhiko-Nakashima

    Yasuhiko-Nakashima

    Joined:
    Aug 22, 2014
    Posts:
    8
    i use Unity 4.5.5p1 and XCode 5.1.1 or 6.1.
    export xcode project, then add opencv2.framework.
    but build failed, have Linker Error.

    ld: warning: directory not found for option '-F/Users/me/Fukui/Assets/OpenCVObjectDetector/iOS'

    ld: warning: directory not found for option '-Ffor'

    ld: warning: directory not found for option '-FXcode'

    Undefined symbols for architecture armv7:

    "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:

    std::__1::vector<int, std::__1::allocator<int> >::__append(unsigned long) in opencv2(histogram.o)

    std::__1::vector<cv::Vec<int, 128>, std::__1::allocator<cv::Vec<int, 128> > >::__append(unsigned long) in opencv2(matrix.o)

    std::__1::vector<cv::Vec<int, 64>, std::__1::allocator<cv::Vec<int, 64> > >::__append(unsigned long) in opencv2(matrix.o)

    std::__1::vector<cv::Vec<int, 32>, std::__1::allocator<cv::Vec<int, 32> > >::__append(unsigned long) in opencv2(matrix.o)

    std::__1::vector<cv::Vec<int, 16>, std::__1::allocator<cv::Vec<int, 16> > >::__append(unsigned long) in opencv2(matrix.o)

    std::__1::vector<cv::Vec<int, 12>, std::__1::allocator<cv::Vec<int, 12> > >::__append(unsigned long) in opencv2(matrix.o)

    std::__1::vector<cv::Vec<int, 9>, std::__1::allocator<cv::Vec<int, 9> > >::__append(unsigned long) in opencv2(matrix.o)

    ...

    "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:

    _OpenCVObjectDetector_Detect in libopencvobjectdetector.a(opencvobjectdetector.o)

    _DetectThread in libopencvobjectdetector.a(opencvobjectdetector.o)

    "cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:

    _OpenCVObjectDetector_Detect in libopencvobjectdetector.a(opencvobjectdetector.o)

    _DetectThread in libopencvobjectdetector.a(opencvobjectdetector.o)

    "cv::CascadeClassifier::CascadeClassifier(std::string const&)", referenced from:

    _OpenCVObjectDetector_LoadCascade in libopencvobjectdetector.a(opencvobjectdetector.o)

    ld: symbol(s) not found for architecture armv7

    clang: error: linker command failed with exit code 1 (use -v to see invocation)
     
  6. Yasuhiko-Nakashima

    Yasuhiko-Nakashima

    Joined:
    Aug 22, 2014
    Posts:
    8
    Sorry.
    I was able to fix it myself.
     
  7. adre

    adre

    Joined:
    Mar 28, 2014
    Posts:
    37
    Hello,
    is it possibile to have a mouth+eyes detection on a webtexture playing?
     
  8. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    This asset can detect the object from only Texture2D.
    You can use the ”OpenCV for Unity”, which is a more advanced asset, you can real-time detect the object from WebCamTexture.
    https://www.assetstore.unity3d.com/en/#!/content/21088
     
  9. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.0.7

    Version changes
    1.0.7
    [Common]Update SampleScene(Process of converting results of object detection to the 3D position).
     
  10. phucbac

    phucbac

    Joined:
    Dec 25, 2014
    Posts:
    1
    Help me!
    i use Unity 4.5.5p1 and XCode 6.1.1 and OS X Yosemte version 10.10.1
    when i export xcode project. i have add lib: opencv2.framework.
    but build failed, have Linker Error.
    Undefined symbols for architecture i386:

    "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:

    _OpenCVObjectDetector_Detect in libopencvobjectdetector.a(opencvobjectdetector.o)

    _DetectThread in libopencvobjectdetector.a(opencvobjectdetector.o)

    "cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:

    _OpenCVObjectDetector_Detect in libopencvobjectdetector.a(opencvobjectdetector.o)

    _DetectThread in libopencvobjectdetector.a(opencvobjectdetector.o)

    "cv::CascadeClassifier::CascadeClassifier(std::string const&)", referenced from:

    _OpenCVObjectDetector_LoadCascade in libopencvobjectdetector.a(opencvobjectdetector.o)

    "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:

    _cvCalcArrHist in opencv2(histogram.o)

    _cvCalcArrBackProject in opencv2(histogram.o)

    std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::__append(unsigned long) in opencv2(histogram.o)

    std::__1::vector<double, std::__1::allocator<double> >::__append(unsigned long) in opencv2(histogram.o)

    std::__1::vector<int, std::__1::allocator<int> >::__append(unsigned long) in opencv2(histogram.o)

    std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >::__append(unsigned long) in opencv2(histogram.o)

    cv::SparseMat::resizeHashTab(unsigned long) in opencv2(matrix.o)

    ...

    "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:

    std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in opencv2(ocl.o)

    "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned char) in opencv2(ocl.o)

    "std::__1::ios_base::getloc() const", referenced from:

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned char) in opencv2(ocl.o)

    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:

    std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::eek:verflow(int) in opencv2(ocl.o)

    std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(ocl.o)

    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:

    std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::eek:verflow(int) in opencv2(ocl.o)

    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:

    cv::eek:cl::kernelToStr(cv::_InputArray const&, int, char const*) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<int>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<float>(cv::Mat const&) in opencv2(ocl.o)

    ...

    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::eek:perator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:

    std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned char) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in opencv2(ocl.o)

    std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::eek:perator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned char) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:

    construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:

    construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<int>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<float>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<double>(cv::Mat const&) in opencv2(ocl.o)

    ...

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::eek:perator<<(double)", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<double>(cv::Mat const&) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::eek:perator<<(float)", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<float>(cv::Mat const&) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::eek:perator<<(int)", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<short>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<int>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<float>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<double>(cv::Mat const&) in opencv2(ocl.o)

    ...

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::eek:perator<<(short)", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<short>(cv::Mat const&) in opencv2(ocl.o)

    "std::__1::basic_ostream<char, std::__1::char_traits<char> >::eek:perator<<(unsigned short)", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned short>(cv::Mat const&) in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::setbuf(char*, int)", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsgetn(char*, int)", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, int)", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::showmanyc()", referenced from:

    vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(ocl.o)

    "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<unsigned char>(cv::Mat const&) in opencv2(ocl.o)

    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::eek:cl::kerToStr<char>(cv::Mat const&) in opencv2(ocl.o)
     
    Last edited: Dec 25, 2014
  11. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    I was also verified in the same environment(Unity 4.5.5p1, XCode 6.1.1, OS X Yosemte 10.10.1), but the problem in the build did not occur.
    opencv2.framework might not have been correctly added.
     
  12. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.0.8

    Version changes
    1.0.8
    [Android]Support for x86 build target.(Unity 4.6 or higher)
     
  13. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
  14. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.0.9

    Version changes
    1.0.9
    [iOS]Support for arm64 build target.(Unity 4.6.1p3 or higher)
     
  15. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.0

    Version changes
    1.1.0
    [Common]Update to OpenCV2.4.10
     
  16. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    "OpenCV ObjectDetector 1.1.1(Support for Unity5)" is in pending review now in AssetStore.
    I think that it is approved a few days later.

    As for the current version1.1.0, only Android and Win and Mac support Unity5.
    But, iOS does not support.
    If you do not use iOS, there is not the problem with upgrading.
     
  17. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.1

    Version changes
    1.1.1
    [Common]Support for Unity5.
     
  18. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.2

    Version changes
    1.1.2
    [Common]Divide asset for Unity4 and Unity5.
     
  19. 128bit

    128bit

    Joined:
    Oct 8, 2014
    Posts:
    117
    Hey,
    when using the Object Detector, is it possible to get the detected part of the texture into a new texture?
    For example, look at this screen:

    So that the detected face, which is marked blue, gets read into a new texture which just contains the part marked by your plugin?

    Thanks in advance
     
  20. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Please use the Texture2D.GetPixels() and Texture2D.SetPixels().
    Code (CSharp):
    1. /// <summary>
    2.         /// Simples the faces detect callback.
    3.         /// </summary>
    4.         /// <param name="result">Result.</param>
    5.         void SimpleFacesDetectCallback (string result)
    6.         {
    7.                 Debug.Log ("SimpleFacesDetectCallback result" + result);
    8.  
    9.                 string json = result;
    10.        
    11.                 IDictionary detects = (IDictionary)Json.Deserialize (json);
    12.        
    13.                 foreach (DictionaryEntry detect in detects) {
    14.                         Debug.Log ("detects key " + detect.Key);
    15.            
    16.                         string key = (string)detect.Key;
    17.            
    18.                         if (key.Equals ("error")) {
    19.                                 Debug.Log ((string)detects [detect.Key]);
    20.                         } else {
    21.                
    22.                                 IList<object> rects = (IList<object>)detects [detect.Key];
    23.  
    24.  
    25.                                 //flip Rects by convenient method,
    26.                                 IList<object> flipRects = OpenCVObjectDetector.FlipRects (rects, ((Texture2D)GetComponent<Renderer> ().material.mainTexture).width, ((Texture2D)GetComponent<Renderer> ().material.mainTexture).height, 0);
    27.  
    28.                                 Texture2D baseTexture = (Texture2D)GetComponent<Renderer> ().material.mainTexture;
    29.                
    30.                                 foreach (IDictionary rect in flipRects) {
    31.                                         Texture2D newTexture = new Texture2D ((int)((long)rect ["width"]), (int)((long)rect ["height"]), TextureFormat.RGBA32, false);
    32.                                         newTexture.SetPixels (baseTexture.GetPixels ((int)((long)rect ["x"]), (int)((long)rect ["y"]), (int)((long)rect ["width"]), (int)((long)rect ["height"])));
    33.                                         newTexture.Apply ();
    34.                    
    35.                    
    36.                                         gameObject.GetComponent<Renderer> ().material.mainTexture = newTexture;
    37.                                 }
    38.  
    39.  
    40. //                                #if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IPHONE) && !UNITY_EDITOR) || !(UNITY_4_5 || UNITY_4_6)
    41. //                                OpenCVObjectDetector.DrawRects ((Texture2D)GetComponent<Renderer> ().material.mainTexture, Json.Serialize (flipRects), 0, 0, 255, 2);
    42. //                                #endif
    43. //
    44. //
    45. //                                ResultRectsToResultGameObjects (flipRects, new Color (0.0f, 0.0f, 1.0f, 0.3f), -40);
    46.                                
    47.                         }
    48.                 }
    49.         }
     
  21. 128bit

    128bit

    Joined:
    Oct 8, 2014
    Posts:
    117
    Thanks, got it working awesome. Now il just have the problem that i can only detect from textures integrated in the app. Since texture needs to me read/write enabled in the inspector. Is there a way around it? So i can define an texture 2d in runtime and use it with OpenCV Object Detector?
     
  22. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Since Texture2D that are generated from the code read and write is enabled, you can use in OpenCV Object Detector.
     
  23. LucasTejero

    LucasTejero

    Joined:
    Oct 3, 2013
    Posts:
    3
    Hello,first of all GREAT PLUGIN!,but i can see the rects in the editor im on mac osx 10.10.3 with unity 5.0.1,i trace the "bug" and see that the plugin never enter in the callback,thank you in advance
     
  24. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.3

    Version changes
    1.1.3
    [Common]Update to OpenCV2.4.11.
     
  25. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.4

    Version changes
    1.1.4
    [Common]Add OpenCVObjectDetectorMenuItem.cs.( This script set plugin import settings automatically from MenuItem.)
    [iOS]Move “OpenCVObjectDetector/ iOSforXcode/iOS_BuildPostprocessor.cs” to “OpenCVObjectDetector/Editor”folder.
     
  26. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.5

    Version changes
    1.1.5
    [Common]Add SampleScene Setup Tutorial Video for Unity5.
     
  27. MalcolmWashington

    MalcolmWashington

    Joined:
    Jul 16, 2015
    Posts:
    12
    ıt doesnt draw !!!!!!!!!!


    ı put picture. where is the mistake ?
     

    Attached Files:

  28. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    There is a possibility that the loading of xml file in the StreamingAssets folder has failed.
    In Windows7, when I change the position of the project folder, there was a case to work well.

    Please tell me the OS you are using.
     
  29. troyfury

    troyfury

    Joined:
    May 15, 2015
    Posts:
    19
    Hi great plugin, however, using the ObjectDetectSample script provided and a Texture2d I am creating from webcam, the ResultCube seems to be instantiated in the wrong place, as in it is far from the image renderer not where the 2Dmarker shows up. Any suggestions as to why this might be happening?
     
  30. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Is the scale of Quad(GameObject) set to size of Texture2D?
     
  31. troyfury

    troyfury

    Joined:
    May 15, 2015
    Posts:
    19
    I think the problem is that the Quad was a child of another object, thus its scale was being affected by its parent's scale.
     
  32. livenets

    livenets

    Joined:
    Sep 21, 2015
    Posts:
    1
    Hi!
    This plugin will be working with Android camera?
    Thanks for answer.
    Dmitry.
     
  33. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Hi.
    I tried your face detect and it works perfectly, thanks.

    I have a question, could you answer me please?
    I get a cascade xml for detecting hand. Can I use it in the way you use your face cascade?
     
  34. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    This asset supports only the detection of the object from Texture2D.
     
  35. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    ”OpenCVObjectDetector” is available with any cascade file.
     
  36. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Hi. Thanks for reply. Could you please answer 1 more question please...

    I want to use OpenCV to compare 2 images. Could it be with this asset?
     
  37. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Last edited: Nov 20, 2015
  38. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Thanks. I bought Object Detector, but "OpenCV for Unity" 's price is 95$ , i have to consider...
     
  39. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.6

    Version changes
    1.1.6
    [iOS]Move “OpenCVObjectDetector/ iOSforXcode/opencv2.framework”to “OpenCVObjectDetector/Plugins/iOS/”folder.
     
  40. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Hi

    I get a weird bug when using it!

    When run it on 1 scene, it works perfectly. But every time i change scene, the call back not run! Until I restart Unity.

    Could you help me please!
     
  41. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    It even happen to your sample scene, when I switch to license scene then come back
     
  42. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Thank you very much for your attention.

    As you said,This bug seems to happen at run time in the Editor.
    To fix the problem, please fix the code as follows.

    OnDisable() in OpenCVObjectDetector/Loom.cs
    Code (CSharp):
    1.     void OnDisable()
    2.     {
    3.         if (_current == this)
    4.         {
    5.          
    6.             _current = null;
    7.             initialized = false; // Insert this line.
    8.         }
    9.     }
    I'm going to release a bug fix version as soon as possible.
     
    NKidd likes this.
  43. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Ah, thanks :)
     
  44. NKidd

    NKidd

    Joined:
    Sep 16, 2015
    Posts:
    22
    Edited: Now it work when run plugin's tool Set Plugins Import Setting after import Admob. Note for anyone get same problem!

    Sorry for any convenience, but I have a new problem!

    When I get everything works fine, I integrate Admob plugin into the app. It still work fine on Editor, but cannot detect face on real Android phone.

    Here is the Admob plugin i used: https://github.com/googleads/googleads-mobile-unity/tree/master/unity
    It create something in Plugins/Android folder, with GoogleMobileAdsPlugin and google-play-services_lib as Android native plugins. Do them conflict with your plugins?

    Thanks
     
    Last edited: Dec 1, 2015
  45. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.7

    Version changes
    1.1.7
    [Common] Fixed the bug that occurs in the editor.
     
  46. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    385
    Hi there, I am interested in this plugin but I am just wondering how much weight it will add (roughly) to my app? Does it need the full 95 meg? Are there any strategies for reducing the size to the barest minimum necessary for just detecting faces? Or is this the smallest it can be using OpenCv?
     
  47. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    385
    Actually I saw there was a demo app that was 27 meg or so... thats better, but basically that is my target size for my entire app, is there anything that can be done to bring this down? Maybe some way of stripping stuff from OpenCV, doing a custom build of it or something, compressing the XML files etc etc
     
  48. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Unfortunately, there is no way to reduce the build size at present.
     
  49. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    385
    I feel you, its definately tricky. I am trying to do something at present, by converting things like trackingjs or liuliu's ccvjs to C#. These are teeny tiny little things that do what OpenCVObjectDetector does but with out the monolithic bulk, trackingjs is not that great but ccv seems pretty flawless (but it only detects faces, not eyes/nose/mouth)... If you'd be interested in collaborating on this PLEASE get in touch, I think a light weight face reco system could go barnstormers on the asset store, particularly with all the AR/VR stuff coming our way in 2016...
     
  50. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,141
    Released Version 1.1.8

    Version changes
    1.1.8
    [iOS]Enabled Bitcode.