Environmental Setup - Build Errors

1,394 views
Skip to first unread message

Nicholas Cantrell

unread,
Jul 7, 2012, 3:56:28 PM7/7/12
to android...@googlegroups.com
Hello,

I just bought a new laptop and am trying to get an OpenCV development environment set up.

I'm using the SVN Trunk copy(TortoiseSVN) of OpenCV 2.4.2.
I followed this guide exactly with the latest version of the TADP and my sample project import is the point where my experience diverges from the one described in the above link.
(The trunk copy of opencv was an attempt to resolve problems with the samples that I read existed in the Sourceforge copy.)

When I go to "Clean" projects the console throws the following error:

"12:40:27 **** Build of configuration Default for project OpenCV Sample - face-detection ****
"C:\\NVPACK\\android-ndk-r8\\ndk-build.cmd" 
jni/Android.mk:8: ../../sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target `../../sdk/native/jni/OpenCV.mk'.  Stop.

12:40:29 Build Finished (took 2s.306ms)"

When I right click on the project OpenCV Sample - face-detection and look at "Properties-> Android", unlike the pictures in the guide, there is no reference to an OpenCV library in the "Is Library" box.

My research has found references to the latest ADT r14 making changes to library usage:

Laptop is a Toshiba C855 Running Windows 7 Home Premium bone-stock(TADP was literally the first thing I did to this machine after pulling it out of the box).

Thank you for any help you can provide,
Nick


Shervin Emami

unread,
Jul 8, 2012, 2:35:03 AM7/8/12
to android...@googlegroups.com
It sounds like you are having version issues or similar. The SVN folder structure is completely different to the Android Binary Package folder structure (which changes every month or 2!), so you should choose if you want to use the Binary Package (much easier, but changes structure often) or build OpenCV4Android yourself from SVN sources (in which case you should be following the Android Wiki page talking specifically about that). The tutorial you linked to is only correct for if you use Android Binary Package (hence the name of the tutorial).
-Shervin

Nicholas Cantrell

unread,
Jul 8, 2012, 9:35:17 PM7/8/12
to android...@googlegroups.com
Hi Shervin,

Thank you for your guidance. :) After switching back to the sourceforge binary package and installing the OpenCV Manager from the Android Market("Play") I was able to successfully compile and run all of the included samples on my HTC EVO 3D.

Can't thank you enough!

Cheers,
Nick

Andrey Pavlenko

unread,
Jul 9, 2012, 3:34:11 AM7/9/12
to android...@googlegroups.com
I suggest you use the binary package, not build from sources.
We'll update the OpenCV4Android Wiki on how to use it when build locally (in a word it should be built with several params to CMake and then 'make install' creates an sdk structure in 'build/install' folder)

Nicholas Cantrell

unread,
Jul 9, 2012, 4:38:52 AM7/9/12
to android...@googlegroups.com
Yes, based on the success I've had following your advice and taking that approach I think I'll be sticking with binary package for awhile.

I was wondering if you could help me with another question?

Today was the first time I've tackled trying to modify any of the samples to any significant extent. I'm trying to implement minEnclosingCircle in the color-blob-detector sample. I've spent most of my afternoon on this and am having difficulty understanding the intended data types. According to the documentation here:

It seems to be expecting vectors for center and radius output parameters? I'm having better success with a data type of "point" but with the following code:
       while (each.hasNext())
        {
        MatOfPoint contour = each.next();
        if (Imgproc.contourArea(contour) > mMinContourArea*maxArea)
        {
        Core.multiply(contour, new Scalar(4,4), contour);
        mContours.add(contour);

       //      int pt = 0;
       //        int f = 0;
       //        int j = 0;
       //        int x = 0;
       //        Mat mCircle = new Mat(); 
       //        float mRadius = 0;
         
        Point actualCenter = new Point();
         float[] radius = new float[] { 347.0f };
         Imgproc.minEnclosingCircle(contour, actualCenter, radius);
         Point truthCenter = new Point(0, 0);
         truthCenter = actualCenter;
         float truthRadius = 1.0f;
         assertEquals(truthRadius, radius[0], weakEPS);
  }
       
         Imgproc.minEnclosingCircle(contour, mCircle, mRadius);  

Eclipse is complaining:
"The method minEnclosingCircle(MatOfPoint2f, Point, float[]) in the type Imgproc is not applicable for the arguments (MatOfPoint, Point, float[])"
Trying to get me to "Change type of 'contour' to 'MatOfPoint2f" which breaks the center and radius parameter types.

I'm experimenting with code from several sources including:

Am I looking for an Array, point, and float as described by the first itseez link? If so, what variable from should I be passing from Color-Blob-Detector to minEnclosingCircle as the Input array, and is there going to be a specific syntax necessary for a type conversion?

Sorry for the long question. :/

-Nick

Andrey Pavlenko

unread,
Jul 9, 2012, 6:01:31 AM7/9/12
to android...@googlegroups.com
The function minEnclosingCircle() in C++ can process both integer and float point contours, but its Java wrapper wants float point only.
Probably we need to generate two Java function in future releases, but currently you need to convert MatOfPoint to MatOfPoint2f:
MatOfPoint2f contour2f = new MatOfPoint2f();
contour2f
.convertTo(contour2f, CvType.CV_32F);
minEnclosingCircle
(contour2f, ...


Putria Febriana

unread,
Sep 18, 2012, 6:25:39 AM9/18/12
to android...@googlegroups.com
i get an error "C:\\dev\\android-ndk-r8b\\ndk-build.cmd"
jni/Android.mk:5: ../../sdk/native/jni/OpenCV.mk: No such file or directory

make: *** No rule to make target `../../sdk/native/jni/OpenCV.mk'.  Stop.

On Saturday, July 7, 2012 12:56:28 PM UTC-7, Nick SD-RAM wrote:

Andrey Pavlenko

unread,
Sep 18, 2012, 7:46:31 AM9/18/12
to android...@googlegroups.com
1) OpenCV4Android SDK 2.4.2 is compiled with NDK r8, I'd recommend you use the same NDK version for your app-s rather than r8b 
2) make sure you run ndk-build.cmd in your app project folder, not in the 'jni' sub-folder!
- try to replace "../../sdk/native/jni/OpenCV.mk" with the full absolute path to this file in the Android.mk

Putria Febriana

unread,
Sep 18, 2012, 9:09:27 AM9/18/12
to android...@googlegroups.com

now, iget this eerror !


08:02:40 **** Auto Build of configuration Default for project OpenCV Tutorial 3 - Add Native OpenCV ****
"C:\\dev\\android-ndk-r8b\\ndk-build.cmd"
Install        : libnative_sample.so => libs/armeabi-v7a/libnative_sample.so


08:02:40 Build Finished (took 279ms)



on my LG OPTIMUS BLACK.. the camera screen just show a black screenn :
2012/9/18 Andrey Pavlenko <andrey....@itseez.com>
1) OpenCV4Android SDK 2.4.2 is compiled with NDK r8, I'd recommend you use the same NDK version for your app-s rather than r8b 
2) make sure you run ndk-build.cmd in your app project folder, not in the 'jni' sub-folder!
- try to replace "../../sdk/native/jni/OpenCV.mk" with the full absolute path to this file in the Android.mk

--
 
 
 



--
hari ini adalah milik anda?
aku hanya akan hidup untuk hari ini


Andrey Pavlenko

unread,
Sep 18, 2012, 2:32:43 PM9/18/12
to android...@googlegroups.com
It looks like OpenCv native camera doesn't work on your device...
The problem is that the OpenCV native camera uses Android non-public native API, when device vendors change it and break compatibility with open source Google version - the OpenCV native camera doesn't work on that devices.

Putria Febriana

unread,
Sep 18, 2012, 5:31:19 PM9/18/12
to android...@googlegroups.com
so, i must change my devices?i have running it on HUWAEI devices... and thats run... hehe

2012/9/18 Andrey Pavlenko <andrey....@itseez.com>
It looks like OpenCv native camera doesn't work on your device...
The problem is that the OpenCV native camera uses Android non-public native API, when device vendors change it and break compatibility with open source Google version - the OpenCV native camera doesn't work on that devices.

--
 
 
 
Reply all
Reply to author
Forward
0 new messages