Commit f5cd20d8 authored by Andrey Kamaev's avatar Andrey Kamaev

Merge branch 2.4

parents 464826c2 9b09f09b
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.engine" package="org.opencv.engine"
android:versionCode="23@ANDROID_PLATFORM_VERSION_CODE@" android:versionCode="24@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName="2.3" > android:versionName="2.4" >
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" /> <uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
......
...@@ -358,6 +358,8 @@ public class ManagerActivity extends Activity ...@@ -358,6 +358,8 @@ public class ManagerActivity extends Activity
else else
{ {
temp.put("Activity", "n"); temp.put("Activity", "n");
if (!PublicName.equals("Built-in OpenCV library"))
Tags = "safe to remove";
} }
} }
else else
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# CMake file for OpenCV docs # 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 *.tex *.sty *.bib)
file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg) file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
...@@ -11,6 +9,14 @@ if(BUILD_DOCS AND HAVE_SPHINX) ...@@ -11,6 +9,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
project(opencv_docs) 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) 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 # build lists of modules to be documented
...@@ -81,6 +87,9 @@ if(BUILD_DOCS AND HAVE_SPHINX) ...@@ -81,6 +87,9 @@ if(BUILD_DOCS AND HAVE_SPHINX)
COMMENT "Generating the PDF Manuals" 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) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(docs PROPERTIES FOLDER "documentation") set_target_properties(docs PROPERTIES FOLDER "documentation")
endif() endif()
...@@ -97,7 +106,13 @@ if(BUILD_DOCS AND HAVE_SPHINX) ...@@ -97,7 +106,13 @@ if(BUILD_DOCS AND HAVE_SPHINX)
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(html_docs PROPERTIES FOLDER "documentation") set_target_properties(html_docs PROPERTIES FOLDER "documentation")
endif() endif()
endif()
install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main) foreach(f ${DOC_LIST})
install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main) 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
...@@ -16,7 +16,7 @@ typedef perf::TestBaseWithParam<int> PointsNum; ...@@ -16,7 +16,7 @@ typedef perf::TestBaseWithParam<int> PointsNum;
PERF_TEST_P(PointsNum_Algo, solvePnP, PERF_TEST_P(PointsNum_Algo, solvePnP,
testing::Combine( 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) testing::Values((int)CV_ITERATIVE, (int)CV_EPNP)
) )
) )
......
...@@ -359,26 +359,24 @@ string format( const char* fmt, ... ) ...@@ -359,26 +359,24 @@ string format( const char* fmt, ... )
string tempfile( const char* suffix ) string tempfile( const char* suffix )
{ {
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
string fname;
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
char temp_dir[MAX_PATH + 1] = { 0 }; char temp_dir2[MAX_PATH + 1] = { 0 };
char temp_file[MAX_PATH + 1] = { 0 }; char temp_file[MAX_PATH + 1] = { 0 };
::GetTempPathA(sizeof(temp_dir), temp_dir); if (temp_dir == 0 || temp_dir[0] == 0)
{
::GetTempPathA(sizeof(temp_dir2), temp_dir2);
temp_dir = temp_dir2;
}
if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file)) if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
return string(); return string();
DeleteFileA(temp_file); DeleteFileA(temp_file);
string name = temp_file; fname = temp_file;
if(suffix)
{
if (suffix[0] != '.')
return name + "." + suffix;
else
return name + suffix;
}
else
return name;
# else # else
# ifdef ANDROID # ifdef ANDROID
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX"; //char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
...@@ -387,9 +385,7 @@ string tempfile( const char* suffix ) ...@@ -387,9 +385,7 @@ string tempfile( const char* suffix )
char defaultTemplate[] = "/tmp/__opencv_temp.XXXXXX"; char defaultTemplate[] = "/tmp/__opencv_temp.XXXXXX";
# endif # endif
string fname; if (temp_dir == 0 || temp_dir[0] == 0)
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
if(temp_dir == 0 || temp_dir[0] == 0)
fname = defaultTemplate; fname = defaultTemplate;
else else
{ {
...@@ -401,19 +397,20 @@ string tempfile( const char* suffix ) ...@@ -401,19 +397,20 @@ string tempfile( const char* suffix )
} }
const int fd = mkstemp((char*)fname.c_str()); const int fd = mkstemp((char*)fname.c_str());
if(fd == -1) return ""; if (fd == -1) return string();
close(fd); close(fd);
remove(fname.c_str()); remove(fname.c_str());
# endif
if(suffix) if (suffix)
{ {
if (suffix[0] != '.') if (suffix[0] != '.')
fname = fname + "." + suffix; return fname + "." + suffix;
else else
fname += suffix; return fname + suffix;
} }
return fname; return fname;
# endif
} }
static CvErrorCallback customErrorCallback = 0; static CvErrorCallback customErrorCallback = 0;
......
...@@ -23,7 +23,7 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame, ...@@ -23,7 +23,7 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
string filename = getDataPath(get<0>(GetParam())); string filename = getDataPath(get<0>(GetParam()));
bool isColor = get<1>(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; } TEST_CYCLE() { Mat image = imread(filename, 1); writer << image; }
......
...@@ -70,7 +70,7 @@ PERF_TEST_P( Image_KernelSize, GaborFilter2d, ...@@ -70,7 +70,7 @@ PERF_TEST_P( Image_KernelSize, GaborFilter2d,
filter2D(sourceImage, filteredImage, CV_32F, gaborKernel); filter2D(sourceImage, filteredImage, CV_32F, gaborKernel);
} }
SANITY_CHECK(filteredImage); SANITY_CHECK(filteredImage, 1e-3);
} }
...@@ -27,7 +27,7 @@ PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES)) ...@@ -27,7 +27,7 @@ PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES))
TEST_CYCLE() detector(frame, mask, points); TEST_CYCLE() detector(frame, mask, points);
SANITY_CHECK_KEYPOINTS(points); SANITY_CHECK_KEYPOINTS(points, 1e-3);
} }
PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES)) PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
...@@ -67,6 +67,6 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES)) ...@@ -67,6 +67,6 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
TEST_CYCLE() detector(frame, mask, points, descriptors, false); TEST_CYCLE() detector(frame, mask, points, descriptors, false);
SANITY_CHECK_KEYPOINTS(points); SANITY_CHECK_KEYPOINTS(points, 1e-3);
SANITY_CHECK(descriptors, 1e-4); SANITY_CHECK(descriptors, 1e-4);
} }
...@@ -19,7 +19,7 @@ typedef TestBaseWithParam<String> match; ...@@ -19,7 +19,7 @@ typedef TestBaseWithParam<String> match;
typedef std::tr1::tuple<String, int> matchVector_t; typedef std::tr1::tuple<String, int> matchVector_t;
typedef TestBaseWithParam<matchVector_t> matchVector; typedef TestBaseWithParam<matchVector_t> matchVector;
#ifdef HAVE_OPENCV_NONFREE #ifdef HAVE_OPENCV_NONFREE_TODO_FIND_WHY_SURF_IS_NOT_ABLE_TO_STITCH_PANOS
#define TEST_DETECTORS testing::Values("surf", "orb") #define TEST_DETECTORS testing::Values("surf", "orb")
#else #else
#define TEST_DETECTORS testing::Values<String>("orb") #define TEST_DETECTORS testing::Values<String>("orb")
...@@ -57,7 +57,11 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS) ...@@ -57,7 +57,11 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
stopTimer(); stopTimer();
} }
SANITY_CHECK(pano, 2); Mat pano_small;
if (!pano.empty())
resize(pano, pano_small, Size(320, 240), 0, 0, INTER_AREA);
SANITY_CHECK(pano_small, 5);
} }
PERF_TEST_P(stitch, b12, TEST_DETECTORS) PERF_TEST_P(stitch, b12, TEST_DETECTORS)
...@@ -91,7 +95,11 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS) ...@@ -91,7 +95,11 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
stopTimer(); stopTimer();
} }
SANITY_CHECK(pano, 2); Mat pano_small;
if (!pano.empty())
resize(pano, pano_small, Size(320, 240), 0, 0, INTER_AREA);
SANITY_CHECK(pano_small, 5);
} }
PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS) PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
...@@ -137,7 +145,11 @@ PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS) ...@@ -137,7 +145,11 @@ PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
matcher->collectGarbage(); 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( PERF_TEST_P( matchVector, bestOf2NearestVectorFeatures, testing::Combine(
...@@ -193,6 +205,8 @@ PERF_TEST_P( matchVector, bestOf2NearestVectorFeatures, testing::Combine( ...@@ -193,6 +205,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); SANITY_CHECK_MATCHES(matches);
} }
...@@ -66,13 +66,13 @@ parse_patterns = ( ...@@ -66,13 +66,13 @@ parse_patterns = (
{'name': "opencv_cxx_flags_debug", 'default': "", 'pattern': re.compile("^OPENCV_EXTRA_C_FLAGS_DEBUG:INTERNAL=(.*)$")}, {'name': "opencv_cxx_flags_debug", 'default': "", 'pattern': re.compile("^OPENCV_EXTRA_C_FLAGS_DEBUG:INTERNAL=(.*)$")},
{'name': "opencv_cxx_flags_release", 'default': "", 'pattern': re.compile("^OPENCV_EXTRA_C_FLAGS_RELEASE:INTERNAL=(.*)$")}, {'name': "opencv_cxx_flags_release", 'default': "", 'pattern': re.compile("^OPENCV_EXTRA_C_FLAGS_RELEASE:INTERNAL=(.*)$")},
{'name': "cxx_flags_android", 'default': None, 'pattern': re.compile("^ANDROID_CXX_FLAGS:INTERNAL=(.*)$")}, {'name': "cxx_flags_android", 'default': None, 'pattern': re.compile("^ANDROID_CXX_FLAGS:INTERNAL=(.*)$")},
{'name': "cxx_compiler_path", 'default': None, 'pattern': re.compile("^CMAKE_CXX_COMPILER:FILEPATH=(.*)$")},
{'name': "ndk_path", 'default': None, 'pattern': re.compile("^(?:ANDROID_NDK|ANDROID_STANDALONE_TOOLCHAIN)?:PATH=(.*)$")}, {'name': "ndk_path", 'default': None, 'pattern': re.compile("^(?:ANDROID_NDK|ANDROID_STANDALONE_TOOLCHAIN)?:PATH=(.*)$")},
{'name': "android_abi", 'default': None, 'pattern': re.compile("^ANDROID_ABI:STRING=(.*)$")}, {'name': "android_abi", 'default': None, 'pattern': re.compile("^ANDROID_ABI:STRING=(.*)$")},
{'name': "android_executable", 'default': None, 'pattern': re.compile("^ANDROID_EXECUTABLE:FILEPATH=(.*android.*)$")}, {'name': "android_executable", 'default': None, 'pattern': re.compile("^ANDROID_EXECUTABLE:FILEPATH=(.*android.*)$")},
{'name': "is_x64", 'default': "OFF", 'pattern': re.compile("^CUDA_64_BIT_DEVICE_CODE:BOOL=(ON)$")},#ugly( {'name': "is_x64", 'default': "OFF", 'pattern': re.compile("^CUDA_64_BIT_DEVICE_CODE:BOOL=(ON)$")},#ugly(
{'name': "cmake_generator", 'default': None, 'pattern': re.compile("^CMAKE_GENERATOR:INTERNAL=(.+)$")}, {'name': "cmake_generator", 'default': None, 'pattern': re.compile("^CMAKE_GENERATOR:INTERNAL=(.+)$")},
{'name': "cxx_compiler", 'default': None, 'pattern': re.compile("^CMAKE_CXX_COMPILER:FILEPATH=(.+)$")}, {'name': "cxx_compiler", 'default': None, 'pattern': re.compile("^CMAKE_CXX_COMPILER:FILEPATH=(.+)$")},
{'name': "cxx_compiler_arg1", 'default': None, 'pattern': re.compile("^CMAKE_CXX_COMPILER_ARG1:[A-Z]+=(.+)$")},
{'name': "with_cuda", 'default': "OFF", 'pattern': re.compile("^WITH_CUDA:BOOL=(ON)$")}, {'name': "with_cuda", 'default': "OFF", 'pattern': re.compile("^WITH_CUDA:BOOL=(ON)$")},
{'name': "cuda_library", 'default': None, 'pattern': re.compile("^CUDA_CUDA_LIBRARY:FILEPATH=(.+)$")}, {'name': "cuda_library", 'default': None, 'pattern': re.compile("^CUDA_CUDA_LIBRARY:FILEPATH=(.+)$")},
{'name': "core_dependencies", 'default': None, 'pattern': re.compile("^opencv_core_LIB_DEPENDS:STATIC=(.+)$")}, {'name': "core_dependencies", 'default': None, 'pattern': re.compile("^opencv_core_LIB_DEPENDS:STATIC=(.+)$")},
...@@ -199,40 +199,51 @@ def getRunningProcessExePathByName(name): ...@@ -199,40 +199,51 @@ def getRunningProcessExePathByName(name):
except: except:
return None return None
class RunInfo(object): class TestSuite(object):
def setCallback(self, name, callback): def __init__(self, options, path = None):
setattr(self, name, callback)
def __init__(self, path, options):
self.options = options self.options = options
self.path = path self.path = path
self.error = None self.error = None
self.setUp = None self.setUp = None
self.tearDown = None self.tearDown = None
self.nameprefix = "opencv_" + options.mode + "_" self.adb = None
self.targetos = None
self.nameprefix = "opencv_" + self.options.mode + "_"
for p in parse_patterns: for p in parse_patterns:
setattr(self, p["name"], p["default"]) setattr(self, p["name"], p["default"])
cachefile = open(os.path.join(path, "CMakeCache.txt"), "rt")
try:
for l in cachefile.readlines():
ll = l.strip()
if not ll or ll.startswith("#"):
continue
for p in parse_patterns:
match = p["pattern"].match(ll)
if match:
value = match.groups()[0]
if value and not value.endswith("-NOTFOUND"):
setattr(self, p["name"], value)
except:
pass
cachefile.close()
if self.path:
cachefile = open(os.path.join(self.path, "CMakeCache.txt"), "rt")
try:
for l in cachefile.readlines():
ll = l.strip()
if not ll or ll.startswith("#"):
continue
for p in parse_patterns:
match = p["pattern"].match(ll)
if match:
value = match.groups()[0]
if value and not value.endswith("-NOTFOUND"):
setattr(self, p["name"], value)
except:
pass
cachefile.close()
# detect target platform
if self.android_executable or self.android_abi or self.ndk_path:
self.targetos = "android"
else:
self.targetos = hostos
self.initialize()
def initialize(self):
# fix empty tests dir # fix empty tests dir
if not self.tests_dir: if not self.tests_dir:
self.tests_dir = self.path self.tests_dir = self.path
self.tests_dir = os.path.normpath(self.tests_dir) self.tests_dir = os.path.normpath(self.tests_dir)
# add path to adb
# compute path to adb
if self.android_executable: if self.android_executable:
self.adb = os.path.join(os.path.dirname(os.path.dirname(self.android_executable)), ("platform-tools/adb","platform-tools/adb.exe")[hostos == 'nt']) self.adb = os.path.join(os.path.dirname(os.path.dirname(self.android_executable)), ("platform-tools/adb","platform-tools/adb.exe")[hostos == 'nt'])
if not os.path.isfile(self.adb) or not os.access(self.adb, os.X_OK): if not os.path.isfile(self.adb) or not os.access(self.adb, os.X_OK):
...@@ -240,20 +251,14 @@ class RunInfo(object): ...@@ -240,20 +251,14 @@ class RunInfo(object):
else: else:
self.adb = None self.adb = None
# detect target platform
if self.android_executable or self.android_abi or self.ndk_path:
self.targetos = "android"
else:
self.targetos = hostos
if self.targetos == "android": if self.targetos == "android":
# fix adb tool location # fix adb tool location
if not self.adb: if not self.adb:
self.adb = getRunningProcessExePathByName("adb") self.adb = getRunningProcessExePathByName("adb")
if not self.adb: if not self.adb:
self.adb = "adb" self.adb = "adb"
if options.adb_serial: if self.options.adb_serial:
self.adb = [self.adb, "-s", options.adb_serial] self.adb = [self.adb, "-s", self.options.adb_serial]
else: else:
self.adb = [self.adb] self.adb = [self.adb]
try: try:
...@@ -261,7 +266,7 @@ class RunInfo(object): ...@@ -261,7 +266,7 @@ class RunInfo(object):
except OSError: except OSError:
self.adb = [] self.adb = []
# remember current device serial. Needed if another device is connected while this script runs # remember current device serial. Needed if another device is connected while this script runs
if self.adb and not options.adb_serial: if self.adb and not self.options.adb_serial:
adb_res = self.runAdb("devices") adb_res = self.runAdb("devices")
if not adb_res: if not adb_res:
self.error = "Could not run adb command: %s (for %s)" % (self.error, self.path) self.error = "Could not run adb command: %s (for %s)" % (self.error, self.path)
...@@ -276,13 +281,10 @@ class RunInfo(object): ...@@ -276,13 +281,10 @@ class RunInfo(object):
self.error = "Too many (%s) devices are connected. Please specify single device using --serial option:\n\n" % (len(connected_devices)) + adb_res self.error = "Too many (%s) devices are connected. Please specify single device using --serial option:\n\n" % (len(connected_devices)) + adb_res
self.adb = [] self.adb = []
else: else:
options.adb_serial = connected_devices[0].split("\t")[0] self.options.adb_serial = connected_devices[0].split("\t")[0]
self.adb = self.adb + ["-s", options.adb_serial] self.adb = self.adb + ["-s", self.options.adb_serial]
if self.adb: if self.adb:
print "adb command:", " ".join(self.adb) # construct name for aapt tool
if self.adb:
#construct name for aapt tool
self.aapt = [os.path.join(os.path.dirname(self.adb[0]), ("aapt","aapt.exe")[hostos == 'nt'])] self.aapt = [os.path.join(os.path.dirname(self.adb[0]), ("aapt","aapt.exe")[hostos == 'nt'])]
# fix has_perf_tests param # fix has_perf_tests param
...@@ -295,14 +297,17 @@ class RunInfo(object): ...@@ -295,14 +297,17 @@ class RunInfo(object):
# fix test path # fix test path
if "Visual Studio" in self.cmake_generator: if "Visual Studio" in self.cmake_generator:
if options.configuration: if self.options.configuration:
self.tests_dir = os.path.join(self.tests_dir, options.configuration) self.tests_dir = os.path.join(self.tests_dir, self.options.configuration)
else: else:
self.tests_dir = os.path.join(self.tests_dir, self.build_type) self.tests_dir = os.path.join(self.tests_dir, self.build_type)
elif not self.is_x64 and self.cxx_compiler: elif not self.is_x64 and self.cxx_compiler:
#one more attempt to detect x64 compiler #one more attempt to detect x64 compiler
try: try:
output = Popen([self.cxx_compiler, "-v"], stdout=PIPE, stderr=PIPE).communicate() compiler = [self.cxx_compiler]
if self.cxx_compiler_arg1:
compiler.append(self.cxx_compiler_arg1)
output = Popen(compiler + ["-v"], stdout=PIPE, stderr=PIPE).communicate()
if not output[0] and "x86_64" in output[1]: if not output[0] and "x86_64" in output[1]:
self.is_x64 = True self.is_x64 = True
except OSError: except OSError:
...@@ -499,9 +504,11 @@ class RunInfo(object): ...@@ -499,9 +504,11 @@ class RunInfo(object):
fd = os.fdopen(tmpfile[0], "w+b") fd = os.fdopen(tmpfile[0], "w+b")
fd.write(SIMD_DETECTION_PROGRAM) fd.write(SIMD_DETECTION_PROGRAM)
fd.close(); fd.close();
options = [self.cxx_compiler_path] options = [self.cxx_compiler]
if self.cxx_compiler_arg1:
options.append(self.cxx_compiler_arg1)
cxx_flags = self.cxx_flags + " " + self.cxx_flags_release + " " + self.opencv_cxx_flags + " " + self.opencv_cxx_flags_release cxx_flags = self.cxx_flags + " " + self.cxx_flags_release + " " + self.opencv_cxx_flags + " " + self.opencv_cxx_flags_release
if self.targetos == "android": if self.targetos == "android" and self.cxx_flags_android:
cxx_flags = self.cxx_flags_android + " " + cxx_flags cxx_flags = self.cxx_flags_android + " " + cxx_flags
prev_option = None prev_option = None
...@@ -634,21 +641,21 @@ class RunInfo(object): ...@@ -634,21 +641,21 @@ class RunInfo(object):
logfile = userlog[0][userlog[0].find(":")+1:] logfile = userlog[0][userlog[0].find(":")+1:]
if self.targetos == "android" and exe.endswith(".apk"): if self.targetos == "android" and exe.endswith(".apk"):
print "running java tests:", exe print "Run java tests:", exe
try: try:
# get package info # get package info
output = Popen(self.aapt + ["dump", "xmltree", exe, "AndroidManifest.xml"], stdout=PIPE, stderr=_stderr).communicate() output = Popen(self.aapt + ["dump", "xmltree", exe, "AndroidManifest.xml"], stdout=PIPE, stderr=_stderr).communicate()
if not output[0]: if not output[0]:
print >> _stderr, "failed to get manifest info from", exe print >> _stderr, "fail to dump manifest from", exe
return return
tags = re.split(r"[ ]+E: ", output[0]) tags = re.split(r"[ ]+E: ", output[0])
#get package name # get package name
manifest_tag = [t for t in tags if t.startswith("manifest ")] manifest_tag = [t for t in tags if t.startswith("manifest ")]
if not manifest_tag: if not manifest_tag:
print >> _stderr, "failed to get manifest info from", exe print >> _stderr, "fail to read package name from", exe
return return
pkg_name = re.search(r"^[ ]+A: package=\"(?P<pkg>.*?)\" \(Raw: \"(?P=pkg)\"\)\r?$", manifest_tag[0], flags=re.MULTILINE).group("pkg") pkg_name = re.search(r"^[ ]+A: package=\"(?P<pkg>.*?)\" \(Raw: \"(?P=pkg)\"\)\r?$", manifest_tag[0], flags=re.MULTILINE).group("pkg")
#get test instrumentation info # get test instrumentation info
instrumentation_tag = [t for t in tags if t.startswith("instrumentation ")] instrumentation_tag = [t for t in tags if t.startswith("instrumentation ")]
if not instrumentation_tag: if not instrumentation_tag:
print >> _stderr, "can not find instrumentation detials in", exe print >> _stderr, "can not find instrumentation detials in", exe
...@@ -663,7 +670,7 @@ class RunInfo(object): ...@@ -663,7 +670,7 @@ class RunInfo(object):
pkg_target += self.options.junit_package pkg_target += self.options.junit_package
else: else:
pkg_target = self.options.junit_package pkg_target = self.options.junit_package
#uninstall already installed package # uninstall previously installed package
print >> _stderr, "Uninstalling old", pkg_name, "from device..." print >> _stderr, "Uninstalling old", pkg_name, "from device..."
Popen(self.adb + ["uninstall", pkg_name], stdout=PIPE, stderr=_stderr).communicate() Popen(self.adb + ["uninstall", pkg_name], stdout=PIPE, stderr=_stderr).communicate()
print >> _stderr, "Installing new", exe, "to device...", print >> _stderr, "Installing new", exe, "to device...",
...@@ -675,10 +682,10 @@ class RunInfo(object): ...@@ -675,10 +682,10 @@ class RunInfo(object):
print >> _stderr, "Failed to install", exe, "to device" print >> _stderr, "Failed to install", exe, "to device"
return return
print >> _stderr, "Running jUnit tests for ", pkg_target print >> _stderr, "Running jUnit tests for ", pkg_target
if self.setUp is not None: if self.setUp:
self.setUp() self.setUp()
Popen(self.adb + ["shell", "am instrument -w -e package " + pkg_target + " " + pkg_name + "/" + pkg_runner], stdout=_stdout, stderr=_stderr).wait() Popen(self.adb + ["shell", "am instrument -w -e package " + pkg_target + " " + pkg_name + "/" + pkg_runner], stdout=_stdout, stderr=_stderr).wait()
if self.tearDown is not None: if self.tearDown:
self.tearDown() self.tearDown()
except OSError: except OSError:
pass pass
...@@ -693,27 +700,27 @@ class RunInfo(object): ...@@ -693,27 +700,27 @@ class RunInfo(object):
andoidcwd = tempdir + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/" andoidcwd = tempdir + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/"
exename = os.path.basename(exe) exename = os.path.basename(exe)
androidexe = andoidcwd + exename androidexe = andoidcwd + exename
#upload # upload
_stderr.write("Uploading... ") _stderr.write("Uploading... ")
output = Popen(self.adb + ["push", exe, androidexe], stdout=_stdout, stderr=_stderr).wait() output = Popen(self.adb + ["push", exe, androidexe], stdout=_stdout, stderr=_stderr).wait()
if output != 0: if output != 0:
print >> _stderr, "adb finishes unexpectedly with error code", output print >> _stderr, "adb finishes unexpectedly with error code", output
return return
#chmod # chmod
output = Popen(self.adb + ["shell", "chmod 777 " + androidexe], stdout=_stdout, stderr=_stderr).wait() output = Popen(self.adb + ["shell", "chmod 777 " + androidexe], stdout=_stdout, stderr=_stderr).wait()
if output != 0: if output != 0:
print >> _stderr, "adb finishes unexpectedly with error code", output print >> _stderr, "adb finishes unexpectedly with error code", output
return return
#run # run
if self.options.help: if self.options.help:
command = exename + " --help" command = exename + " --help"
else: else:
command = exename + " " + " ".join(args) command = exename + " " + " ".join(args)
print >> _stderr, "Run command:", command print >> _stderr, "Run command:", command
if self.setUp is not None: if self.setUp:
self.setUp() self.setUp()
Popen(self.adb + ["shell", "export OPENCV_TEST_DATA_PATH=" + self.test_data_path + "&& cd " + andoidcwd + "&& ./" + command], stdout=_stdout, stderr=_stderr).wait() Popen(self.adb + ["shell", "export OPENCV_TEST_DATA_PATH=" + self.options.test_data_path + "&& cd " + andoidcwd + "&& ./" + command], stdout=_stdout, stderr=_stderr).wait()
if self.tearDown is not None: if self.tearDown:
self.tearDown() self.tearDown()
# try get log # try get log
if not self.options.help: if not self.options.help:
...@@ -758,6 +765,7 @@ class RunInfo(object): ...@@ -758,6 +765,7 @@ class RunInfo(object):
try: try:
shutil.rmtree(temp_path) shutil.rmtree(temp_path)
pass
except: except:
pass pass
...@@ -767,8 +775,12 @@ class RunInfo(object): ...@@ -767,8 +775,12 @@ class RunInfo(object):
return None return None
def runTests(self, tests, _stdout, _stderr, workingDir, args = []): def runTests(self, tests, _stdout, _stderr, workingDir, args = []):
if not self.isRunnable():
print >> _stderr, "Error:", self.error
if self.error: if self.error:
return [] return []
if self.adb and self.targetos == "android":
print "adb command:", " ".join(self.adb)
if not tests: if not tests:
tests = self.tests tests = self.tests
logs = [] logs = []
...@@ -802,7 +814,6 @@ if __name__ == "__main__": ...@@ -802,7 +814,6 @@ if __name__ == "__main__":
parser = OptionParser() parser = OptionParser()
parser.add_option("-t", "--tests", dest="tests", help="comma-separated list of modules to test", metavar="SUITS", default="") parser.add_option("-t", "--tests", dest="tests", help="comma-separated list of modules to test", metavar="SUITS", default="")
parser.add_option("-w", "--cwd", dest="cwd", help="working directory for tests", metavar="PATH", default=".") parser.add_option("-w", "--cwd", dest="cwd", help="working directory for tests", metavar="PATH", default=".")
parser.add_option("-a", "--accuracy", dest="accuracy", help="look for accuracy tests instead of performance tests", action="store_true", default=False) parser.add_option("-a", "--accuracy", dest="accuracy", help="look for accuracy tests instead of performance tests", action="store_true", default=False)
parser.add_option("-l", "--longname", dest="useLongNames", action="store_true", help="generate log files with long names", default=False) parser.add_option("-l", "--longname", dest="useLongNames", action="store_true", help="generate log files with long names", default=False)
...@@ -812,6 +823,7 @@ if __name__ == "__main__": ...@@ -812,6 +823,7 @@ if __name__ == "__main__":
parser.add_option("", "--package", dest="junit_package", help="Android: run jUnit tests for specified package", metavar="package", default="") parser.add_option("", "--package", dest="junit_package", help="Android: run jUnit tests for specified package", metavar="package", default="")
parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False) parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False)
parser.add_option("", "--check", dest="check", help="Shortcut for '--perf_min_samples=1 --perf_force_samples=1'", action="store_true", default=False) parser.add_option("", "--check", dest="check", help="Shortcut for '--perf_min_samples=1 --perf_force_samples=1'", action="store_true", default=False)
parser.add_option("", "--list", dest="list", help="List available tests", action="store_true", default=False)
(options, args) = parser.parse_args(argv) (options, args) = parser.parse_args(argv)
...@@ -823,7 +835,7 @@ if __name__ == "__main__": ...@@ -823,7 +835,7 @@ if __name__ == "__main__":
run_args = getRunArgs(args[1:] or ['.']) run_args = getRunArgs(args[1:] or ['.'])
if len(run_args) == 0: if len(run_args) == 0:
print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<build_path>" print >> sys.stderr, "Usage:", os.path.basename(sys.argv[0]), "[options] [build_path]"
exit(1) exit(1)
tests = [s.strip() for s in options.tests.split(",") if s] tests = [s.strip() for s in options.tests.split(",") if s]
...@@ -833,17 +845,25 @@ if __name__ == "__main__": ...@@ -833,17 +845,25 @@ if __name__ == "__main__":
test_args = [a for a in test_args if not a.startswith("--gtest_output=")] test_args = [a for a in test_args if not a.startswith("--gtest_output=")]
if options.check: if options.check:
test_args.extend(["--perf_min_samples=1", "--perf_force_samples=1"]) if not [a for a in test_args if a.startswith("--perf_min_samples=")] :
test_args.extend(["--perf_min_samples=1"])
if not [a for a in test_args if a.startswith("--perf_force_samples=")] :
test_args.extend(["--perf_force_samples=1"])
if not [a for a in test_args if a.startswith("--perf_verify_sanity")] :
test_args.extend(["--perf_verify_sanity"])
logs = [] logs = []
test_list = []
for path in run_args: for path in run_args:
info = RunInfo(path, options) suite = TestSuite(options, path)
#print vars(info),"\n" #print vars(suite),"\n"
if not info.isRunnable(): if options.list:
print >> sys.stderr, "Error:", info.error test_list.extend(suite.tests)
else: else:
info.test_data_path = options.test_data_path logs.extend(suite.runTests(tests, sys.stdout, sys.stderr, options.cwd, test_args))
logs.extend(info.runTests(tests, sys.stdout, sys.stderr, options.cwd, test_args))
if options.list:
print os.linesep.join(test_list) or "No tests found"
if logs: if logs:
print >> sys.stderr, "Collected: ", " ".join(logs) print >> sys.stderr, "Collected: ", " ".join(logs)
...@@ -16,7 +16,8 @@ const std::string command_line_keys = ...@@ -16,7 +16,8 @@ const std::string command_line_keys =
"{ perf_force_samples |100 |force set maximum number of samples for all tests}" "{ perf_force_samples |100 |force set maximum number of samples for all tests}"
"{ perf_seed |809564 |seed for random numbers generator}" "{ perf_seed |809564 |seed for random numbers generator}"
"{ perf_threads |-1 |the number of worker threads, if parallel execution is enabled}" "{ perf_threads |-1 |the number of worker threads, if parallel execution is enabled}"
"{ perf_write_sanity | |allow to create new records for sanity checks}" "{ perf_write_sanity | |create new records for sanity checks}"
"{ perf_verify_sanity | |fail tests having no regression data for sanity checks}"
#ifdef ANDROID #ifdef ANDROID
"{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}" "{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
"{ perf_affinity_mask |0 |set affinity mask for the main thread}" "{ perf_affinity_mask |0 |set affinity mask for the main thread}"
...@@ -41,6 +42,7 @@ static uint64 param_seed; ...@@ -41,6 +42,7 @@ static uint64 param_seed;
static double param_time_limit; static double param_time_limit;
static int param_threads; static int param_threads;
static bool param_write_sanity; static bool param_write_sanity;
static bool param_verify_sanity;
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
static bool param_run_cpu; static bool param_run_cpu;
static int param_cuda_device; static int param_cuda_device;
...@@ -491,7 +493,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR ...@@ -491,7 +493,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv::minMaxLoc(diff.reshape(1), 0, &max); cv::minMaxLoc(diff.reshape(1), 0, &max);
FAIL() << " Absolute difference (=" << max << ") between argument \"" FAIL() << " Absolute difference (=" << max << ") between argument \""
<< node.name() << "[" << idx << "]\" and expected value is bugger than " << eps; << node.name() << "[" << idx << "]\" and expected value is greater than " << eps;
} }
} }
else if (err == ERROR_RELATIVE) else if (err == ERROR_RELATIVE)
...@@ -501,7 +503,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR ...@@ -501,7 +503,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if (violations > 0) if (violations > 0)
{ {
FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \"" FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \""
<< node.name() << "[" << idx << "]\" and expected value is bugger than " << eps << " in " << violations << " points"; << node.name() << "[" << idx << "]\" and expected value is greater than " << eps << " in " << violations << " points";
} }
} }
} }
...@@ -545,7 +547,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR ...@@ -545,7 +547,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv::minMaxLoc(diff.reshape(1), 0, &max); cv::minMaxLoc(diff.reshape(1), 0, &max);
FAIL() << " Difference (=" << max << ") between argument1 \"" << node.name() FAIL() << " Difference (=" << max << ") between argument1 \"" << node.name()
<< "\" and expected value is bugger than " << eps; << "\" and expected value is greater than " << eps;
} }
} }
else if (err == ERROR_RELATIVE) else if (err == ERROR_RELATIVE)
...@@ -555,7 +557,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR ...@@ -555,7 +557,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if (violations > 0) if (violations > 0)
{ {
FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \"" << node.name() FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \"" << node.name()
<< "\" and expected value is bugger than " << eps << " in " << violations << " points"; << "\" and expected value is greater than " << eps << " in " << violations << " points";
} }
} }
} }
...@@ -595,10 +597,15 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra ...@@ -595,10 +597,15 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
write() << nodename << "{"; write() << nodename << "{";
} }
// TODO: verify that name is alphanumeric, current error message is useless
write() << name << "{"; write() << name << "{";
write(array); write(array);
write() << "}"; write() << "}";
} }
else if(param_verify_sanity)
{
ADD_FAILURE() << " No regression data for " << name << " argument";
}
} }
else else
{ {
...@@ -656,6 +663,7 @@ void TestBase::Init(int argc, const char* const argv[]) ...@@ -656,6 +663,7 @@ void TestBase::Init(int argc, const char* const argv[])
param_time_limit = std::max(0., args.get<double>("perf_time_limit")); param_time_limit = std::max(0., args.get<double>("perf_time_limit"));
param_force_samples = args.get<unsigned int>("perf_force_samples"); param_force_samples = args.get<unsigned int>("perf_force_samples");
param_write_sanity = args.has("perf_write_sanity"); param_write_sanity = args.has("perf_write_sanity");
param_verify_sanity = args.has("perf_verify_sanity");
param_threads = args.get<int>("perf_threads"); param_threads = args.get<int>("perf_threads");
#ifdef ANDROID #ifdef ANDROID
param_affinity_mask = args.get<int>("perf_affinity_mask"); param_affinity_mask = args.get<int>("perf_affinity_mask");
...@@ -970,7 +978,7 @@ void TestBase::validateMetrics() ...@@ -970,7 +978,7 @@ void TestBase::validateMetrics()
if (m.gstddev > DBL_EPSILON) if (m.gstddev > DBL_EPSILON)
{ {
EXPECT_GT(/*m.gmean * */1., /*m.gmean * */ 2 * sinh(m.gstddev * param_max_deviation)) 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 bigger than measured time interval)."; << " Test results are not reliable ((mean-sigma,mean+sigma) deviation interval is greater than measured time interval).";
} }
EXPECT_LE(m.outliers, std::max((unsigned int)cvCeil(m.samples * param_max_outliers / 100.), 1u)) EXPECT_LE(m.outliers, std::max((unsigned int)cvCeil(m.samples * param_max_outliers / 100.), 1u))
......
package org.opencv.samples.tutorial5; package org.opencv.samples.tutorial5;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
...@@ -9,6 +11,7 @@ import org.opencv.android.OpenCVLoader; ...@@ -9,6 +11,7 @@ import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat; import org.opencv.core.Mat;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
...@@ -20,6 +23,7 @@ import android.view.SurfaceView; ...@@ -20,6 +23,7 @@ import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast;
public class Sample5CameraControl extends Activity implements CvCameraViewListener, OnTouchListener { public class Sample5CameraControl extends Activity implements CvCameraViewListener, OnTouchListener {
private static final String TAG = "OCVSample::Activity"; private static final String TAG = "OCVSample::Activity";
...@@ -100,6 +104,11 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen ...@@ -100,6 +104,11 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
List<String> effects = mOpenCvCameraView.getEffectList(); 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()]; mEffectMenuItems = new MenuItem[effects.size()];
int idx = 0; int idx = 0;
...@@ -115,13 +124,20 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen ...@@ -115,13 +124,20 @@ public class Sample5CameraControl extends Activity implements CvCameraViewListen
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
Log.i(TAG, "called onOptionsItemSelected; selected item: " + item); Log.i(TAG, "called onOptionsItemSelected; selected item: " + item);
mOpenCvCameraView.setEffect((String) item.getTitle()); mOpenCvCameraView.setEffect((String) item.getTitle());
Toast.makeText(this, mOpenCvCameraView.getEffect(), Toast.LENGTH_SHORT).show();
return true; return true;
} }
@SuppressLint("SimpleDateFormat")
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
Log.i(TAG,"onTouch 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; return false;
} }
} }
...@@ -25,6 +25,10 @@ public class SampleJavaCameraView extends JavaCameraView { ...@@ -25,6 +25,10 @@ public class SampleJavaCameraView extends JavaCameraView {
return mCamera.getParameters().getSupportedColorEffects(); return mCamera.getParameters().getSupportedColorEffects();
} }
public boolean isEffectSupported() {
return (mCamera.getParameters().getColorEffect() != null);
}
public String getEffect() { public String getEffect() {
return mCamera.getParameters().getColorEffect(); return mCamera.getParameters().getColorEffect();
} }
...@@ -48,6 +52,7 @@ public class SampleJavaCameraView extends JavaCameraView { ...@@ -48,6 +52,7 @@ public class SampleJavaCameraView extends JavaCameraView {
try { try {
FileOutputStream out = new FileOutputStream(mPictureFileName); FileOutputStream out = new FileOutputStream(mPictureFileName);
picture.compress(Bitmap.CompressFormat.JPEG, 90, out); picture.compress(Bitmap.CompressFormat.JPEG, 90, out);
picture.recycle();
mCamera.startPreview(); mCamera.startPreview();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment