Merge pull request #476 from apavlenko:eclipse_import_fix
authorAndrey Kamaev <andrey.kamaev@itseez.com>
Mon, 11 Feb 2013 17:38:07 +0000 (21:38 +0400)
committerOpenCV Buildbot <buildbot@opencv.org>
Mon, 11 Feb 2013 17:38:07 +0000 (21:38 +0400)
72 files changed:
3rdparty/tbb/CMakeLists.txt
CMakeLists.txt
android/package/CMakeLists.txt
android/service/engine/jni/JNIWrapper/JavaBasedPackageManager.cpp
android/service/engine/jni/JNIWrapper/JavaBasedPackageManager.h
doc/tutorials/core/mat_the_basic_image_container/mat_the_basic_image_container.rst
modules/core/include/opencv2/core/version.hpp
modules/core/src/arithm.cpp
modules/core/test/test_arithm.cpp
modules/highgui/src/cap_ffmpeg.cpp
modules/highgui/src/cap_ffmpeg_impl.hpp
modules/highgui/test/test_ffmpeg.cpp
modules/java/CMakeLists.txt
modules/java/generator/src/java/android+JavaCameraView.java
modules/java/generator/src/java/android+NativeCameraView.java
modules/ocl/src/initialization.cpp
modules/ts/misc/perf_tests_timing.py
samples/android/CMakeLists.txt
samples/android/tutorial-1-addopencv/.classpath [deleted file]
samples/android/tutorial-1-addopencv/.settings/org.eclipse.jdt.core.prefs [deleted file]
samples/android/tutorial-1-addopencv/res/drawable/icon.png [deleted file]
samples/android/tutorial-1-camerapreview/.classpath [moved from samples/android/tutorial-5-cameracontrol/.classpath with 100% similarity]
samples/android/tutorial-1-camerapreview/.project [moved from samples/android/tutorial-1-addopencv/.project with 94% similarity]
samples/android/tutorial-1-camerapreview/.settings/org.eclipse.jdt.core.prefs [moved from samples/android/tutorial-5-cameracontrol/.settings/org.eclipse.jdt.core.prefs with 100% similarity]
samples/android/tutorial-1-camerapreview/AndroidManifest.xml [moved from samples/android/tutorial-1-addopencv/AndroidManifest.xml with 96% similarity]
samples/android/tutorial-1-camerapreview/CMakeLists.txt [moved from samples/android/tutorial-1-addopencv/CMakeLists.txt with 82% similarity]
samples/android/tutorial-1-camerapreview/res/drawable/icon.png [moved from samples/android/tutorial-5-cameracontrol/res/drawable/icon.png with 100% similarity]
samples/android/tutorial-1-camerapreview/res/layout/tutorial1_surface_view.xml [moved from samples/android/tutorial-1-addopencv/res/layout/tutorial1_surface_view.xml with 100% similarity]
samples/android/tutorial-1-camerapreview/res/values/strings.xml [moved from samples/android/tutorial-1-addopencv/res/values/strings.xml with 53% similarity]
samples/android/tutorial-1-camerapreview/src/org/opencv/samples/tutorial1/Tutorial1Activity.java [moved from samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java with 95% similarity]
samples/android/tutorial-2-mixedprocessing/.classpath [moved from samples/android/tutorial-4-mixed/.classpath with 100% similarity]
samples/android/tutorial-2-mixedprocessing/.cproject [moved from samples/android/tutorial-4-mixed/.cproject with 97% similarity]
samples/android/tutorial-2-mixedprocessing/.project [moved from samples/android/tutorial-3-native/.project with 98% similarity]
samples/android/tutorial-2-mixedprocessing/.settings/org.eclipse.jdt.core.prefs [moved from samples/android/tutorial-4-mixed/.settings/org.eclipse.jdt.core.prefs with 100% similarity]
samples/android/tutorial-2-mixedprocessing/AndroidManifest.xml [moved from samples/android/tutorial-2-opencvcamera/AndroidManifest.xml with 96% similarity]
samples/android/tutorial-2-mixedprocessing/CMakeLists.txt [moved from samples/android/tutorial-4-mixed/CMakeLists.txt with 88% similarity]
samples/android/tutorial-2-mixedprocessing/jni/Android.mk [moved from samples/android/tutorial-4-mixed/jni/Android.mk with 100% similarity]
samples/android/tutorial-2-mixedprocessing/jni/Application.mk [moved from samples/android/tutorial-4-mixed/jni/Application.mk with 100% similarity]
samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp [moved from samples/android/tutorial-4-mixed/jni/jni_part.cpp with 66% similarity]
samples/android/tutorial-2-mixedprocessing/res/drawable/icon.png [moved from samples/android/tutorial-4-mixed/res/drawable/icon.png with 100% similarity]
samples/android/tutorial-2-mixedprocessing/res/layout/tutorial2_surface_view.xml [moved from samples/android/tutorial-2-opencvcamera/res/layout/tutorial2_surface_view.xml with 90% similarity]
samples/android/tutorial-2-mixedprocessing/res/values/strings.xml [moved from samples/android/tutorial-2-opencvcamera/res/values/strings.xml with 50% similarity]
samples/android/tutorial-2-mixedprocessing/src/org/opencv/samples/tutorial2/Tutorial2Activity.java [moved from samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java with 95% similarity]
samples/android/tutorial-2-opencvcamera/.project [deleted file]
samples/android/tutorial-2-opencvcamera/.settings/org.eclipse.jdt.core.prefs [deleted file]
samples/android/tutorial-2-opencvcamera/res/drawable/icon.png [deleted file]
samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java [deleted file]
samples/android/tutorial-3-cameracontrol/.classpath [moved from samples/android/tutorial-2-opencvcamera/.classpath with 100% similarity]
samples/android/tutorial-3-cameracontrol/.project [moved from samples/android/tutorial-5-cameracontrol/.project with 94% similarity]
samples/android/tutorial-3-cameracontrol/.settings/org.eclipse.jdt.core.prefs [moved from samples/android/tutorial-3-native/.settings/org.eclipse.jdt.core.prefs with 100% similarity]
samples/android/tutorial-3-cameracontrol/AndroidManifest.xml [moved from samples/android/tutorial-5-cameracontrol/AndroidManifest.xml with 93% similarity]
samples/android/tutorial-3-cameracontrol/CMakeLists.txt [moved from samples/android/tutorial-2-opencvcamera/CMakeLists.txt with 82% similarity]
samples/android/tutorial-3-cameracontrol/res/drawable/icon.png [moved from samples/android/tutorial-3-native/res/drawable/icon.png with 100% similarity]
samples/android/tutorial-3-cameracontrol/res/layout/tutorial3_surface_view.xml [moved from samples/android/tutorial-5-cameracontrol/res/layout/tutorial5_surface_view.xml with 74% similarity]
samples/android/tutorial-3-cameracontrol/res/values/strings.xml [moved from samples/android/tutorial-5-cameracontrol/res/values/strings.xml with 52% similarity]
samples/android/tutorial-3-cameracontrol/src/org/opencv/samples/tutorial3/Tutorial3Activity.java [moved from samples/android/tutorial-5-cameracontrol/src/org/opencv/samples/tutorial5/Sample5CameraControl.java with 92% similarity]
samples/android/tutorial-3-cameracontrol/src/org/opencv/samples/tutorial3/Tutorial3View.java [moved from samples/android/tutorial-5-cameracontrol/src/org/opencv/samples/tutorial5/SampleJavaCameraView.java with 90% similarity]
samples/android/tutorial-3-native/.classpath [deleted file]
samples/android/tutorial-3-native/.cproject [deleted file]
samples/android/tutorial-3-native/AndroidManifest.xml [deleted file]
samples/android/tutorial-3-native/CMakeLists.txt [deleted file]
samples/android/tutorial-3-native/jni/Android.mk [deleted file]
samples/android/tutorial-3-native/jni/Application.mk [deleted file]
samples/android/tutorial-3-native/jni/jni_part.cpp [deleted file]
samples/android/tutorial-3-native/res/layout/tutorial3_surface_view.xml [deleted file]
samples/android/tutorial-3-native/res/values/strings.xml [deleted file]
samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java [deleted file]
samples/android/tutorial-4-mixed/.project [deleted file]
samples/android/tutorial-4-mixed/AndroidManifest.xml [deleted file]
samples/android/tutorial-4-mixed/res/layout/tutorial4_surface_view.xml [deleted file]
samples/android/tutorial-4-mixed/res/values/strings.xml [deleted file]
samples/android/tutorial-5-cameracontrol/CMakeLists.txt [deleted file]

index b147c12..3c6ae98 100644 (file)
@@ -1,11 +1,18 @@
 #Cross compile TBB from source
 project(tbb)
 
-# 4.1 update 1 - works fine
-set(tbb_ver "tbb41_20121003oss")
-set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20121003oss_src.tgz")
-set(tbb_md5 "2a684fefb855d2d0318d1ef09afa75ff")
+# 4.1 update 2 - works fine
+set(tbb_ver "tbb41_20130116oss")
+set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130116oss_src.tgz")
+set(tbb_md5 "3809790e1001a1b32d59c9fee590ee85")
 set(tbb_version_file "version_string.ver")
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
+
+# 4.1 update 1 - works fine
+#set(tbb_ver "tbb41_20121003oss")
+#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20121003oss_src.tgz")
+#set(tbb_md5 "2a684fefb855d2d0318d1ef09afa75ff")
+#set(tbb_version_file "version_string.ver")
 
 # 4.1 - works fine
 #set(tbb_ver "tbb41_20120718oss")
index 7d769cb..cd93eaf 100644 (file)
@@ -158,7 +158,7 @@ OCV_OPTION(BUILD_PERF_TESTS         "Build performance tests"
 OCV_OPTION(BUILD_TESTS              "Build accuracy & regression tests"           ON  IF (NOT IOS) )
 OCV_OPTION(BUILD_WITH_DEBUG_INFO    "Include debug info into debug libs (not MSCV only)" ON )
 OCV_OPTION(BUILD_WITH_STATIC_CRT    "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
-OCV_OPTION(BUILD_FAT_JAVA_LIB       "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
+OCV_OPTION(BUILD_FAT_JAVA_LIB       "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
 OCV_OPTION(BUILD_ANDROID_SERVICE    "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
 OCV_OPTION(BUILD_ANDROID_PACKAGE    "Build platform-specific package for Google Play" OFF IF ANDROID )
 
index 24ce876..0bfb3fe 100644 (file)
@@ -86,7 +86,7 @@ add_custom_command(
          COMMAND ${CMAKE_COMMAND} -E touch "${APK_NAME}"
          WORKING_DIRECTORY "${PACKAGE_DIR}"
          MAIN_DEPENDENCY "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}"
-         DEPENDS "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper" "${PACKAGE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/drawable/icon.png" ${camera_wrappers} opencv_java
+         DEPENDS "${OpenCV_BINARY_DIR}/bin/classes.jar.dephelper" "${PACKAGE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/drawable/icon.png" ${camera_wrappers} opencv_java
        )
 
 install(FILES "${APK_NAME}" DESTINATION "apk/" COMPONENT main)
index bfef171..b2d8fd7 100644 (file)
@@ -46,7 +46,9 @@ bool JavaBasedPackageManager::InstallPackage(const PackageInfo& package)
     LOGD("Calling java package manager with package name %s\n", package.GetFullName().c_str());
     jobject jpkgname = jenv->NewStringUTF(package.GetFullName().c_str());
     bool result = jenv->CallNonvirtualBooleanMethod(JavaPackageManager, jclazz, jmethod, jpkgname);
+
     jenv->DeleteLocalRef(jpkgname);
+    jenv->DeleteLocalRef(jclazz);
 
     if (self_attached)
     {
@@ -104,9 +106,12 @@ vector<PackageInfo> JavaBasedPackageManager::GetInstalledPackages()
 
         if (tmp.IsValid())
             result.push_back(tmp);
+
+        jenv->DeleteLocalRef(jtmp);
     }
 
     jenv->DeleteLocalRef(jpkgs);
+    jenv->DeleteLocalRef(jclazz);
 
     if (self_attached)
     {
@@ -118,6 +123,16 @@ vector<PackageInfo> JavaBasedPackageManager::GetInstalledPackages()
     return result;
 }
 
+static jint GetAndroidVersion(JNIEnv* jenv)
+{
+    jclass jclazz = jenv->FindClass("android/os/Build$VERSION");
+    jfieldID jfield = jenv->GetStaticFieldID(jclazz, "SDK_INT", "I");
+    jint api_level = jenv->GetStaticIntField(jclazz, jfield);
+    jenv->DeleteLocalRef(jclazz);
+
+    return api_level;
+}
+
 // IMPORTANT: This method can be called only if thread is attached to Dalvik
 PackageInfo JavaBasedPackageManager::ConvertPackageFromJava(jobject package, JNIEnv* jenv)
 {
@@ -133,23 +148,27 @@ PackageInfo JavaBasedPackageManager::ConvertPackageFromJava(jobject package, JNI
     const char* jversionstr = jenv->GetStringUTFChars(jversionobj, NULL);
     string verison(jversionstr);
     jenv->DeleteLocalRef(jversionobj);
+    jenv->DeleteLocalRef(jclazz);
 
+    static const jint api_level = GetAndroidVersion(jenv);
     string path;
-    jclazz = jenv->FindClass("android/os/Build$VERSION");
-    jfield = jenv->GetStaticFieldID(jclazz, "SDK_INT", "I");
-    jint api_level = jenv->GetStaticIntField(jclazz, jfield);
     if (api_level > 8)
     {
         jclazz = jenv->GetObjectClass(package);
         jfield = jenv->GetFieldID(jclazz, "applicationInfo", "Landroid/content/pm/ApplicationInfo;");
         jobject japp_info = jenv->GetObjectField(package, jfield);
+        jenv->DeleteLocalRef(jclazz);
+
         jclazz = jenv->GetObjectClass(japp_info);
         jfield = jenv->GetFieldID(jclazz, "nativeLibraryDir", "Ljava/lang/String;");
         jstring jpathobj = static_cast<jstring>(jenv->GetObjectField(japp_info, jfield));
         const char* jpathstr = jenv->GetStringUTFChars(jpathobj, NULL);
         path = string(jpathstr);
         jenv->ReleaseStringUTFChars(jpathobj, jpathstr);
+
+        jenv->DeleteLocalRef(japp_info);
         jenv->DeleteLocalRef(jpathobj);
+        jenv->DeleteLocalRef(jclazz);
     }
     else
     {
index 8717ea9..3ea8914 100644 (file)
@@ -19,4 +19,4 @@ private:
 
     JavaBasedPackageManager();
     PackageInfo ConvertPackageFromJava(jobject package, JNIEnv* jenv);
-};
\ No newline at end of file
+};
index 42fe58f..7b3f860 100644 (file)
@@ -6,26 +6,28 @@ Mat - The Basic Image Container
 Goal
 ====
 
-We have multiple ways to acquire digital images from the real world: digital cameras, scanners, computed tomography or magnetic resonance imaging to just name a few. In every case what we (humans) see are images. However, when transforming this to our digital devices what we record are numerical values for each of the points of the image.
+We have multiple ways to acquire digital images from the real world: digital cameras, scanners, computed tomography, and magnetic resonance imaging to name a few. In every case what we (humans) see are images. However, when transforming this to our digital devices what we record are numerical values for each of the points of the image.
 
 .. image:: images/MatBasicImageForComputer.jpg
    :alt: A matrix of the mirror of a car
    :align: center
 
-For example in the above image you can see that the mirror of the care is nothing more than a matrix containing all the intensity values of the pixel points. Now, how we get and store the pixels values may vary according to what fits best our need, in the end all images inside a computer world may be reduced to numerical matrices and some other information's describing the matric itself. *OpenCV* is a computer vision library whose main focus is to process and manipulate these information to find out further ones. Therefore, the first thing you need to learn and get accommodated with is how OpenCV stores and handles images.
+For example in the above image you can see that the mirror of the car is nothing more than a matrix containing all the intensity values of the pixel points. How we get and store the pixels values may vary according to our needs, but in the end all images inside a computer world may be reduced to numerical matrices and other information describing the matrix itself. *OpenCV* is a computer vision library whose main focus is to process and manipulate this information. Therefore, the first thing you need to be familiar with is how OpenCV stores and handles images.
 
 *Mat*
 =====
 
-OpenCV has been around ever since 2001. In those days the library was built around a *C* interface. In those days to store the image in the memory they used a C structure entitled *IplImage*. This is the one you'll see in most of the older tutorials and educational materials. The problem with this is that it brings to the table all the minuses of the C language. The biggest issue is the manual management. It builds on the assumption that the user is responsible for taking care of memory allocation and deallocation. While this is no issue in case of smaller programs once your code base start to grove larger and larger it will be more and more a struggle to handle all this rather than focusing on actually solving your development goal.
+OpenCV has been around since 2001. In those days the library was built around a *C* interface and to store the image in the memory they used a C structure called *IplImage*. This is the one you'll see in most of the older tutorials and educational materials. The problem with this is that it brings to the table all the minuses of the C language. The biggest issue is the manual memory management. It builds on the assumption that the user is responsible for taking care of memory allocation and deallocation. While this is not a problem with smaller programs, once your code base grows it will be more of a struggle to handle all this rather than focusing on solving your development goal.
 
-Luckily C++ came around and introduced the concept of classes making possible to build another road for the user: automatic memory management (more or less). The good news is that C++ if fully compatible with C so no compatibility issues can arise from making the change. Therefore, OpenCV with its 2.0 version introduced a new C++ interface that by taking advantage of these offers a new way of doing things. A way, in which you do not need to fiddle with memory management; making your code concise (less to write, to achieve more). The only main downside of the C++ interface is that many embedded development systems at the moment support only C. Therefore, unless you are targeting this platform, there's no point on using the *old* methods (unless you're a masochist programmer and you're asking for trouble). 
+Luckily C++ came around and introduced the concept of classes making easier for the user through automatic memory management (more or less). The good news is that C++ is fully compatible with C so no compatibility issues can arise from making the change. Therefore, OpenCV 2.0 introduced a new C++ interface which offered a new way of doing things which means you do not need to fiddle with memory management, making your code concise (less to write, to achieve more). The main downside of the C++ interface is that many embedded development systems at the moment support only C. Therefore, unless you are targeting embedded platforms, there's no point to using the *old* methods (unless you're a masochist programmer and you're asking for trouble). 
 
-The first thing you need to know about *Mat* is that you no longer need to manually allocate its size and release it as soon as you do not need it. While doing this is still a possibility, most of the OpenCV functions will allocate its output data manually. As a nice bonus if you pass on an already existing *Mat* object, what already has allocated the required space for the matrix, this will be reused. In other words we use at all times only as much memory as much we must to perform the task.
+The first thing you need to know about *Mat* is that you no longer need to manually allocate its memory and release it as soon as you do not need it. While doing this is still a possibility, most of the OpenCV functions will allocate its output data manually. As a nice bonus if you pass on an already existing *Mat* object, which has already  allocated the required space for the matrix, this will be reused. In other words we use at all times only as much memory as we need to perform the task.
 
-*Mat* is basically a class having two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored and so on) and a pointer to the matrix containing the pixel values (may take any dimensionality depending on the method chosen for storing) . The matrix header size is constant. However, the size of the matrix itself may vary from image to image and usually is larger by order of magnitudes. Therefore, when you're passing on images in your program and at some point you need to create a copy of the image the big price you will need to build is for the matrix itself rather than its header. OpenCV is an image processing library. It contains a large collection of image processing functions. To solve a computational challenge most of the time you will end up using multiple functions of the library. Due to this passing on images to functions is a common practice. We should not forget that we are talking about image processing algorithms, which tend to be quite computational heavy. The last thing we want to do is to further decrease the speed of your program by making unnecessary copies of potentially *large* images.
+*Mat* is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing) . The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude. 
 
-To tackle this issue OpenCV uses a reference counting system. The idea is that each *Mat* object has its own header, however the matrix may be shared between two instance of them by having their matrix pointer point to the same address. Moreover, the copy operators **will only copy the headers**, and as also copy the pointer to the large matrix too, however not the matrix itself. 
+OpenCV is an image processing library. It contains a large collection of image processing functions. To solve a computational challenge, most of the time you will end up using multiple functions of the library. Because of this, passing images to functions is a common practice. We should not forget that we are talking about image processing algorithms, which tend to be quite computational heavy. The last thing we want to do is  further decrease the speed of your program by making unnecessary copies of potentially *large* images.
+
+To tackle this issue OpenCV uses a reference counting system. The idea is that each *Mat* object has its own header, however the matrix may be shared between two instance of them by having their matrix pointers point to the same address. Moreover, the copy operators **will only copy the headers** and the pointer to the large matrix, not the data itself. 
 
 .. code-block:: cpp
    :linenos:
@@ -37,7 +39,7 @@ To tackle this issue OpenCV uses a reference counting system. The idea is that e
 
    C = A;                                    // Assignment operator
 
-All the above objects, in the end point to the same single data matrix. Their headers are different, however making any modification using either one of them will affect all the other ones too. In practice the different objects just provide different access method to the same underlying data. Nevertheless, their header parts are different. The real interesting part comes that you can create headers that refer only to a subsection of the full data. For example, to create a region of interest (*ROI*) in an image you just create a new header with the new boundaries: 
+All the above objects, in the end, point to the same single data matrix. Their headers are different, however, and making a modification using any of them will affect all the other ones as well. In practice the different objects just provide different access method to the same underlying data. Nevertheless, their header parts are different. The real interesting part is that you can create headers which refer to only a subsection of the full data. For example, to create a region of interest (*ROI*) in an image you just create a new header with the new boundaries: 
 
 .. code-block:: cpp
    :linenos:
@@ -45,7 +47,7 @@ All the above objects, in the end point to the same single data matrix. Their he
    Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
    Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries 
 
-Now you may ask if the matrix itself may belong to multiple *Mat* objects who will take responsibility for its cleaning when it's no longer needed. The short answer is: the last object that used it. For this a reference counting mechanism is used. Whenever somebody copies a header of a *Mat* object a counter is increased for the matrix. Whenever a header is cleaned this counter is decreased. When the counter reaches zero the matrix too is freed. Because, sometimes you will still want to copy the matrix itself too, there exists the :basicstructures:`clone() <mat-clone>` or the :basicstructures:`copyTo() <mat-copyto>` function.
+Now you may ask if the matrix itself may belong to multiple *Mat* objects who takes responsibility for cleaning it up when it's no longer needed. The short answer is: the last object that used it. This is handled by using a reference counting mechanism. Whenever somebody copies a header of a *Mat* object, a counter is increased for the matrix. Whenever a header is cleaned this counter is decreased. When the counter reaches zero the matrix too is freed. Sometimes you will want to copy the matrix itself too, so OpenCV provides the :basicstructures:`clone() <mat-clone>` and :basicstructures:`copyTo() <mat-copyto>` functions.
 
 .. code-block:: cpp
    :linenos:
@@ -59,34 +61,34 @@ Now modifying *F* or *G* will not affect the matrix pointed by the *Mat* header.
 .. container:: enumeratevisibleitemswithsquare
 
    * Output image allocation for OpenCV functions is automatic (unless specified otherwise).
-   * No need to think about memory freeing with OpenCVs C++ interface.
-   * The assignment operator and the copy constructor (*ctor*)copies only the header.
-   * Use the :basicstructures:`clone()<mat-clone>` or the :basicstructures:`copyTo() <mat-copyto>` function to copy the underlying matrix of an image.
+   * You do not need to think about memory management with OpenCVs C++ interface.
+   * The assignment operator and the copy constructor only copies the header.
+   * The underlying matrix of an image may be copied using the :basicstructures:`clone()<mat-clone>` and :basicstructures:`copyTo() <mat-copyto>` functions.
 
 *Storing* methods
 ================= 
 
-This is about how you store the pixel values. You can select the color space and the data type used. The color space refers to how we combine color components in order to code a given color. The simplest one is the gray scale. Here the colors at our disposal are black and white. The combination of these allows us to create many shades of gray. 
+This is about how you store the pixel values. You can select the color space and the data type used. The color space refers to how we combine color components in order to code a given color. The simplest one is the gray scale where the colors at our disposal are black and white. The combination of these allows us to create many shades of gray. 
 
-For *colorful* ways we have a lot more of methods to choose from. However, every one of them breaks it down to three or four basic components and the combination of this will give all others. The most popular one of this is RGB, mainly because this is also how our eye builds up colors in our eyes. Its base colors are red, green and blue. To code the transparency of a color sometimes a fourth element: alpha (A) is added. 
+For *colorful* ways we have a lot more methods to choose from. Each of them breaks it down to three or four basic components and we can use the combination of these to create the others. The most popular one is RGB, mainly because this is also how our eye builds up colors. Its base colors are red, green and blue. To code the transparency of a color sometimes a fourth element: alpha (A) is added. 
 
-However, they are many color systems each with their own advantages:
+There are, however, many other color systems each with their own advantages:
 
 .. container:: enumeratevisibleitemswithsquare
 
    * RGB is the most common as our eyes use something similar, our display systems also compose colors using these.
-   * The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors. Using you may for example dismiss the last component, making your algorithm less sensible to light conditions of the input image. 
+   * The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors.  You might, for example, dismiss the last component, making your algorithm less sensible to the light conditions of the input image. 
    * YCrCb is used by the popular JPEG image format. 
    * CIE L*a*b* is a perceptually uniform color space, which comes handy if you need to measure the *distance* of a given color to another color.
 
-Now each of the building components has their own valid domains. This leads to the data type used. How we store a component defines just how fine control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in case of three components this already gives 16 million possible colors to represent (like in case of RGB) we may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
+Each of the building components has their own valid domains. This leads to the data type used. How we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in case of three components this already gives 16 million possible colors to represent (like in case of RGB) we may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
 
-Creating explicitly a *Mat* object
+Creating a *Mat* object explicitly
 ==================================
 
-In the :ref:`Load_Save_Image` tutorial you could already see how to write a matrix to an image file by using the :readWriteImageVideo:` imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can achieve this via the << operator of *Mat*. However, be aware that this only works for two dimensional matrices. 
+In the :ref:`Load_Save_Image` tutorial you have already learned how to write a matrix to an image file by using the :readWriteImageVideo:` imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can do this using the << operator of *Mat*. Be aware that this only works for two dimensional matrices. 
 
-Although *Mat* is a great class as image container it is also a general matrix class. Therefore, it is possible to create and manipulate multidimensional matrices. You can create a Mat object in multiple ways:
+Although *Mat* works really well as an image container, it is also a general matrix class. Therefore, it is possible to create and manipulate multidimensional matrices. You can create a Mat object in multiple ways:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -103,13 +105,13 @@ Although *Mat* is a great class as image container it is also a general matrix c
 
     For two dimensional and multichannel images we first define their size: row and column count wise.
 
-    Then we need to specify the data type to use for storing the elements and the number of channels per matrix point. To do this we have multiple definitions made according to the following convention: 
+    Then we need to specify the data type to use for storing the elements and the number of channels per matrix point. To do this we have multiple definitions constructed according to the following convention: 
 
     .. code-block:: cpp
 
        CV_[The number of bits per item][Signed or Unsigned][Type Prefix]C[The channel number]
 
-    For instance, *CV_8UC3* means we use unsigned char types that are 8 bit long and each pixel has three items of this to form the three channels. This are predefined for up to four channel numbers. The :basicstructures:`Scalar <scalar>` is four element short vector. Specify this and you can initialize all matrix points with a custom value. However if you need more you can create the type with the upper macro and putting the channel number in parenthesis as you can see below.
+    For instance, *CV_8UC3* means we use unsigned char types that are 8 bit long and each pixel has three of these to form the three channels. This are predefined for up to four channel numbers. The :basicstructures:`Scalar <scalar>` is four element short vector. Specify this and you can initialize all matrix points with a custom value. If you need more you can create the type with the upper macro, setting the channel number in parenthesis as you can see below.
 
    + Use C\\C++ arrays and initialize via constructor
 
@@ -118,7 +120,7 @@ Although *Mat* is a great class as image container it is also a general matrix c
         :tab-width: 4
         :lines:  35-36
 
-     The upper example shows how to create a matrix with more than two dimensions. Specify its dimension, then pass a pointer containing the size for each dimension and the rest remains the same.      
+     The upper example shows how to create a matrix with more than two dimensions. Specify its dimension, then pass a pointer containing the size for each dimension and the rest remains the same.
 
 
    + Create a header for an already existing IplImage pointer:
@@ -176,7 +178,7 @@ Although *Mat* is a great class as image container it is also a general matrix c
 
 .. note:: 
 
-   You can fill out a matrix with random values using the :operationsOnArrays:`randu() <randu>` function. You need to give the lower and upper value between what you want the random values:
+   You can fill out a matrix with random values using the :operationsOnArrays:`randu() <randu>` function. You need to give the lower and upper value for the random values:
 
    .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
       :language: cpp
@@ -184,10 +186,10 @@ Although *Mat* is a great class as image container it is also a general matrix c
       :lines:  57-58
 
 
-Print out formatting
-====================
+Output formatting
+=================
 
-In the above examples you could see the default formatting option. Nevertheless, OpenCV allows you to format your matrix output format to fit the rules of
+In the above examples you could see the default formatting option. OpenCV, however, allows you to format your matrix output
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -246,10 +248,10 @@ In the above examples you could see the default formatting option. Nevertheless,
         :alt: Default Output
         :align: center
 
-Print for other common items
+Output of other common items
 ============================
 
-OpenCV offers support for print of other common OpenCV data structures too via the << operator like:
+OpenCV offers support for output of other common OpenCV data structures too via the << operator:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -298,9 +300,9 @@ OpenCV offers support for print of other common OpenCV data structures too via t
         :alt: Default Output
         :align: center
 
-Most of the samples here have been included into a small console application. You can download it from :download:`here <../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp>` or in the core section of the cpp samples.
+Most of the samples here have been included in a small console application. You can download it from :download:`here <../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp>` or in the core section of the cpp samples.
 
-A quick video demonstration of this you can find on `YouTube <https://www.youtube.com/watch?v=1tibU7vGWpk>`_.
+You can also find a quick video demonstration of this on `YouTube <https://www.youtube.com/watch?v=1tibU7vGWpk>`_.
 
 .. raw:: html
 
index b6d1568..9b2c02c 100644 (file)
@@ -49,8 +49,8 @@
 
 #define CV_VERSION_EPOCH    2
 #define CV_VERSION_MAJOR    4
-#define CV_VERSION_MINOR    3
-#define CV_VERSION_REVISION 2
+#define CV_VERSION_MINOR    4
+#define CV_VERSION_REVISION 0
 
 #define CVAUX_STR_EXP(__A)  #__A
 #define CVAUX_STR(__A)      CVAUX_STR_EXP(__A)
index 0fa306c..5fda141 100644 (file)
@@ -1242,11 +1242,15 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
     Mat src1 = _src1.getMat(), src2 = _src2.getMat();
     bool haveMask = !_mask.empty();
     bool reallocate = false;
+    
+    bool src1Scalar = checkScalar(src1, src2.type(), kind1, kind2); 
+    bool src2Scalar = checkScalar(src2, src1.type(), kind2, kind1); 
 
     if( (kind1 == kind2 || src1.channels() == 1) && src1.dims <= 2 && src2.dims <= 2 &&
         src1.size() == src2.size() && src1.type() == src2.type() &&
         !haveMask && ((!_dst.fixedType() && (dtype < 0 || CV_MAT_DEPTH(dtype) == src1.depth())) ||
-                       (_dst.fixedType() && _dst.type() == _src1.type())) )
+                       (_dst.fixedType() && _dst.type() == _src1.type())) && 
+        ((src1Scalar && src2Scalar) || (!src1Scalar && !src2Scalar)) )
     {
         _dst.create(src1.size(), src1.type());
         Mat dst = _dst.getMat();
index 43120cf..ebc9eae 100644 (file)
@@ -1530,4 +1530,24 @@ TEST(Multiply, FloatingPointRounding)
     cv::multiply(src, s, dst, 1, CV_16U);
     // with CV_32F this produce result 16202
     ASSERT_EQ(dst.at<ushort>(0,0), 16201);
-}
\ No newline at end of file
+}
+
+TEST(Core_Add, AddToColumnWhen3Rows)
+{
+    cv::Mat m1 = (cv::Mat_<double>(3, 2) << 1, 2, 3, 4, 5, 6);
+    m1.col(1) += 10;
+
+    cv::Mat m2 = (cv::Mat_<double>(3, 2) << 1, 12, 3, 14, 5, 16);
+
+    ASSERT_EQ(0, countNonZero(m1 - m2));
+}
+
+TEST(Core_Add, AddToColumnWhen4Rows)
+{
+    cv::Mat m1 = (cv::Mat_<double>(4, 2) << 1, 2, 3, 4, 5, 6, 7, 8);
+    m1.col(1) += 10;
+
+    cv::Mat m2 = (cv::Mat_<double>(4, 2) << 1, 12, 3, 14, 5, 16, 7, 18);
+
+    ASSERT_EQ(0, countNonZero(m1 - m2));
+}
index cc910a3..0a2f0a3 100644 (file)
@@ -57,32 +57,11 @@ static CvCreateVideoWriter_Plugin icvCreateVideoWriter_FFMPEG_p = 0;
 static CvReleaseVideoWriter_Plugin icvReleaseVideoWriter_FFMPEG_p = 0;
 static CvWriteFrame_Plugin icvWriteFrame_FFMPEG_p = 0;
 
-static cv::Mutex _icvInitFFMPEG_mutex;
-
-class icvInitFFMPEG
+static void
+icvInitFFMPEG(void)
 {
-public:
-    static void Init()
-    {
-        cv::AutoLock al(_icvInitFFMPEG_mutex);
-        static icvInitFFMPEG init;
-    }
-
-private:
-    #if defined WIN32 || defined _WIN32
-    HMODULE icvFFOpenCV;
-
-    ~icvInitFFMPEG()
-    {
-        if (icvFFOpenCV)
-        {
-            FreeLibrary(icvFFOpenCV);
-            icvFFOpenCV = 0;
-        }
-    }
-    #endif
-
-    icvInitFFMPEG()
+    static int ffmpegInitialized = 0;
+    if( !ffmpegInitialized )
     {
     #if defined WIN32 || defined _WIN32
         const char* module_name = "opencv_ffmpeg"
@@ -92,7 +71,7 @@ private:
         #endif
             ".dll";
 
-        icvFFOpenCV = LoadLibrary( module_name );
+        static HMODULE icvFFOpenCV = LoadLibrary( module_name );
         if( icvFFOpenCV )
         {
             icvCreateFileCapture_FFMPEG_p =
@@ -138,8 +117,10 @@ private:
         icvReleaseVideoWriter_FFMPEG_p = (CvReleaseVideoWriter_Plugin)cvReleaseVideoWriter_FFMPEG;
         icvWriteFrame_FFMPEG_p = (CvWriteFrame_Plugin)cvWriteFrame_FFMPEG;
     #endif
+
+        ffmpegInitialized = 1;
     }
-};
+}
 
 
 class CvCapture_FFMPEG_proxy : public CvCapture
@@ -174,9 +155,9 @@ public:
     }
     virtual bool open( const char* filename )
     {
-        icvInitFFMPEG::Init();
         close();
 
+        icvInitFFMPEG();
         if( !icvCreateFileCapture_FFMPEG_p )
             return false;
         ffmpegCapture = icvCreateFileCapture_FFMPEG_p( filename );
@@ -209,6 +190,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
 #endif
 }
 
+
 class CvVideoWriter_FFMPEG_proxy : public CvVideoWriter
 {
 public:
@@ -226,8 +208,8 @@ public:
     }
     virtual bool open( const char* filename, int fourcc, double fps, CvSize frameSize, bool isColor )
     {
-        icvInitFFMPEG::Init();
         close();
+        icvInitFFMPEG();
         if( !icvCreateVideoWriter_FFMPEG_p )
             return false;
         ffmpegWriter = icvCreateVideoWriter_FFMPEG_p( filename, fourcc, fps, frameSize.width, frameSize.height, isColor );
index d6ccdab..445a9e6 100644 (file)
@@ -328,179 +328,28 @@ void CvCapture_FFMPEG::close()
 #define AVSEEK_FLAG_ANY 1
 #endif
 
-class ImplMutex
+static void icvInitFFMPEG_internal()
 {
-public:
-    ImplMutex();
-    ~ImplMutex();
-
-    void lock();
-    bool trylock();
-    void unlock();
-
-    struct Impl;
-protected:
-    Impl* impl;
-
-private:
-    ImplMutex(const ImplMutex&);
-    ImplMutex& operator = (const ImplMutex& m);
-};
-
-#if defined WIN32 || defined _WIN32 || defined WINCE
-
-struct ImplMutex::Impl
-{
-    Impl() { InitializeCriticalSection(&cs); refcount = 1; }
-    ~Impl() { DeleteCriticalSection(&cs); }
-
-    void lock() { EnterCriticalSection(&cs); }
-    bool trylock() { return TryEnterCriticalSection(&cs) != 0; }
-    void unlock() { LeaveCriticalSection(&cs); }
-
-    CRITICAL_SECTION cs;
-    int refcount;
-};
-
-#ifndef __GNUC__
-static int _interlockedExchangeAdd(int* addr, int delta)
-{
-#if defined _MSC_VER && _MSC_VER >= 1500
-    return (int)_InterlockedExchangeAdd((long volatile*)addr, delta);
-#else
-    return (int)InterlockedExchangeAdd((long volatile*)addr, delta);
-#endif
-}
-#endif // __GNUC__
-
-#elif defined __APPLE__
-
-#include <libkern/OSAtomic.h>
-
-struct ImplMutex::Impl
-{
-    Impl() { sl = OS_SPINLOCK_INIT; refcount = 1; }
-    ~Impl() {}
-
-    void lock() { OSSpinLockLock(&sl); }
-    bool trylock() { return OSSpinLockTry(&sl); }
-    void unlock() { OSSpinLockUnlock(&sl); }
-
-    OSSpinLock sl;
-    int refcount;
-};
-
-#elif defined __linux__ && !defined ANDROID
-
-struct ImplMutex::Impl
-{
-    Impl() { pthread_spin_init(&sl, 0); refcount = 1; }
-    ~Impl() { pthread_spin_destroy(&sl); }
-
-    void lock() { pthread_spin_lock(&sl); }
-    bool trylock() { return pthread_spin_trylock(&sl) == 0; }
-    void unlock() { pthread_spin_unlock(&sl); }
-
-    pthread_spinlock_t sl;
-    int refcount;
-};
-
-#else
-
-struct ImplMutex::Impl
-{
-    Impl() { pthread_mutex_init(&sl, 0); refcount = 1; }
-    ~Impl() { pthread_mutex_destroy(&sl); }
-
-    void lock() { pthread_mutex_lock(&sl); }
-    bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
-    void unlock() { pthread_mutex_unlock(&sl); }
-
-    pthread_mutex_t sl;
-    int refcount;
-};
-
-#endif
-
-ImplMutex::ImplMutex()
-{
-    impl = new ImplMutex::Impl;
-}
-
-ImplMutex::~ImplMutex()
-{
-    delete impl;
-    impl = 0;
-}
-
-void ImplMutex::lock() { impl->lock(); }
-void ImplMutex::unlock() { impl->unlock(); }
-bool ImplMutex::trylock() { return impl->trylock(); }
-
-static int LockCallBack(void **mutex, AVLockOp op)
-{
-    switch (op)
-    {
-        case AV_LOCK_CREATE:
-            *mutex = reinterpret_cast<void*>(new ImplMutex());
-            if (!*mutex)
-                return 1;
-        break;
-
-        case AV_LOCK_OBTAIN:
-            reinterpret_cast<ImplMutex*>(*mutex)->lock();
-        break;
-
-        case AV_LOCK_RELEASE:
-            reinterpret_cast<ImplMutex*>(*mutex)->unlock();
-        break;
-
-        case AV_LOCK_DESTROY:
-            ImplMutex* cv_mutex = reinterpret_cast<ImplMutex*>(*mutex);
-            delete cv_mutex;
-            cv_mutex = NULL;
-        break;
-    }
-    return 0;
-}
-
-static ImplMutex _InternalFFMpegRegister_mutex;
-
-class InternalFFMpegRegister
-{
-public:
-    static void Register()
-    {
-        _InternalFFMpegRegister_mutex.lock();
-        static InternalFFMpegRegister init;
-        _InternalFFMpegRegister_mutex.unlock();
-    }
-
-    ~InternalFFMpegRegister()
-    {
-        av_lockmgr_register(NULL);
-    }
-
-private:
-    InternalFFMpegRegister()
+    static volatile bool initialized = false;
+    if( !initialized )
     {
-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
+    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
         avformat_network_init();
-#endif
+    #endif
 
         /* register all codecs, demux and protocols */
         av_register_all();
 
-        /* register a callback function for synchronization */
-        av_lockmgr_register(&LockCallBack);
-
         av_log_set_level(AV_LOG_ERROR);
+
+        initialized = true;
     }
-};
+}
 
 bool CvCapture_FFMPEG::open( const char* _filename )
 {
-    InternalFFMpegRegister::Register();
+    icvInitFFMPEG_internal();
+
     unsigned i;
     bool valid = false;
 
@@ -512,8 +361,7 @@ bool CvCapture_FFMPEG::open( const char* _filename )
     int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
 #endif
 
-    if (err < 0)
-    {
+    if (err < 0) {
         CV_WARN("Error opening file");
         goto exit_func;
     }
@@ -523,8 +371,7 @@ bool CvCapture_FFMPEG::open( const char* _filename )
 #else
     av_find_stream_info(ic);
 #endif
-    if (err < 0)
-    {
+    if (err < 0) {
         CV_WARN("Could not find codec parameters");
         goto exit_func;
     }
@@ -546,8 +393,7 @@ bool CvCapture_FFMPEG::open( const char* _filename )
 #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
 #endif
 
-        if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0)
-        {
+        if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
             AVCodec *codec = avcodec_find_decoder(enc->codec_id);
             if (!codec ||
 #if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
@@ -555,8 +401,7 @@ bool CvCapture_FFMPEG::open( const char* _filename )
 #else
                 avcodec_open(enc, codec)
 #endif
-                < 0)
-                goto exit_func;
+                < 0) goto exit_func;
 
             video_stream = i;
             video_st = ic->streams[i];
@@ -1430,7 +1275,7 @@ void CvVideoWriter_FFMPEG::close()
 bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc,
                                  double fps, int width, int height, bool is_color )
 {
-    InternalFFMpegRegister::Register();
+    icvInitFFMPEG_internal();
 
     CodecID codec_id = CODEC_ID_NONE;
     int err, codec_pix_fmt;
@@ -1650,7 +1495,6 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc,
     frame_width = width;
     frame_height = height;
     ok = true;
-
     return true;
 }
 
@@ -1662,7 +1506,6 @@ CvCapture_FFMPEG* cvCreateFileCapture_FFMPEG( const char* filename )
     capture->init();
     if( capture->open( filename ))
         return capture;
-
     capture->close();
     free(capture);
     return 0;
@@ -1711,6 +1554,7 @@ CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG( const char* filename, int four
     return 0;
 }
 
+
 void cvReleaseVideoWriter_FFMPEG( CvVideoWriter_FFMPEG** writer )
 {
     if( writer && *writer )
@@ -1897,12 +1741,15 @@ AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CodecID
 
 bool OutputMediaStream_FFMPEG::open(const char* fileName, int width, int height, double fps)
 {
-    InternalFFMpegRegister::Register();
-
     fmt_ = 0;
     oc_ = 0;
     video_st_ = 0;
 
+    // tell FFMPEG to register codecs
+    av_register_all();
+
+    av_log_set_level(AV_LOG_ERROR);
+
     // auto detect the output format from the name and fourcc code
     #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
         fmt_ = av_guess_format(NULL, fileName, NULL);
@@ -2073,8 +1920,6 @@ private:
 
 bool InputMediaStream_FFMPEG::open(const char* fileName, int* codec, int* chroma_format, int* width, int* height)
 {
-    InternalFFMpegRegister::Register();
-
     int err;
 
     ctx_ = 0;
@@ -2085,6 +1930,11 @@ bool InputMediaStream_FFMPEG::open(const char* fileName, int* codec, int* chroma
         avformat_network_init();
     #endif
 
+    // register all codecs, demux and protocols
+    av_register_all();
+
+    av_log_set_level(AV_LOG_ERROR);
+
     #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
         err = avformat_open_input(&ctx_, fileName, 0, 0);
     #else
@@ -2204,7 +2054,7 @@ bool InputMediaStream_FFMPEG::read(unsigned char** data, int* size, int* endOfFi
 
         if (ret < 0)
         {
-            if (ret == (int)AVERROR_EOF)
+            if (ret == AVERROR_EOF)
                 *endOfFile = true;
             return false;
         }
index d3def0c..0702cb1 100644 (file)
@@ -359,7 +359,7 @@ private:
 
 bool ReadImageAndTest::next;
 
-TEST(Highgui_Video_parallel_writers_and_readers, accuracy)
+TEST(Highgui_Video_parallel_writers_and_readers, DISABLED_accuracy)
 {
     const unsigned int threadsCount = 4;
     cvtest::TS* ts = cvtest::TS::ptr();
index 4006688..2fc52a7 100644 (file)
@@ -166,11 +166,7 @@ if(ANDROID)
   set(android_copied_files "")
   set(android_step3_input_files "")
   foreach(file ${handwrittren_lib_project_files_rel})
-    add_custom_command(OUTPUT "${OpenCV_BINARY_DIR}/${file}"
-                   COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${file}" "${OpenCV_BINARY_DIR}/${file}"
-                   MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${file}"
-                   COMMENT "Generating ${file}"
-                  )
+    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${file}" "${OpenCV_BINARY_DIR}/${file}" @ONLY)
     list(APPEND android_copied_files "${OpenCV_BINARY_DIR}/${file}")
     list(APPEND android_step3_input_files "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${file}")
 
@@ -198,7 +194,7 @@ if(ANDROID AND ANDROID_EXECUTABLE)
   ocv_list_add_prefix(lib_target_files "${OpenCV_BINARY_DIR}/")
 
   android_get_compatible_target(lib_target_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${ANDROID_SDK_TARGET} 11)
-  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}"  "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_MANIFEST_FILE}")
+  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" @ONLY)
 
   add_custom_command(OUTPUT ${lib_target_files} "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}"
                      COMMAND ${CMAKE_COMMAND} -E remove ${lib_target_files}
@@ -257,6 +253,13 @@ else(ANDROID)
                      DEPENDS ${step3_depends}
                      COMMENT "Generating ${JAR_NAME}"
                     )
+
+  if(WIN32)
+    set(JAR_INSTALL_DIR java)
+  else(WIN32)
+    set(JAR_INSTALL_DIR share/OpenCV/java)
+  endif(WIN32)
+  install(FILES ${JAR_FILE} DESTINATION ${JAR_INSTALL_DIR} COMPONENT main)
 endif(ANDROID)
 
 # step 5: build native part
@@ -291,7 +294,8 @@ endif()
 
 # Additional target properties
 set_target_properties(${the_module} PROPERTIES
-    OUTPUT_NAME "${the_module}"
+    OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
+    DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
     ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
     RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
     INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH}
@@ -308,9 +312,15 @@ if(ENABLE_SOLUTION_FOLDERS)
   set_target_properties(${the_module} PROPERTIES FOLDER "bindings")
 endif()
 
-install(TARGETS ${the_module}
-        LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
-        ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+if(ANDROID)
+  install(TARGETS ${the_module}
+          LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
+          ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+else()
+  install(TARGETS ${the_module}
+          RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT main
+          LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT main)
+endif()
 
 ######################################################################################################################################
 
index b545c24..818be7f 100644 (file)
@@ -198,7 +198,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
          */
         /* First step - initialize camera connection */
         Log.d(TAG, "Connecting to camera");
-        if (!initializeCamera(getWidth(), getHeight()))
+        if (!initializeCamera(width, height))
             return false;
 
         /* now we can start update thread */
index 7e55d9b..3802167 100644 (file)
@@ -37,7 +37,7 @@ public class NativeCameraView extends CameraBridgeViewBase {
          * 2. We need to start thread which will be getting frames
          */
         /* First step - initialize camera connection */
-        if (!initializeCamera(getWidth(), getHeight()))
+        if (!initializeCamera(width, height))
             return false;
 
         /* now we can start update thread */
index d2dad4a..643626b 100644 (file)
@@ -538,10 +538,12 @@ namespace cv
                     filename = clCxt->impl->Binpath  + kernelName + "_" + clCxt->impl->devName + ".clb";
                 }
 
-                FILE *fp;
-                fp = fopen(filename.c_str(), "rb");
-                if(fp == NULL || clCxt->impl->Binpath.size() == 0)    //we should genetate a binary file for the first time.
+                FILE *fp = fopen(filename.c_str(), "rb");
+                if(fp == NULL || clCxt->impl->Binpath.size() == 0)    //we should generate a binary file for the first time.
                 {
+                    if(fp != NULL)
+                        fclose(fp);
+
                     program = clCreateProgramWithSource(
                                   clCxt->impl->clContext, 1, source, NULL, &status);
                     openCLVerifyCall(status);
index 721c0e3..d082f9c 100644 (file)
@@ -15,115 +15,145 @@ if __name__ == "__main__":
         help = "output results in text format (can be 'txt', 'html' or 'auto' - default)",
         metavar = 'FMT', default = 'auto')
 
+    parser.add_option("--failed-only", action = "store_true", dest = "failedOnly",
+        help = "print only failed tests", default = False)
+
     (options, args) = parser.parse_args()
-    if 1 != len(args):
-        parser.print_help()
-        exit(0)
 
     options.generateHtml = detectHtmlOutputType(options.format)
 
-    input_file = args[0]
-    file = os.path.abspath(input_file)
-    if not os.path.isfile(file):
-        sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep)
-        parser.print_help()
-        exit(0)
-
-    test_sets = []
-    try:
-        tests = testlog_parser.parseLogFile(file)
-        if tests:
-            test_sets.append((os.path.basename(file), tests))
-    except IOError as err:
-        sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep)
-    except xml.parsers.expat.ExpatError as err:
-        sys.stderr.write("ExpatError reading \"" + file + "\" - " + str(err) + os.linesep)
-
-    if not test_sets:
-        sys.stderr.write("Error: no test data found" + os.linesep)
-        exit(0)
-
-    # find matches
-    setsCount = len(test_sets)
-    test_cases = {}
-
-    name_extractor = lambda name: str(name)
-
-    for i in range(setsCount):
-        for case in test_sets[i][1]:
-            name = name_extractor(case)
-            if name not in test_cases:
-                test_cases[name] = [None] * setsCount
-            test_cases[name][i] = case
-
-    testsuits = [] # testsuit name, time, num, flag for failed tests
-
+    files = []
+    testsuits = [] # testsuit module, name, time, num, flag for failed tests
     overall_time = 0
-    prevGroupName = None
-    suit_time = 0
-    suit_num = 0
-    fails_num = 0
-    for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector):
-        cases = test_cases[name]
-
-        groupName = next(c for c in cases if c).shortName()
-        if groupName != prevGroupName:
-            if prevGroupName != None:
-                suit_time = suit_time/60 #from seconds to minutes
-                testsuits.append({'name': prevGroupName, 'time': suit_time, \
-                    'num': suit_num, 'failed': fails_num})
-                overall_time += suit_time
-                suit_time = 0
-                suit_num = 0
-                fails_num = 0
-            prevGroupName = groupName
-
-        for i in range(setsCount):
-            case = cases[i]
-            if not case is None:
-                suit_num += 1
-                if case.get('status') == 'run':
-                    suit_time += case.get('time')
-                if case.get('status') == 'failed':
-                    fails_num += 1
-
-    testsuits.append({'name': prevGroupName, 'time': suit_time, \
-        'num': suit_num, 'failed': fails_num})
+
+    seen = set()
+    for arg in args:
+        if ("*" in arg) or ("?" in arg):
+            flist = [os.path.abspath(f) for f in glob.glob(arg)]
+            flist = sorted(flist, key= lambda text: str(text).replace("M", "_"))
+            files.extend([ x for x in flist if x not in seen and not seen.add(x)])
+        else:
+            fname = os.path.abspath(arg)
+            if fname not in seen and not seen.add(fname):
+                files.append(fname)
+
+            file = os.path.abspath(fname)
+            if not os.path.isfile(file):
+                sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep)
+                parser.print_help()
+                exit(0)
+
+            fname = os.path.basename(fname)
+            find_module_name = re.search(r'([^_]*)', fname)
+            module_name = find_module_name.group(0)
+
+            test_sets = []
+            try:
+                tests = testlog_parser.parseLogFile(file)
+                if tests:
+                    test_sets.append((os.path.basename(file), tests))
+            except IOError as err:
+                sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep)
+            except xml.parsers.expat.ExpatError as err:
+                sys.stderr.write("ExpatError reading \"" + file + "\" - " + str(err) + os.linesep)
+
+            if not test_sets:
+                continue
+
+            # find matches
+            setsCount = len(test_sets)
+            test_cases = {}
+
+            name_extractor = lambda name: str(name)
+
+            for i in range(setsCount):
+                for case in test_sets[i][1]:
+                    name = name_extractor(case)
+                    if name not in test_cases:
+                        test_cases[name] = [None] * setsCount
+                    test_cases[name][i] = case
+
+            prevGroupName = None
+            suit_time = 0
+            suit_num = 0
+            fails_num = 0
+            for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector):
+                cases = test_cases[name]
+
+                groupName = next(c for c in cases if c).shortName()
+                if groupName != prevGroupName:
+                    if prevGroupName != None:
+                        suit_time = suit_time/60 #from seconds to minutes
+                        testsuits.append({'module': module_name, 'name': prevGroupName, \
+                            'time': suit_time, 'num': suit_num, 'failed': fails_num})
+                        overall_time += suit_time
+                        suit_time = 0
+                        suit_num = 0
+                        fails_num = 0
+                    prevGroupName = groupName
+
+                for i in range(setsCount):
+                    case = cases[i]
+                    if not case is None:
+                        suit_num += 1
+                        if case.get('status') == 'run':
+                            suit_time += case.get('time')
+                        if case.get('status') == 'failed':
+                            fails_num += 1
+
+            # last testsuit processing
+            suit_time = suit_time/60
+            testsuits.append({'module': module_name, 'name': prevGroupName, \
+                'time': suit_time, 'num': suit_num, 'failed': fails_num})
+            overall_time += suit_time
 
     if len(testsuits)==0:
-        print 'No testsuits found'
         exit(0)
 
     tbl = table()
+    rows = 0
+
+    if not options.failedOnly:
+        tbl.newColumn('module', 'Module', align = 'left', cssclass = 'col_name')
+        tbl.newColumn('name', 'Testsuit', align = 'left', cssclass = 'col_name')
+        tbl.newColumn('time', 'Time (min)', align = 'center', cssclass = 'col_name')
+        tbl.newColumn('num', 'Num of tests', align = 'center', cssclass = 'col_name')
+        tbl.newColumn('failed', 'Failed', align = 'center', cssclass = 'col_name')
+
+        # rows
+        for suit in sorted(testsuits, key = lambda suit: suit['time'], reverse = True):
+            tbl.newRow()
+            tbl.newCell('module', suit['module'])
+            tbl.newCell('name', suit['name'])
+            tbl.newCell('time', formatValue(suit['time'], '', ''), suit['time'])
+            tbl.newCell('num', suit['num'])
+            if (suit['failed'] != 0):
+                tbl.newCell('failed', suit['failed'])
+            else:
+                tbl.newCell('failed', ' ')
+            rows += 1
 
-    # header
-    tbl.newColumn('name', 'Testsuit', align = 'left', cssclass = 'col_name')
-    tbl.newColumn('time', 'Time (min)', align = 'center', cssclass = 'col_name')
-    tbl.newColumn('num', 'Num of tests', align = 'center', cssclass = 'col_name')
-    tbl.newColumn('failed', 'Failed', align = 'center', cssclass = 'col_name')
-
-    # rows
-    for suit in sorted(testsuits, key = lambda suit: suit['time'], reverse = True):
-        tbl.newRow()
-        tbl.newCell('name', suit['name'])
-        tbl.newCell('time', formatValue(suit['time'], '', ''), suit['time'])
-        tbl.newCell('num', suit['num'])
-        if (suit['failed'] != 0):
-            tbl.newCell('failed', suit['failed'])
-        else:
-            tbl.newCell('failed', ' ')
+    else:
+        tbl.newColumn('module', 'Module', align = 'left', cssclass = 'col_name')
+        tbl.newColumn('name', 'Testsuit', align = 'left', cssclass = 'col_name')
+        tbl.newColumn('failed', 'Failed', align = 'center', cssclass = 'col_name')
+
+        # rows
+        for suit in sorted(testsuits, key = lambda suit: suit['time'], reverse = True):
+            if (suit['failed'] != 0):
+                tbl.newRow()
+                tbl.newCell('module', suit['module'])
+                tbl.newCell('name', suit['name'])
+                tbl.newCell('failed', suit['failed'])
+                rows += 1
 
     # output table
-    if options.generateHtml:
-        tbl.htmlPrintTable(sys.stdout)
-        htmlPrintFooter(sys.stdout)
-    else:
-        input_file = re.sub(r'^[\.\/]*', '', input_file)
-        find_module_name = re.search(r'([^_]*)', input_file)
-        module_name = find_module_name.group(0)
-
-        splitter = 15 * '*'
-        print '\n%s\n  %s\n%s\n' % (splitter, module_name, splitter)
-        print 'Overall time: %.2f min\n' % overall_time
-        tbl.consolePrintTable(sys.stdout)
-        print 4 * '\n'
\ No newline at end of file
+    if rows:
+        if options.generateHtml:
+            tbl.htmlPrintTable(sys.stdout)
+            htmlPrintFooter(sys.stdout)
+        else:
+            if not options.failedOnly:
+                print '\nOverall time: %.2f min\n' % overall_time
+            tbl.consolePrintTable(sys.stdout)
+            print 2 * '\n'
\ No newline at end of file
index b1cb628..a0794cb 100644 (file)
@@ -11,11 +11,9 @@ add_subdirectory(face-detection)
 add_subdirectory(image-manipulations)
 add_subdirectory(color-blob-detection)
 
-add_subdirectory(tutorial-1-addopencv)
-add_subdirectory(tutorial-2-opencvcamera)
-add_subdirectory(tutorial-3-native)
-add_subdirectory(tutorial-4-mixed)
-add_subdirectory(tutorial-5-cameracontrol)
+add_subdirectory(tutorial-1-camerapreview)
+add_subdirectory(tutorial-2-mixedprocessing)
+add_subdirectory(tutorial-3-cameracontrol)
 
 #hello-android sample
 if(HAVE_opencv_highgui)
diff --git a/samples/android/tutorial-1-addopencv/.classpath b/samples/android/tutorial-1-addopencv/.classpath
deleted file mode 100644 (file)
index 3f9691c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="gen"/>
-       <classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/samples/android/tutorial-1-addopencv/.settings/org.eclipse.jdt.core.prefs b/samples/android/tutorial-1-addopencv/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index b080d2d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/samples/android/tutorial-1-addopencv/res/drawable/icon.png b/samples/android/tutorial-1-addopencv/res/drawable/icon.png
deleted file mode 100644 (file)
index 6304549..0000000
Binary files a/samples/android/tutorial-1-addopencv/res/drawable/icon.png and /dev/null differ
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>OpenCV Tutorial 1 - Add OpenCV</name>
+       <name>OpenCV Tutorial 1 - Camera Preview</name>
        <comment></comment>
        <projects>
        </projects>
@@ -9,7 +9,7 @@
         android:icon="@drawable/icon"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
 
-        <activity android:name="Sample1Java"
+        <activity android:name="Tutorial1Activity"
                   android:label="@string/app_name"
                   android:screenOrientation="landscape"
                   android:configChanges="keyboardHidden|orientation">
@@ -1,4 +1,4 @@
-set(sample example-tutorial-1-addopencv)
+set(sample example-tutorial-1-camerapreview)
 
 add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
 if(TARGET ${sample})
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="app_name">OCV T1 Add OpenCV</string>
+    <string name="app_name">OCV T1 Preview</string>
 </resources>
@@ -17,7 +17,7 @@ import android.view.SurfaceView;
 import android.view.WindowManager;
 import android.widget.Toast;
 
-public class Sample1Java extends Activity implements CvCameraViewListener2 {
+public class Tutorial1Activity extends Activity implements CvCameraViewListener2 {
     private static final String TAG = "OCVSample::Activity";
 
     private CameraBridgeViewBase mOpenCvCameraView;
@@ -41,7 +41,7 @@ public class Sample1Java extends Activity implements CvCameraViewListener2 {
         }
     };
 
-    public Sample1Java() {
+    public Tutorial1Activity() {
         Log.i(TAG, "Instantiated new " + this.getClass());
     }
 
@@ -88,7 +88,7 @@ public class Sample1Java extends Activity implements CvCameraViewListener2 {
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         Log.i(TAG, "called onCreateOptionsMenu");
-        mItemSwitchCamera = menu.add("Switch camera");
+        mItemSwitchCamera = menu.add("Toggle Native/Java camera");
         return true;
     }
 
@@ -60,7 +60,7 @@
                </cconfiguration>
        </storageModule>
        <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-               <project id="OpenCV Tutorial 4 - Mix Java+Native OpenCV.null.1819504790" name="OpenCV Tutorial 4 - Mix Java+Native OpenCV"/>
+               <project id="OpenCV Tutorial 2 - Mixed Processing OpenCV.null.1819504790" name="OpenCV Tutorial 2 - Mixed Processing"/>
        </storageModule>
        <storageModule moduleId="scannerConfiguration">
                <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
@@ -69,6 +69,6 @@
                </scannerConfigBuildInfo>
        </storageModule>
        <storageModule moduleId="refreshScope" versionNumber="1">
-               <resource resourceType="PROJECT" workspacePath="/OpenCV Tutorial 4 - Mix Java+Native OpenCV"/>
+               <resource resourceType="PROJECT" workspacePath="/OpenCV Tutorial 2 - Mixed Processing"/>
        </storageModule>
 </cproject>
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>OpenCV Tutorial 3 - Add Native OpenCV</name>
+       <name>OpenCV Tutorial 2 - Mixed Processing</name>
        <comment></comment>
        <projects>
        </projects>
@@ -9,7 +9,7 @@
         android:icon="@drawable/icon"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
 
-        <activity android:name="Sample2NativeCamera"
+        <activity android:name="Tutorial2Activity"
                   android:label="@string/app_name"
                   android:screenOrientation="landscape"
                   android:configChanges="keyboardHidden|orientation">
@@ -1,4 +1,4 @@
-set(sample example-tutorial-4-mixed)
+set(sample example-tutorial-2-mixedprocessing)
 
 if(BUILD_FAT_JAVA_LIB)
   set(native_deps opencv_java)
@@ -8,9 +8,9 @@ using namespace std;
 using namespace cv;
 
 extern "C" {
-JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4Mixed_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
+JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tuturial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
 
-JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4Mixed_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
+JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
 {
     Mat& mGr  = *(Mat*)addrGray;
     Mat& mRgb = *(Mat*)addrRgba;
@@ -3,7 +3,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
 
-    <org.opencv.android.NativeCameraView
+    <org.opencv.android.JavaCameraView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:id="@+id/tutorial2_activity_surface_view" />
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="app_name">OCV T2 Use OpenCV Camera</string>
+    <string name="app_name">OCV T2 Mixed Processing</string>
 </resources>
@@ -1,4 +1,4 @@
-package org.opencv.samples.tutorial4;
+package org.opencv.samples.tutorial2;
 
 import org.opencv.android.BaseLoaderCallback;
 import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
@@ -17,7 +17,7 @@ import android.view.Menu;
 import android.view.MenuItem;
 import android.view.WindowManager;
 
-public class Sample4Mixed extends Activity implements CvCameraViewListener2 {
+public class Tutorial2Activity extends Activity implements CvCameraViewListener2 {
     private static final String    TAG = "OCVSample::Activity";
 
     private static final int       VIEW_MODE_RGBA     = 0;
@@ -58,7 +58,7 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener2 {
         }
     };
 
-    public Sample4Mixed() {
+    public Tutorial2Activity() {
         Log.i(TAG, "Instantiated new " + this.getClass());
     }
 
@@ -69,9 +69,9 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener2 {
         super.onCreate(savedInstanceState);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 
-        setContentView(R.layout.tutorial4_surface_view);
+        setContentView(R.layout.tutorial2_surface_view);
 
-        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial4_activity_surface_view);
+        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);
         mOpenCvCameraView.setCvCameraViewListener(this);
     }
 
diff --git a/samples/android/tutorial-2-opencvcamera/.project b/samples/android/tutorial-2-opencvcamera/.project
deleted file mode 100644 (file)
index 1d6c7f6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>OpenCV Tutorial 2 - Use OpenCV Camera</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/samples/android/tutorial-2-opencvcamera/.settings/org.eclipse.jdt.core.prefs b/samples/android/tutorial-2-opencvcamera/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index b080d2d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/samples/android/tutorial-2-opencvcamera/res/drawable/icon.png b/samples/android/tutorial-2-opencvcamera/res/drawable/icon.png
deleted file mode 100644 (file)
index 6304549..0000000
Binary files a/samples/android/tutorial-2-opencvcamera/res/drawable/icon.png and /dev/null differ
diff --git a/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java b/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java
deleted file mode 100644 (file)
index 3a19ffd..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.opencv.samples.tutorial2;
-
-import org.opencv.android.BaseLoaderCallback;
-import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
-import org.opencv.android.LoaderCallbackInterface;
-import org.opencv.android.OpenCVLoader;
-import org.opencv.core.Core;
-import org.opencv.core.CvType;
-import org.opencv.core.Mat;
-import org.opencv.core.Point;
-import org.opencv.core.Scalar;
-import org.opencv.android.CameraBridgeViewBase;
-import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;
-import org.opencv.imgproc.Imgproc;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.WindowManager;
-
-public class Sample2NativeCamera extends Activity implements CvCameraViewListener2 {
-    private static final String  TAG             = "OCVSample::Activity";
-
-    public static final int      VIEW_MODE_RGBA  = 0;
-    public static final int      VIEW_MODE_GRAY  = 1;
-    public static final int      VIEW_MODE_CANNY = 2;
-
-    private static int           viewMode       = VIEW_MODE_RGBA;
-    private MenuItem             mItemPreviewRGBA;
-    private MenuItem             mItemPreviewGray;
-    private MenuItem             mItemPreviewCanny;
-    private Mat                  mRgba;
-    private Mat                  mIntermediateMat;
-
-    private CameraBridgeViewBase mOpenCvCameraView;
-
-    private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {
-        @Override
-        public void onManagerConnected(int status) {
-            switch (status) {
-                case LoaderCallbackInterface.SUCCESS:
-                {
-                    Log.i(TAG, "OpenCV loaded successfully");
-                    mOpenCvCameraView.enableView();
-                } break;
-                default:
-                {
-                    super.onManagerConnected(status);
-                } break;
-            }
-        }
-    };
-
-    public Sample2NativeCamera() {
-        Log.i(TAG, "Instantiated new " + this.getClass());
-    }
-
-    /** Called when the activity is first created. */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        Log.i(TAG, "called onCreate");
-        super.onCreate(savedInstanceState);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-
-        setContentView(R.layout.tutorial2_surface_view);
-
-        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);
-        mOpenCvCameraView.setCvCameraViewListener(this);
-    }
-
-    @Override
-    public void onPause()
-    {
-        super.onPause();
-        if (mOpenCvCameraView != null)
-            mOpenCvCameraView.disableView();
-    }
-
-    @Override
-    public void onResume()
-    {
-        super.onResume();
-        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
-    }
-
-    public void onDestroy() {
-        super.onDestroy();
-        if (mOpenCvCameraView != null)
-            mOpenCvCameraView.disableView();
-    }
-
-    public void onCameraViewStarted(int width, int height) {
-        mRgba = new Mat(height, width, CvType.CV_8UC4);
-        mIntermediateMat = new Mat(height, width, CvType.CV_8UC4);
-    }
-
-    public void onCameraViewStopped() {
-        mRgba.release();
-        mIntermediateMat.release();
-    }
-
-    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
-        switch (Sample2NativeCamera.viewMode) {
-            case Sample2NativeCamera.VIEW_MODE_GRAY:
-            {
-                Imgproc.cvtColor(inputFrame.gray(), mRgba, Imgproc.COLOR_GRAY2RGBA, 4);
-            } break;
-            case Sample2NativeCamera.VIEW_MODE_RGBA:
-            {
-                mRgba = inputFrame.rgba();
-                Core.putText(mRgba, "OpenCV+Android", new Point(10, mRgba.rows() - 10), 3, 1, new Scalar(255, 0, 0, 255), 2);
-            } break;
-            case Sample2NativeCamera.VIEW_MODE_CANNY:
-            {
-                Imgproc.Canny(inputFrame.gray(), mIntermediateMat, 80, 100);
-                Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2BGRA, 4);
-            } break;
-        }
-
-        return mRgba;
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        Log.i(TAG, "called onCreateOptionsMenu");
-        mItemPreviewRGBA = menu.add("Preview RGBA");
-        mItemPreviewGray = menu.add("Preview GRAY");
-        mItemPreviewCanny = menu.add("Canny");
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        Log.i(TAG, "called onOptionsItemSelected; selected item: " + item);
-        if (item == mItemPreviewRGBA)
-        {
-            viewMode = VIEW_MODE_RGBA;
-        }
-        else if (item == mItemPreviewGray)
-        {
-            viewMode = VIEW_MODE_GRAY;
-        }
-        else if (item == mItemPreviewCanny)
-        {
-            viewMode = VIEW_MODE_CANNY;
-        }
-
-        return true;
-    }
-}
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>OpenCV Tutorial 5 - Camera Control</name>
+       <name>OpenCV Tutorial 3 - Camera Control</name>
        <comment></comment>
        <projects>
        </projects>
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="org.opencv.samples.tutorial5"
+          package="org.opencv.samples.tutorial3"
           android:versionCode="21"
           android:versionName="2.1">
 
@@ -9,7 +9,7 @@
         android:icon="@drawable/icon"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
 
-        <activity android:name="Sample5CameraControl"
+        <activity android:name="Tutorial3Activity"
                   android:label="@string/app_name"
                   android:screenOrientation="landscape"
                   android:configChanges="keyboardHidden|orientation">
@@ -1,4 +1,4 @@
-set(sample example-tutorial-2-opencvcamera)
+set(sample example-tutorial-3-cameracontrol)
 
 add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
 if(TARGET ${sample})
@@ -3,10 +3,10 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
 
-    <org.opencv.samples.tutorial5.SampleJavaCameraView
+    <org.opencv.samples.tutorial3.Tutorial3View
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:visibility="gone"
-        android:id="@+id/tutorial5_activity_java_surface_view" />
+        android:id="@+id/tutorial3_activity_java_surface_view" />
 
 </LinearLayout>
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="app_name">OCV T5 Camera Control</string>
+    <string name="app_name">OCV T3 Camera Control</string>
 </resources>
@@ -1,4 +1,4 @@
-package org.opencv.samples.tutorial5;
+package org.opencv.samples.tutorial3;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -28,10 +28,10 @@ import android.view.View.OnTouchListener;
 import android.view.WindowManager;
 import android.widget.Toast;
 
-public class Sample5CameraControl extends Activity implements CvCameraViewListener2, OnTouchListener {
+public class Tutorial3Activity extends Activity implements CvCameraViewListener2, OnTouchListener {
     private static final String TAG = "OCVSample::Activity";
 
-    private SampleJavaCameraView mOpenCvCameraView;
+    private Tutorial3View mOpenCvCameraView;
     private List<Size> mResolutionList;
     private MenuItem[] mEffectMenuItems;
     private SubMenu mColorEffectsMenu;
@@ -46,7 +46,7 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
                 {
                     Log.i(TAG, "OpenCV loaded successfully");
                     mOpenCvCameraView.enableView();
-                    mOpenCvCameraView.setOnTouchListener(Sample5CameraControl.this);
+                    mOpenCvCameraView.setOnTouchListener(Tutorial3Activity.this);
                 } break;
                 default:
                 {
@@ -56,7 +56,7 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
         }
     };
 
-    public Sample5CameraControl() {
+    public Tutorial3Activity() {
         Log.i(TAG, "Instantiated new " + this.getClass());
     }
 
@@ -67,9 +67,9 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
         super.onCreate(savedInstanceState);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 
-        setContentView(R.layout.tutorial5_surface_view);
+        setContentView(R.layout.tutorial3_surface_view);
 
-        mOpenCvCameraView = (SampleJavaCameraView) findViewById(R.id.tutorial5_activity_java_surface_view);
+        mOpenCvCameraView = (Tutorial3View) findViewById(R.id.tutorial3_activity_java_surface_view);
 
         mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
 
@@ -1,4 +1,4 @@
-package org.opencv.samples.tutorial5;
+package org.opencv.samples.tutorial3;
 
 import java.io.FileOutputStream;
 import java.util.List;
@@ -14,11 +14,11 @@ import android.hardware.Camera.Size;
 import android.util.AttributeSet;
 import android.util.Log;
 
-public class SampleJavaCameraView extends JavaCameraView {
+public class Tutorial3View extends JavaCameraView {
 
-    private static final String TAG = "Sample::SampleJavaCameraView";
+    private static final String TAG = "Sample::Tutorial3View";
 
-    public SampleJavaCameraView(Context context, AttributeSet attrs) {
+    public Tutorial3View(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
diff --git a/samples/android/tutorial-3-native/.classpath b/samples/android/tutorial-3-native/.classpath
deleted file mode 100644 (file)
index d3bb07b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="gen"/>
-       <classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/samples/android/tutorial-3-native/.cproject b/samples/android/tutorial-3-native/.cproject
deleted file mode 100644 (file)
index 0ea6ad6..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 4.0.0?>
-
-<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
-       <storageModule moduleId="org.eclipse.cdt.core.settings">
-               <cconfiguration id="0.1851062783">
-                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1851062783" moduleId="org.eclipse.cdt.core.settings" name="Default">
-                               <externalSettings/>
-                               <extensions>
-                                       <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                               </extensions>
-                       </storageModule>
-                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1851062783" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
-                                       <folderInfo id="0.1851062783." name="/" resourcePath="">
-                                               <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.114738979" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
-                                                       <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.114738979.901399641" name=""/>
-                                                       <builder autoBuildTarget="" command="${NDKROOT}/ndk-build.cmd" enableAutoBuild="true" enableCleanBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.1153158428" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
-                                                       <tool id="org.eclipse.cdt.build.core.settings.holder.libs.835006420" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
-                                                       <tool id="org.eclipse.cdt.build.core.settings.holder.1350943194" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
-                                                               <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1640025837" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-                                                       </tool>
-                                                       <tool id="org.eclipse.cdt.build.core.settings.holder.982773030" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
-                                                               <option id="org.eclipse.cdt.build.core.settings.holder.incpaths.332905639" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/platforms/android-9/arch-arm/usr/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../sdk/native/jni/include&quot;"/>
-                                                               </option>
-                                                               <option id="org.eclipse.cdt.build.core.settings.holder.symbols.1475512260" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
-                                                                       <listOptionValue builtIn="false" value="ANDROID=1"/>
-                                                               </option>
-                                                               <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1082980466" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-                                                       </tool>
-                                                       <tool id="org.eclipse.cdt.build.core.settings.holder.472513352" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
-                                                               <option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1490236166" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/platforms/android-9/arch-arm/usr/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../sdk/native/jni/include&quot;"/>
-                                                               </option>
-                                                               <option id="org.eclipse.cdt.build.core.settings.holder.symbols.945696849" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
-                                                                       <listOptionValue builtIn="false" value="ANDROID=1"/>
-                                                               </option>
-                                                               <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.775624510" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-                                                       </tool>
-                                               </toolChain>
-                                       </folderInfo>
-                                       <sourceEntries>
-                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="jni"/>
-                                       </sourceEntries>
-                               </configuration>
-                       </storageModule>
-                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-               </cconfiguration>
-       </storageModule>
-       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-               <project id="OpenCV Tutorial 3 - Add Native OpenCV.null.1740260315" name="OpenCV Tutorial 3 - Add Native OpenCV"/>
-       </storageModule>
-       <storageModule moduleId="scannerConfiguration">
-               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               <scannerConfigBuildInfo instanceId="0.1851062783">
-                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               </scannerConfigBuildInfo>
-       </storageModule>
-       <storageModule moduleId="refreshScope" versionNumber="1">
-               <resource resourceType="PROJECT" workspacePath="/OpenCV Tutorial 3 - Add Native OpenCV"/>
-       </storageModule>
-       <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
-</cproject>
diff --git a/samples/android/tutorial-3-native/AndroidManifest.xml b/samples/android/tutorial-3-native/AndroidManifest.xml
deleted file mode 100644 (file)
index 164b81d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="org.opencv.samples.tutorial3"
-          android:versionCode="21"
-          android:versionName="2.1">
-
-    <application
-        android:label="@string/app_name"
-        android:icon="@drawable/icon"
-        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
-
-        <activity android:name="Sample3Native"
-                  android:label="@string/app_name"
-                  android:screenOrientation="landscape"
-                  android:configChanges="keyboardHidden|orientation">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-    <supports-screens android:resizeable="true"
-                      android:smallScreens="true"
-                      android:normalScreens="true"
-                      android:largeScreens="true"
-                      android:anyDensity="true" />
-
-    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />
-
-    <uses-permission android:name="android.permission.CAMERA"/>
-
-    <uses-feature android:name="android.hardware.camera" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
-
-</manifest>
diff --git a/samples/android/tutorial-3-native/CMakeLists.txt b/samples/android/tutorial-3-native/CMakeLists.txt
deleted file mode 100644 (file)
index c3c1970..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-set(sample example-tutorial-3-native)
-
-if(BUILD_FAT_JAVA_LIB)
-  set(native_deps opencv_java)
-else()
-  set(native_deps opencv_features2d)
-endif()
-
-add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET} NATIVE_DEPS ${native_deps})
-if(TARGET ${sample})
-  add_dependencies(opencv_android_examples ${sample})
-endif()
diff --git a/samples/android/tutorial-3-native/jni/Android.mk b/samples/android/tutorial-3-native/jni/Android.mk
deleted file mode 100644 (file)
index 372d65a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include ../../sdk/native/jni/OpenCV.mk
-
-LOCAL_MODULE    := native_sample
-LOCAL_SRC_FILES := jni_part.cpp
-LOCAL_LDLIBS +=  -llog -ldl
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/samples/android/tutorial-3-native/jni/Application.mk b/samples/android/tutorial-3-native/jni/Application.mk
deleted file mode 100644 (file)
index 4fffcb2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-APP_STL := gnustl_static
-APP_CPPFLAGS := -frtti -fexceptions
-APP_ABI := armeabi-v7a
-APP_PLATFORM := android-8
diff --git a/samples/android/tutorial-3-native/jni/jni_part.cpp b/samples/android/tutorial-3-native/jni/jni_part.cpp
deleted file mode 100644 (file)
index aa9acac..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <jni.h>
-#include <opencv2/core/core.hpp>
-#include <opencv2/imgproc/imgproc.hpp>
-#include <opencv2/features2d/features2d.hpp>
-#include <vector>
-
-using namespace std;
-using namespace cv;
-
-extern "C" {
-JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
-
-JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
-{
-    Mat& mGr  = *(Mat*)addrGray;
-    Mat& mRgb = *(Mat*)addrRgba;
-    vector<KeyPoint> v;
-
-    FastFeatureDetector detector(50);
-    detector.detect(mGr, v);
-    for( unsigned int i = 0; i < v.size(); i++ )
-    {
-        const KeyPoint& kp = v[i];
-        circle(mRgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(255,0,0,255));
-    }
-}
-}
diff --git a/samples/android/tutorial-3-native/res/layout/tutorial3_surface_view.xml b/samples/android/tutorial-3-native/res/layout/tutorial3_surface_view.xml
deleted file mode 100644 (file)
index 71cd6e0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
-
-    <org.opencv.android.JavaCameraView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:id="@+id/tutorial4_activity_surface_view" />
-
-</LinearLayout>
diff --git a/samples/android/tutorial-3-native/res/values/strings.xml b/samples/android/tutorial-3-native/res/values/strings.xml
deleted file mode 100644 (file)
index 41c5420..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <string name="app_name">OCV T3 Add Native OpenCV</string>
-</resources>
diff --git a/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java b/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java
deleted file mode 100644 (file)
index 71990fa..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.opencv.samples.tutorial3;
-
-import org.opencv.android.BaseLoaderCallback;
-import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
-import org.opencv.android.LoaderCallbackInterface;
-import org.opencv.android.OpenCVLoader;
-import org.opencv.core.CvType;
-import org.opencv.core.Mat;
-import org.opencv.android.CameraBridgeViewBase;
-import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-public class Sample3Native extends Activity implements CvCameraViewListener2 {
-    private static final String TAG = "OCVSample::Activity";
-
-    private Mat                    mRgba;
-    private Mat                    mGray;
-    private CameraBridgeViewBase   mOpenCvCameraView;
-
-    private BaseLoaderCallback     mLoaderCallback = new BaseLoaderCallback(this) {
-        @Override
-        public void onManagerConnected(int status) {
-            switch (status) {
-                case LoaderCallbackInterface.SUCCESS:
-                {
-                    Log.i(TAG, "OpenCV loaded successfully");
-
-                    // Load native library after(!) OpenCV initialization
-                    System.loadLibrary("native_sample");
-
-                    mOpenCvCameraView.enableView();
-                } break;
-                default:
-                {
-                    super.onManagerConnected(status);
-                } break;
-            }
-        }
-    };
-
-    public Sample3Native() {
-        Log.i(TAG, "Instantiated new " + this.getClass());
-    }
-
-    /** Called when the activity is first created. */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        Log.i(TAG, "called onCreate");
-        super.onCreate(savedInstanceState);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-
-        setContentView(R.layout.tutorial3_surface_view);
-
-        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial4_activity_surface_view);
-        mOpenCvCameraView.setCvCameraViewListener(this);
-    }
-
-    @Override
-    public void onPause()
-    {
-        super.onPause();
-        if (mOpenCvCameraView != null)
-            mOpenCvCameraView.disableView();
-    }
-
-    @Override
-    public void onResume()
-    {
-        super.onResume();
-        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
-    }
-
-    public void onDestroy() {
-        super.onDestroy();
-        if (mOpenCvCameraView != null)
-            mOpenCvCameraView.disableView();
-    }
-
-    public void onCameraViewStarted(int width, int height) {
-        mRgba = new Mat(height, width, CvType.CV_8UC4);
-        mGray = new Mat(height, width, CvType.CV_8UC1);
-    }
-
-    public void onCameraViewStopped() {
-        mRgba.release();
-        mGray.release();
-    }
-
-    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
-        mRgba = inputFrame.rgba();
-        mGray = inputFrame.gray();
-        FindFeatures(mGray.getNativeObjAddr(), mRgba.getNativeObjAddr());
-
-        return mRgba;
-    }
-
-    public native void FindFeatures(long matAddrGr, long matAddrRgba);
-}
diff --git a/samples/android/tutorial-4-mixed/.project b/samples/android/tutorial-4-mixed/.project
deleted file mode 100644 (file)
index 9012394..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>OpenCV Tutorial 4 - Mix Java+Native OpenCV</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-                       <triggers>auto,full,incremental,</triggers>
-                       <arguments>
-                               <dictionary>
-                                       <key>?name?</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.append_environment</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
-                                       <value>${NDKROOT}/ndk-build.cmd</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-                                       <value>clean</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.contents</key>
-                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
-                                       <value>false</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-                                       <value>false</value>
-                               </dictionary>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-                       <triggers>full,incremental,</triggers>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-               <nature>org.eclipse.cdt.core.cnature</nature>
-               <nature>org.eclipse.cdt.core.ccnature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-       </natures>
-</projectDescription>
diff --git a/samples/android/tutorial-4-mixed/AndroidManifest.xml b/samples/android/tutorial-4-mixed/AndroidManifest.xml
deleted file mode 100644 (file)
index 22266fb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="org.opencv.samples.tutorial4"
-          android:versionCode="21"
-          android:versionName="2.1">
-
-    <application
-        android:label="@string/app_name"
-        android:icon="@drawable/icon"
-        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
-
-        <activity android:name="Sample4Mixed"
-                  android:label="@string/app_name"
-                  android:screenOrientation="landscape"
-                  android:configChanges="keyboardHidden|orientation">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-    <supports-screens android:resizeable="true"
-                      android:smallScreens="true"
-                      android:normalScreens="true"
-                      android:largeScreens="true"
-                      android:anyDensity="true" />
-
-    <uses-sdk android:minSdkVersion="8" />
-
-    <uses-permission android:name="android.permission.CAMERA"/>
-
-    <uses-feature android:name="android.hardware.camera" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
-    <uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
-
-</manifest>
diff --git a/samples/android/tutorial-4-mixed/res/layout/tutorial4_surface_view.xml b/samples/android/tutorial-4-mixed/res/layout/tutorial4_surface_view.xml
deleted file mode 100644 (file)
index 71cd6e0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
-
-    <org.opencv.android.JavaCameraView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:id="@+id/tutorial4_activity_surface_view" />
-
-</LinearLayout>
diff --git a/samples/android/tutorial-4-mixed/res/values/strings.xml b/samples/android/tutorial-4-mixed/res/values/strings.xml
deleted file mode 100644 (file)
index da2b018..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <string name="app_name">OCV T4 Mix Java+Native OpenCV</string>
-</resources>
diff --git a/samples/android/tutorial-5-cameracontrol/CMakeLists.txt b/samples/android/tutorial-5-cameracontrol/CMakeLists.txt
deleted file mode 100644 (file)
index 986f754..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-set(sample example-tutorial-5-cameracontrol)
-
-add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
-if(TARGET ${sample})
-  add_dependencies(opencv_android_examples ${sample})
-endif()
-