Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
817a4c0c
Commit
817a4c0c
authored
Dec 12, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 2.4 into perf_verify_sanity
parents
932204d1
64cf113d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
388 additions
and
103 deletions
+388
-103
AndroidManifest.xml
android/service/engine/AndroidManifest.xml
+2
-2
CMakeLists.txt
android/service/engine/CMakeLists.txt
+1
-1
build.xml
android/service/engine/build.xml
+1
-1
Android.mk
android/service/engine/jni/Android.mk
+2
-1
OpenCVLibraryInfo.cpp
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
+88
-0
OpenCVLibraryInfo.h
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h
+27
-0
CommonPackageManager.cpp
...service/engine/jni/NativeService/CommonPackageManager.cpp
+31
-35
PackageInfo.cpp
android/service/engine/jni/NativeService/PackageInfo.cpp
+12
-1
project.properties
android/service/engine/project.properties
+1
-1
MarketConnector.java
...service/engine/src/org/opencv/engine/MarketConnector.java
+6
-10
OpenCVLibraryInfo.java
...rvice/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
+40
-0
ManagerActivity.java
...engine/src/org/opencv/engine/manager/ManagerActivity.java
+79
-14
OpenCVDetectOpenCL.cmake
cmake/OpenCVDetectOpenCL.cmake
+1
-1
CMakeLists.txt
doc/CMakeLists.txt
+21
-5
perf_pnp.cpp
modules/calib3d/perf/perf_pnp.cpp
+1
-1
perf_output.cpp
modules/highgui/perf/perf_output.cpp
+1
-1
grfmt_jpeg.cpp
modules/highgui/src/grfmt_jpeg.cpp
+9
-5
perf_houghLines.cpp
modules/imgproc/perf/perf_houghLines.cpp
+15
-3
perf_stich.cpp
modules/stitching/perf/perf_stich.cpp
+22
-4
ts.hpp
modules/ts/include/opencv2/ts/ts.hpp
+0
-11
ts_gtest.h
modules/ts/include/opencv2/ts/ts_gtest.h
+0
-0
ts_gtest.cpp
modules/ts/src/ts_gtest.cpp
+0
-0
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+6
-5
Sample5CameraControl.java
...rc/org/opencv/samples/tutorial5/Sample5CameraControl.java
+17
-1
SampleJavaCameraView.java
...rc/org/opencv/samples/tutorial5/SampleJavaCameraView.java
+5
-0
No files found.
android/service/engine/AndroidManifest.xml
View file @
817a4c0c
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.opencv.engine"
android:versionCode=
"2
3
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName=
"2.
3
"
>
android:versionCode=
"2
4
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName=
"2.
4
"
>
<uses-sdk
android:minSdkVersion=
"@ANDROID_NATIVE_API_LEVEL@"
/>
<uses-feature
android:name=
"android.hardware.touchscreen"
android:required=
"false"
/>
...
...
android/service/engine/CMakeLists.txt
View file @
817a4c0c
...
...
@@ -2,7 +2,7 @@ set(engine OpenCVEngine)
set
(
JNI_LIB_NAME
${
engine
}
${
engine
}
_jni
)
unset
(
__android_project_chain CACHE
)
add_android_project
(
opencv_engine
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
SDK_TARGET
8
${
ANDROID_SDK_TARGET
}
IGNORE_JAVA ON IGNORE_MANIFEST ON
)
add_android_project
(
opencv_engine
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
SDK_TARGET
9
${
ANDROID_SDK_TARGET
}
IGNORE_JAVA ON IGNORE_MANIFEST ON
)
set
(
ANDROID_PLATFORM_VERSION_CODE
"0"
)
...
...
android/service/engine/build.xml
View file @
817a4c0c
<?xml version="1.0" encoding="UTF-8"?>
<project
name=
"
ManagerActivity
"
default=
"help"
>
<project
name=
"
OpenCV Manager
"
default=
"help"
>
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
...
...
android/service/engine/jni/Android.mk
View file @
817a4c0c
...
...
@@ -52,7 +52,8 @@ LOCAL_SRC_FILES := \
NativeService/CommonPackageManager.cpp \
JNIWrapper/JavaBasedPackageManager.cpp \
NativeService/PackageInfo.cpp \
JNIWrapper/HardwareDetector_jni.cpp
JNIWrapper/HardwareDetector_jni.cpp \
JNIWrapper/OpenCVLibraryInfo.cpp
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
...
...
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
0 → 100644
View file @
817a4c0c
#include "OpenCVLibraryInfo.h"
#include "EngineCommon.h"
#include <utils/Log.h>
#include <dlfcn.h>
JNIEXPORT
jlong
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_open
(
JNIEnv
*
env
,
jobject
,
jstring
str
)
{
const
char
*
infoLibPath
=
env
->
GetStringUTFChars
(
str
,
NULL
);
if
(
infoLibPath
==
NULL
)
return
0
;
LOGD
(
"Trying to load info library
\"
%s
\"
"
,
infoLibPath
);
void
*
handle
;
handle
=
dlopen
(
infoLibPath
,
RTLD_LAZY
);
if
(
handle
==
NULL
)
LOGI
(
"Info library not found by path
\"
%s
\"
"
,
infoLibPath
);
return
(
jlong
)
handle
;
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetPackageName"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetLibraryList"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetRevision"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
void
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_close
(
JNIEnv
*
,
jobject
,
jlong
handle
)
{
dlclose
((
void
*
)
handle
);
}
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h
0 → 100644
View file @
817a4c0c
#include <jni.h>
#ifndef _Included_org_opencv_engine_OpenCVLibraryInfo
#define _Included_org_opencv_engine_OpenCVLibraryInfo
#ifdef __cplusplus
extern
"C"
{
#endif
JNIEXPORT
jlong
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_open
(
JNIEnv
*
,
jobject
,
jstring
);
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
(
JNIEnv
*
,
jobject
,
jlong
);
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(
JNIEnv
*
,
jobject
,
jlong
);
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
(
JNIEnv
*
,
jobject
,
jlong
);
JNIEXPORT
void
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_close
(
JNIEnv
*
,
jobject
,
jlong
);
#ifdef __cplusplus
}
#endif
#endif
android/service/engine/jni/NativeService/CommonPackageManager.cpp
View file @
817a4c0c
...
...
@@ -78,49 +78,45 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
if
(
!
packages
.
empty
())
{
vector
<
PackageInfo
>::
iterator
found
=
find
(
packages
.
begin
(),
packages
.
end
(),
target_package
);
if
(
packages
.
end
()
!=
found
)
int
OptRating
=
-
1
;
std
::
string
OptVersion
=
""
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
=
CommonPackageManager
::
ArmRating
;
if
((
cpu_id
&
ARCH_X86
)
||
(
cpu_id
&
ARCH_X64
))
group
=
CommonPackageManager
::
IntelRating
;
int
HardwareRating
=
GetHardwareRating
(
platform
,
cpu_id
,
group
);
LOGD
(
"Current hardware platform rating %d for (%d,%d)"
,
HardwareRating
,
platform
,
cpu_id
);
if
(
-
1
==
HardwareRating
)
{
result
=
found
->
GetInstalationPath
(
);
LOGE
(
"Cannot calculate rating for current hardware platform!"
);
}
else
{
int
OptRating
=
-
1
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
=
CommonPackageManager
::
ArmRating
;
if
((
cpu_id
&
ARCH_X86
)
||
(
cpu_id
&
ARCH_X64
))
group
=
CommonPackageManager
::
IntelRating
;
int
HardwareRating
=
GetHardwareRating
(
platform
,
cpu_id
,
group
);
LOGD
(
"Current hardware platform %d, %d"
,
platform
,
cpu_id
);
if
(
-
1
==
HardwareRating
)
{
LOGE
(
"Cannot calculate rating for current hardware platform!"
);
}
else
vector
<
PackageInfo
>::
iterator
found
=
packages
.
end
();
for
(
vector
<
PackageInfo
>::
iterator
it
=
packages
.
begin
();
it
!=
packages
.
end
();
++
it
)
{
for
(
vector
<
PackageInfo
>::
iterator
it
=
packages
.
begin
();
it
!=
packages
.
end
();
++
it
)
int
PackageRating
=
GetHardwareRating
(
it
->
GetPlatform
(),
it
->
GetCpuID
(),
group
);
LOGD
(
"Package
\"
%s
\"
rating %d for (%d,%d)"
,
it
->
GetFullName
().
c_str
(),
PackageRating
,
it
->
GetPlatform
(),
it
->
GetCpuID
());
if
((
PackageRating
>=
0
)
&&
(
PackageRating
<=
HardwareRating
))
{
int
PackageRating
=
GetHardwareRating
(
it
->
GetPlatform
(),
it
->
GetCpuID
(),
group
);
if
(
PackageRating
>=
0
)
if
(((
it
->
GetVersion
()
>=
OptVersion
)
&&
(
PackageRating
>=
OptRating
))
||
(
it
->
GetVersion
()
>
OptVersion
))
{
if
((
PackageRating
<=
HardwareRating
)
&&
(
PackageRating
>
OptRating
))
{
OptRating
=
PackageRating
;
found
=
it
;
}
OptRating
=
PackageRating
;
OptVersion
=
it
->
GetVersion
();
found
=
it
;
}
}
}
if
((
-
1
!=
OptRating
)
&&
(
packages
.
end
()
!=
found
))
{
result
=
found
->
GetInstalationPath
();
}
else
{
LOGI
(
"Found package is incompatible with current hardware platform"
);
}
if
((
-
1
!=
OptRating
)
&&
(
packages
.
end
()
!=
found
))
{
result
=
found
->
GetInstalationPath
();
}
else
{
LOGI
(
"Found package is incompatible with current hardware platform"
);
}
}
}
...
...
@@ -171,14 +167,14 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv6
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_VFPv3d16
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_TEGRA2
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
|
FEATURES_HAS_VFPv3
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_NEON
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
|
FEATURES_HAS_NEON
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_NEON
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_UNKNOWN
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_VFPv3d16
|
FEATURES_HAS_NEON
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_TEGRA2
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_TEGRA3
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_NEON
));
result
.
push_back
(
std
::
pair
<
int
,
int
>
(
PLATFORM_TEGRA3
,
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_NEON
));
return
result
;
}
...
...
android/service/engine/jni/NativeService/PackageInfo.cpp
View file @
817a4c0c
...
...
@@ -197,6 +197,7 @@ InstallPath("")
#ifndef __SUPPORT_TEGRA3
Platform
=
PLATFORM_UNKNOWN
;
#endif
FullName
=
BasePackageName
+
"_v"
+
Version
.
substr
(
0
,
Version
.
size
()
-
1
);
if
(
PLATFORM_UNKNOWN
!=
Platform
)
{
...
...
@@ -392,7 +393,17 @@ InstallPath(install_path)
Platform
=
SplitPlatfrom
(
features
);
if
(
PLATFORM_UNKNOWN
!=
Platform
)
{
CpuID
=
0
;
switch
(
Platform
)
{
case
PLATFORM_TEGRA2
:
{
CpuID
=
ARCH_ARMv7
|
FEATURES_HAS_VFPv3d16
;
}
break
;
case
PLATFORM_TEGRA3
:
{
CpuID
=
ARCH_ARMv7
|
FEATURES_HAS_VFPv3
|
FEATURES_HAS_NEON
;
}
break
;
}
}
else
{
...
...
android/service/engine/project.properties
View file @
817a4c0c
...
...
@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target
=
android-
8
target
=
android-
9
android/service/engine/src/org/opencv/engine/MarketConnector.java
View file @
817a4c0c
...
...
@@ -20,8 +20,6 @@ public class MarketConnector
private
static
final
String
TAG
=
"OpenCVEngine/MarketConnector"
;
protected
Context
mContext
;
public
boolean
mIncludeManager
=
true
;
public
MarketConnector
(
Context
context
)
{
mContext
=
context
;
...
...
@@ -100,15 +98,13 @@ public class MarketConnector
{
List
<
PackageInfo
>
AllPackages
=
mContext
.
getPackageManager
().
getInstalledPackages
(
PackageManager
.
GET_CONFIGURATIONS
);
List
<
PackageInfo
>
OpenCVPackages
=
new
ArrayList
<
PackageInfo
>();
if
(
mIncludeManager
)
{
try
{
OpenCVPackages
.
add
(
mContext
.
getPackageManager
().
getPackageInfo
(
"org.opencv.engine"
,
PackageManager
.
GET_CONFIGURATIONS
));
}
catch
(
NameNotFoundException
e
)
{
Log
.
e
(
TAG
,
"OpenCV Manager package info was not found!"
);
e
.
printStackTrace
();
}
try
{
OpenCVPackages
.
add
(
mContext
.
getPackageManager
().
getPackageInfo
(
"org.opencv.engine"
,
PackageManager
.
GET_CONFIGURATIONS
));
}
catch
(
NameNotFoundException
e
)
{
Log
.
e
(
TAG
,
"OpenCV Manager package info was not found!"
);
e
.
printStackTrace
();
}
Iterator
<
PackageInfo
>
it
=
AllPackages
.
iterator
();
while
(
it
.
hasNext
())
{
...
...
android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
0 → 100644
View file @
817a4c0c
package
org
.
opencv
.
engine
;
public
class
OpenCVLibraryInfo
{
public
OpenCVLibraryInfo
(
String
packagePath
)
{
mNativeObj
=
open
(
packagePath
+
"/libopencv_info.so"
);
if
(
mNativeObj
!=
0
)
{
mPackageName
=
getPackageName
(
mNativeObj
);
mLibraryList
=
getLibraryList
(
mNativeObj
);
mVersionName
=
getVersionName
(
mNativeObj
);
close
(
mNativeObj
);
}
}
public
boolean
status
()
{
return
(
mNativeObj
!=
0
);
}
public
String
packageName
()
{
return
mPackageName
;
}
public
String
libraryList
()
{
return
mLibraryList
;
}
public
String
versionName
()
{
return
mVersionName
;
}
private
long
mNativeObj
;
private
String
mPackageName
;
private
String
mLibraryList
;
private
String
mVersionName
;
private
native
long
open
(
String
packagePath
);
private
native
String
getPackageName
(
long
obj
);
private
native
String
getLibraryList
(
long
obj
);
private
native
String
getVersionName
(
long
obj
);
private
native
void
close
(
long
obj
);
}
android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java
View file @
817a4c0c
...
...
@@ -7,7 +7,9 @@ import java.util.StringTokenizer;
import
org.opencv.engine.HardwareDetector
;
import
org.opencv.engine.MarketConnector
;
import
org.opencv.engine.OpenCVEngineInterface
;
import
org.opencv.engine.OpenCVLibraryInfo
;
import
org.opencv.engine.R
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.BroadcastReceiver
;
...
...
@@ -77,7 +79,7 @@ public class ManagerActivity extends Activity
{
HardwarePlatformView
.
setText
(
"Tegra"
);
}
else
if
(
HardwareDetector
.
PLATFORM_TEGRA
==
Platfrom
)
else
if
(
HardwareDetector
.
PLATFORM_TEGRA
2
==
Platfrom
)
{
HardwarePlatformView
.
setText
(
"Tegra 2"
);
}
...
...
@@ -170,9 +172,13 @@ public class ManagerActivity extends Activity
mInstalledPackageView
.
setOnItemClickListener
(
new
OnItemClickListener
()
{
public
void
onItemClick
(
AdapterView
<?>
arg0
,
View
arg1
,
int
arg2
,
long
id
)
{
mInstalledPackageView
.
setTag
(
Integer
.
valueOf
((
int
)
id
));
mActionDialog
.
show
();
public
void
onItemClick
(
AdapterView
<?>
adapter
,
View
view
,
int
position
,
long
id
)
{
//if (!mListViewItems.get((int) id).get("Name").equals("Built-in OpenCV library"));
if
(!
mInstalledPackageInfo
[(
int
)
id
].
packageName
.
equals
(
"org.opencv.engine"
))
{
mInstalledPackageView
.
setTag
(
Integer
.
valueOf
((
int
)
id
));
mActionDialog
.
show
();
}
}
});
...
...
@@ -232,8 +238,6 @@ public class ManagerActivity extends Activity
protected
class
OpenCVEngineServiceConnection
implements
ServiceConnection
{
public
void
onServiceDisconnected
(
ComponentName
name
)
{
// TODO Auto-generated method stub
}
public
void
onServiceConnected
(
ComponentName
name
,
IBinder
service
)
{
...
...
@@ -266,23 +270,58 @@ public class ManagerActivity extends Activity
}
};
@TargetApi
(
Build
.
VERSION_CODES
.
GINGERBREAD
)
synchronized
protected
void
FillPackageList
()
{
synchronized
(
mListViewItems
)
{
mMarket
.
mIncludeManager
=
false
;
mInstalledPackageInfo
=
mMarket
.
GetInstalledOpenCVPackages
();
mListViewItems
.
clear
();
for
(
int
i
=
0
;
i
<
mInstalledPackageInfo
.
length
;
i
++)
int
RealPackageCount
=
mInstalledPackageInfo
.
length
;
for
(
int
i
=
0
;
i
<
RealPackageCount
;
i
++)
{
if
(
mInstalledPackageInfo
[
i
]
==
null
)
break
;
// Convert to Items for package list view
HashMap
<
String
,
String
>
temp
=
new
HashMap
<
String
,
String
>();
String
HardwareName
=
""
;
String
NativeLibDir
=
""
;
String
OpenCVersion
=
""
;
String
PublicName
=
mMarket
.
GetApplicationName
(
mInstalledPackageInfo
[
i
].
applicationInfo
);
String
PackageName
=
mInstalledPackageInfo
[
i
].
packageName
;
String
VersionName
=
mInstalledPackageInfo
[
i
].
versionName
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
GINGERBREAD
)
NativeLibDir
=
mInstalledPackageInfo
[
i
].
applicationInfo
.
nativeLibraryDir
;
else
NativeLibDir
=
"/data/data/"
+
mInstalledPackageInfo
[
i
].
packageName
+
"/lib"
;
OpenCVLibraryInfo
NativeInfo
=
new
OpenCVLibraryInfo
(
NativeLibDir
);
if
(
PackageName
.
equals
(
"org.opencv.engine"
))
{
if
(
NativeInfo
.
status
())
{
PublicName
=
"Built-in OpenCV library"
;
PackageName
=
NativeInfo
.
packageName
();
VersionName
=
NativeInfo
.
versionName
();
}
else
{
mInstalledPackageInfo
[
i
]
=
mInstalledPackageInfo
[
RealPackageCount
-
1
];
mInstalledPackageInfo
[
RealPackageCount
-
1
]
=
null
;
RealPackageCount
--;
i
--;
continue
;
}
}
int
idx
=
0
;
String
OpenCVersion
=
"unknown"
;
String
HardwareName
=
""
;
StringTokenizer
tokenizer
=
new
StringTokenizer
(
mInstalledPackageInfo
[
i
].
packageName
,
"_"
);
Log
.
d
(
TAG
,
PackageName
);
StringTokenizer
tokenizer
=
new
StringTokenizer
(
PackageName
,
"_"
);
while
(
tokenizer
.
hasMoreTokens
())
{
if
(
idx
==
1
)
...
...
@@ -303,6 +342,7 @@ public class ManagerActivity extends Activity
}
String
ActivePackagePath
;
String
Tags
=
null
;
ActivePackagePath
=
mActivePackageMap
.
get
(
OpenCVersion
);
Log
.
d
(
TAG
,
OpenCVersion
+
" -> "
+
ActivePackagePath
);
...
...
@@ -313,11 +353,13 @@ public class ManagerActivity extends Activity
if
(
start
>=
0
&&
ActivePackagePath
.
charAt
(
stop
)
==
'/'
)
{
temp
.
put
(
"Activity"
,
"y"
);
PublicName
+=
" (in use)
"
;
Tags
=
"active
"
;
}
else
{
temp
.
put
(
"Activity"
,
"n"
);
if
(!
PublicName
.
equals
(
"Built-in OpenCV library"
))
Tags
=
"safe to remove"
;
}
}
else
...
...
@@ -325,9 +367,32 @@ public class ManagerActivity extends Activity
temp
.
put
(
"Activity"
,
"n"
);
}
temp
.
put
(
"Version"
,
NormalizeVersion
(
OpenCVersion
,
VersionName
));
// HACK: OpenCV Manager for Armv7-a Neon already has Tegra3 optimizations
// that is enabled on proper hardware
if
(
HardwareDetector
.
DetectKnownPlatforms
()
==
HardwareDetector
.
PLATFORM_TEGRA3
&&
HardwareName
.
equals
(
"armv7a neon "
)
&&
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
GINGERBREAD
)
{
temp
.
put
(
"Hardware"
,
"Tegra 3"
);
if
(
Tags
==
null
)
{
Tags
=
"optimized"
;
}
else
{
Tags
=
Tags
+
", optimized"
;
}
}
else
{
temp
.
put
(
"Hardware"
,
HardwareName
);
}
if
(
Tags
!=
null
)
PublicName
=
PublicName
+
" ("
+
Tags
+
")"
;
temp
.
put
(
"Name"
,
PublicName
);
temp
.
put
(
"Version"
,
NormalizeVersion
(
OpenCVersion
,
mInstalledPackageInfo
[
i
].
versionName
));
temp
.
put
(
"Hardware"
,
HardwareName
);
mListViewItems
.
add
(
temp
);
}
...
...
cmake/OpenCVDetectOpenCL.cmake
View file @
817a4c0c
...
...
@@ -27,7 +27,7 @@ else()
else
()
set
(
OPENCL_LIB_SEARCH_PATH
${
OPENCL_LIB_SEARCH_PATH
}
${
ENV_AMDSTREAMSDKROOT
}
/lib/x86_64
)
endif
()
elseif
(
ENV_CUDAPATH AND WIN32
)
elseif
(
ENV_CUDA
_
PATH AND WIN32
)
set
(
OPENCL_INCLUDE_SEARCH_PATH
${
ENV_CUDA_PATH
}
/include
)
if
(
CMAKE_SIZEOF_VOID_P EQUAL 4
)
set
(
OPENCL_LIB_SEARCH_PATH
${
OPENCL_LIB_SEARCH_PATH
}
${
ENV_CUDA_PATH
}
/lib/Win32
)
...
...
doc/CMakeLists.txt
View file @
817a4c0c
...
...
@@ -2,8 +2,6 @@
# CMake file for OpenCV docs
#
file
(
GLOB FILES_DOC *.htm *.txt *.jpg *.png *.pdf
)
file
(
GLOB FILES_DOC_VS vidsurv/*.doc
)
file
(
GLOB FILES_TEX *.tex *.sty *.bib
)
file
(
GLOB FILES_TEX_PICS pics/*.png pics/*.jpg
)
...
...
@@ -11,6 +9,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
project
(
opencv_docs
)
set
(
DOC_LIST
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo2.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo-white.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv.ico"
"
${
OpenCV_SOURCE_DIR
}
/doc/haartraining.htm"
"
${
OpenCV_SOURCE_DIR
}
/doc/license.txt"
"
${
OpenCV_SOURCE_DIR
}
/doc/pattern.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/acircles_pattern.png"
)
set
(
OPTIONAL_DOC_LIST
""
)
set
(
OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy
)
# build lists of modules to be documented
...
...
@@ -81,6 +87,9 @@ if(BUILD_DOCS AND HAVE_SPHINX)
COMMENT
"Generating the PDF Manuals"
)
LIST
(
APPEND OPTIONAL_DOC_LIST
"
${
CMAKE_BINARY_DIR
}
/doc/opencv2refman.pdf"
"
${
CMAKE_BINARY_DIR
}
/doc/opencv2manager.pdf"
"
${
CMAKE_BINARY_DIR
}
/doc/opencv_user.pdf"
"
${
CMAKE_BINARY_DIR
}
/doc/opencv_tutorials.pdf"
"
${
CMAKE_BINARY_DIR
}
/doc/opencv_cheatsheet.pdf"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
docs PROPERTIES FOLDER
"documentation"
)
endif
()
...
...
@@ -97,7 +106,13 @@ if(BUILD_DOCS AND HAVE_SPHINX)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
html_docs PROPERTIES FOLDER
"documentation"
)
endif
()
endif
()
install
(
FILES
${
FILES_DOC
}
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
COMPONENT main
)
install
(
FILES
${
FILES_DOC_VS
}
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
/vidsurv"
COMPONENT main
)
foreach
(
f
${
DOC_LIST
}
)
install
(
FILES
"
${
f
}
"
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
COMPONENT main
)
endforeach
()
foreach
(
f
${
OPTIONAL_DOC_LIST
}
)
install
(
FILES
"
${
f
}
"
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
OPTIONAL
)
endforeach
()
endif
()
\ No newline at end of file
modules/calib3d/perf/perf_pnp.cpp
View file @
817a4c0c
...
...
@@ -16,7 +16,7 @@ typedef perf::TestBaseWithParam<int> PointsNum;
PERF_TEST_P
(
PointsNum_Algo
,
solvePnP
,
testing
::
Combine
(
testing
::
Values
(
4
,
3
*
9
,
7
*
13
),
testing
::
Values
(
/*4,*/
3
*
9
,
7
*
13
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
((
int
)
CV_ITERATIVE
,
(
int
)
CV_EPNP
)
)
)
...
...
modules/highgui/perf/perf_output.cpp
View file @
817a4c0c
...
...
@@ -23,7 +23,7 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
string
filename
=
getDataPath
(
get
<
0
>
(
GetParam
()));
bool
isColor
=
get
<
1
>
(
GetParam
());
VideoWriter
writer
(
"perf_writer.avi"
,
CV_FOURCC
(
'X'
,
'V'
,
'I'
,
'D'
),
25
,
cv
::
Size
(
640
,
480
),
isColor
);
VideoWriter
writer
(
cv
::
tempfile
(
".avi"
)
,
CV_FOURCC
(
'X'
,
'V'
,
'I'
,
'D'
),
25
,
cv
::
Size
(
640
,
480
),
isColor
);
TEST_CYCLE
()
{
Mat
image
=
imread
(
filename
,
1
);
writer
<<
image
;
}
...
...
modules/highgui/src/grfmt_jpeg.cpp
View file @
817a4c0c
...
...
@@ -229,12 +229,16 @@ bool JpegDecoder::readHeader()
if
(
m_f
)
jpeg_stdio_src
(
&
state
->
cinfo
,
m_f
);
}
jpeg_read_header
(
&
state
->
cinfo
,
TRUE
);
m_width
=
state
->
cinfo
.
image_width
;
m_height
=
state
->
cinfo
.
image_height
;
m_type
=
state
->
cinfo
.
num_components
>
1
?
CV_8UC3
:
CV_8UC1
;
result
=
true
;
if
(
state
->
cinfo
.
src
!=
0
)
{
jpeg_read_header
(
&
state
->
cinfo
,
TRUE
);
m_width
=
state
->
cinfo
.
image_width
;
m_height
=
state
->
cinfo
.
image_height
;
m_type
=
state
->
cinfo
.
num_components
>
1
?
CV_8UC3
:
CV_8UC1
;
result
=
true
;
}
}
if
(
!
result
)
...
...
modules/imgproc/perf/perf_houghLines.cpp
View file @
817a4c0c
...
...
@@ -18,7 +18,7 @@ PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
testing
::
Values
(
0.01
,
0.1
),
testing
::
Values
(
300
,
500
)
)
)
)
{
String
filename
=
getDataPath
(
get
<
0
>
(
GetParam
()));
double
rhoStep
=
get
<
1
>
(
GetParam
());
...
...
@@ -36,5 +36,18 @@ PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
TEST_CYCLE
()
HoughLines
(
image
,
lines
,
rhoStep
,
thetaStep
,
threshold
);
#ifdef WIN32
//FIXME: ugly fix to make sanity check pass on Win32, must be investigated, issue #2617
if
(
lines
.
cols
==
2015
)
{
lines
=
lines
(
Rect
(
0
,
0
,
lines
.
cols
-
1
,
lines
.
rows
));
SANITY_CHECK
(
lines
,
800.0
);
}
else
{
SANITY_CHECK
(
lines
);
}
#else
SANITY_CHECK
(
lines
);
}
\ No newline at end of file
#endif
}
modules/stitching/perf/perf_stich.cpp
View file @
817a4c0c
...
...
@@ -57,7 +57,13 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
stopTimer
();
}
SANITY_CHECK
(
pano
,
2
);
Mat
pano_small
;
if
(
!
pano
.
empty
())
resize
(
pano
,
pano_small
,
Size
(
320
,
240
),
0
,
0
,
INTER_AREA
);
else
pano_small
=
pano
;
SANITY_CHECK
(
pano_small
,
5
);
}
PERF_TEST_P
(
stitch
,
b12
,
TEST_DETECTORS
)
...
...
@@ -91,7 +97,13 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
stopTimer
();
}
SANITY_CHECK
(
pano
,
2
);
Mat
pano_small
;
if
(
!
pano
.
empty
())
resize
(
pano
,
pano_small
,
Size
(
320
,
240
),
0
,
0
,
INTER_AREA
);
else
pano_small
=
pano
;
SANITY_CHECK
(
pano_small
,
5
);
}
PERF_TEST_P
(
match
,
bestOf2Nearest
,
TEST_DETECTORS
)
...
...
@@ -137,7 +149,11 @@ PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
matcher
->
collectGarbage
();
}
SANITY_CHECK_MATCHES
(
pairwise_matches
.
matches
);
std
::
vector
<
DMatch
>&
matches
=
pairwise_matches
.
matches
;
if
(
GetParam
()
==
"orb"
)
matches
.
resize
(
0
);
for
(
size_t
q
=
0
;
q
<
matches
.
size
();
++
q
)
if
(
matches
[
q
].
imgIdx
<
0
)
{
matches
.
resize
(
q
);
break
;}
SANITY_CHECK_MATCHES
(
matches
);
}
PERF_TEST_P
(
matchVector
,
bestOf2NearestVectorFeatures
,
testing
::
Combine
(
...
...
@@ -193,6 +209,8 @@ PERF_TEST_P( matchVector, bestOf2NearestVectorFeatures, testing::Combine(
}
std
::
vector
<
DMatch
>&
matches
=
pairwise_matches
[
0
].
matches
;
std
::
vector
<
DMatch
>&
matches
=
pairwise_matches
[
detectorName
==
"surf"
?
1
:
0
].
matches
;
for
(
size_t
q
=
0
;
q
<
matches
.
size
();
++
q
)
if
(
matches
[
q
].
imgIdx
<
0
)
{
matches
.
resize
(
q
);
break
;}
SANITY_CHECK_MATCHES
(
matches
);
}
modules/ts/include/opencv2/ts/ts.hpp
View file @
817a4c0c
...
...
@@ -10,17 +10,6 @@
#endif
#endif
#ifdef ANDROID
# include <android/api-level.h>
# define GTEST_HAS_CLONE (__ANDROID_API__ > 7 && !defined __i386__)
# define GTEST_HAS_POSIX_RE (__ANDROID_API__ > 7)
# if defined _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_WCHAR_T
# define GTEST_HAS_STD_WSTRING 1
# else
# define GTEST_HAS_STD_WSTRING 0
#endif
#endif
#include <stdarg.h> // for va_list
#ifdef _MSC_VER
...
...
modules/ts/include/opencv2/ts/ts_gtest.h
View file @
817a4c0c
This diff is collapsed.
Click to expand it.
modules/ts/src/ts_gtest.cpp
View file @
817a4c0c
This diff is collapsed.
Click to expand it.
modules/ts/src/ts_perf.cpp
View file @
817a4c0c
...
...
@@ -493,7 +493,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
FAIL
()
<<
" Absolute difference (="
<<
max
<<
") between argument
\"
"
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is
bugg
er than "
<<
eps
;
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is
great
er than "
<<
eps
;
}
}
else
if
(
err
==
ERROR_RELATIVE
)
...
...
@@ -503,7 +503,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if
(
violations
>
0
)
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is
bugg
er than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is
great
er than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
}
}
}
...
...
@@ -547,7 +547,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
FAIL
()
<<
" Difference (="
<<
max
<<
") between argument1
\"
"
<<
node
.
name
()
<<
"
\"
and expected value is
bugg
er than "
<<
eps
;
<<
"
\"
and expected value is
great
er than "
<<
eps
;
}
}
else
if
(
err
==
ERROR_RELATIVE
)
...
...
@@ -557,7 +557,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if
(
violations
>
0
)
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
<<
node
.
name
()
<<
"
\"
and expected value is
bugg
er than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
<<
"
\"
and expected value is
great
er than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
}
}
}
...
...
@@ -597,6 +597,7 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
write
()
<<
nodename
<<
"{"
;
}
// TODO: verify that name is alphanumeric, current error message is useless
write
()
<<
name
<<
"{"
;
write
(
array
);
write
()
<<
"}"
;
...
...
@@ -978,7 +979,7 @@ void TestBase::validateMetrics()
if
(
m
.
gstddev
>
DBL_EPSILON
)
{
EXPECT_GT
(
/*m.gmean * */
1.
,
/*m.gmean * */
2
*
sinh
(
m
.
gstddev
*
param_max_deviation
))
<<
" Test results are not reliable ((mean-sigma,mean+sigma) deviation interval is
bigg
er than measured time interval)."
;
<<
" Test results are not reliable ((mean-sigma,mean+sigma) deviation interval is
great
er than measured time interval)."
;
}
EXPECT_LE
(
m
.
outliers
,
std
::
max
((
unsigned
int
)
cvCeil
(
m
.
samples
*
param_max_outliers
/
100.
),
1u
))
...
...
samples/android/tutorial-5-cameracontrol/src/org/opencv/samples/tutorial5/Sample5CameraControl.java
View file @
817a4c0c
package
org
.
opencv
.
samples
.
tutorial5
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.ListIterator
;
...
...
@@ -9,6 +11,7 @@ import org.opencv.android.OpenCVLoader;
import
org.opencv.core.Mat
;
import
org.opencv.android.CameraBridgeViewBase.CvCameraViewListener
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.os.Environment
;
...
...
@@ -20,6 +23,7 @@ import android.view.SurfaceView;
import
android.view.View
;
import
android.view.View.OnTouchListener
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
public
class
Sample5CameraControl
extends
Activity
implements
CvCameraViewListener
,
OnTouchListener
{
private
static
final
String
TAG
=
"OCVSample::Activity"
;
...
...
@@ -100,6 +104,11 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
List
<
String
>
effects
=
mOpenCvCameraView
.
getEffectList
();
if
(
effects
==
null
)
{
Log
.
e
(
TAG
,
"Color effects are not supported by device!"
);
return
true
;
}
mEffectMenuItems
=
new
MenuItem
[
effects
.
size
()];
int
idx
=
0
;
...
...
@@ -115,13 +124,20 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
Log
.
i
(
TAG
,
"called onOptionsItemSelected; selected item: "
+
item
);
mOpenCvCameraView
.
setEffect
((
String
)
item
.
getTitle
());
Toast
.
makeText
(
this
,
mOpenCvCameraView
.
getEffect
(),
Toast
.
LENGTH_SHORT
).
show
();
return
true
;
}
@SuppressLint
(
"SimpleDateFormat"
)
@Override
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
Log
.
i
(
TAG
,
"onTouch event"
);
mOpenCvCameraView
.
takePicture
(
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/sample_picture.jpg"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd_HH-mm-ss"
);
String
currentDateandTime
=
sdf
.
format
(
new
Date
());
String
fileName
=
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/sample_picture_"
+
currentDateandTime
+
".jpg"
;
mOpenCvCameraView
.
takePicture
(
fileName
);
Toast
.
makeText
(
this
,
fileName
+
" saved"
,
Toast
.
LENGTH_SHORT
).
show
();
return
false
;
}
}
samples/android/tutorial-5-cameracontrol/src/org/opencv/samples/tutorial5/SampleJavaCameraView.java
View file @
817a4c0c
...
...
@@ -25,6 +25,10 @@ public class SampleJavaCameraView extends JavaCameraView {
return
mCamera
.
getParameters
().
getSupportedColorEffects
();
}
public
boolean
isEffectSupported
()
{
return
(
mCamera
.
getParameters
().
getColorEffect
()
!=
null
);
}
public
String
getEffect
()
{
return
mCamera
.
getParameters
().
getColorEffect
();
}
...
...
@@ -48,6 +52,7 @@ public class SampleJavaCameraView extends JavaCameraView {
try
{
FileOutputStream
out
=
new
FileOutputStream
(
mPictureFileName
);
picture
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
90
,
out
);
picture
.
recycle
();
mCamera
.
startPreview
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment