Merge pull request #1096 from SpecLad:merge-2.4

pull/1075/head
Roman Donchenko 12 years ago committed by OpenCV Buildbot
commit 68a992b075
  1. 25
      3rdparty/tbb/CMakeLists.txt
  2. 4
      doc/tutorials/introduction/android_binary_package/O4A_SDK.rst
  3. 6
      modules/features2d/include/opencv2/features2d.hpp
  4. 7
      modules/highgui/src/cap_qtkit.mm
  5. 14
      modules/java/generator/src/java/android+JavaCameraView.java
  6. 4
      modules/ocl/include/opencv2/ocl/matrix_operations.hpp
  7. 201
      modules/ocl/src/opencl/stereobp.cl
  8. 6
      modules/ocl/src/stereobp.cpp
  9. 73
      modules/ts/misc/xls-report.py
  10. 4
      platforms/android/service/engine/AndroidManifest.xml
  11. 12
      platforms/android/service/readme.txt
  12. 2
      samples/android/native-activity/.cproject
  13. 5
      samples/android/native-activity/AndroidManifest.xml
  14. 2
      samples/android/native-activity/jni/Android.mk
  15. 21
      samples/android/native-activity/jni/native.cpp

@ -5,14 +5,23 @@ if (WIN32 AND NOT ARM)
message(FATAL_ERROR "BUILD_TBB option supports Windows on ARM only!\nUse regular official TBB build instead of the BUILD_TBB option!")
endif()
# 4.1 update 4 - works fine
set(tbb_ver "tbb41_20130613oss")
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz")
set(tbb_md5 "108c8c1e481b0aaea61878289eb28b6a")
set(tbb_version_file "version_string.ver")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused-parameter)
# 4.1 update 3 dev - works fine
if (WIN32 AND ARM)
# 4.1 update 4 - The first release that supports Windows RT. Hangs on some Android devices
set(tbb_ver "tbb41_20130613oss")
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz")
set(tbb_md5 "108c8c1e481b0aaea61878289eb28b6a")
set(tbb_version_file "version_string.ver")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused-parameter)
else()
# 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)
endif()
# 4.1 update 3 dev - Hangs on some Android devices
#set(tbb_ver "tbb41_20130401oss")
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130401oss_src.tgz")
#set(tbb_md5 "f2f591a0d2ca8f801e221ce7d9ea84bb")

@ -51,7 +51,7 @@ The structure of package contents looks as follows:
OpenCV-2.4.6-android-sdk
|_ apk
| |_ OpenCV_2.4.6_binary_pack_armv7a.apk
| |_ OpenCV_2.4.6_Manager_2.8_XXX.apk
| |_ OpenCV_2.4.6_Manager_2.9_XXX.apk
|
|_ doc
|_ samples
@ -295,7 +295,7 @@ Well, running samples from Eclipse is very simple:
.. code-block:: sh
:linenos:
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.6_Manager_2.8_armv7a-neon.apk
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.6_Manager_2.9_armv7a-neon.apk
.. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
platform targets:

@ -535,11 +535,11 @@ protected:
};
class CV_EXPORTS GFTTDetector : public FeatureDetector
class CV_EXPORTS_W GFTTDetector : public FeatureDetector
{
public:
GFTTDetector( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
CV_WRAP GFTTDetector( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
AlgorithmInfo* info() const;
protected:

@ -275,11 +275,8 @@ bool CvCaptureCAM::grabFrame(double timeOut) {
double sleepTime = 0.005;
double total = 0;
NSDate *loopUntil = [NSDate dateWithTimeIntervalSinceNow:sleepTime];
while (![capture updateImage] && (total += sleepTime)<=timeOut &&
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate:loopUntil])
loopUntil = [NSDate dateWithTimeIntervalSinceNow:sleepTime];
while (![capture updateImage] && (total += sleepTime)<=timeOut)
usleep((int)(sleepTime*1000));
[localpool drain];

@ -38,7 +38,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
private boolean mStopThread;
protected Camera mCamera;
protected JavaCameraFrame mCameraFrame;
protected JavaCameraFrame[] mCameraFrame;
private SurfaceTexture mSurfaceTexture;
public static class JavaCameraSizeAccessor implements ListItemAccessor {
@ -180,7 +180,9 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
AllocateCache();
mCameraFrame = new JavaCameraFrame(mFrameChain[mChainIdx], mFrameWidth, mFrameHeight);
mCameraFrame = new JavaCameraFrame[2];
mCameraFrame[0] = new JavaCameraFrame(mFrameChain[0], mFrameWidth, mFrameHeight);
mCameraFrame[1] = new JavaCameraFrame(mFrameChain[1], mFrameWidth, mFrameHeight);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID);
@ -216,8 +218,10 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
mFrameChain[0].release();
mFrameChain[1].release();
}
if (mCameraFrame != null)
mCameraFrame.release();
if (mCameraFrame != null) {
mCameraFrame[0].release();
mCameraFrame[1].release();
}
}
}
@ -318,7 +322,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
if (!mStopThread) {
if (!mFrameChain[mChainIdx].empty())
deliverAndDrawFrame(mCameraFrame);
deliverAndDrawFrame(mCameraFrame[mChainIdx]);
mChainIdx = 1 - mChainIdx;
}
} while (!mStopThread);

@ -211,8 +211,8 @@ namespace cv
{
flags &= roi.width < m.cols ? ~Mat::CONTINUOUS_FLAG : -1;
offset += roi.y * step + roi.x * elemSize();
CV_Assert( 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols &&
0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows );
CV_Assert( 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.wholecols &&
0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.wholerows );
if( refcount )
CV_XADD(refcount, 1);
if( rows <= 0 || cols <= 0 )

@ -56,8 +56,10 @@
#ifdef T_FLOAT
#define T float
#define T4 float4
#else
#define T short
#define T4 short4
#endif
///////////////////////////////////////////////////////////////
@ -71,6 +73,14 @@ T saturate_cast(float v){
#endif
}
T4 saturate_cast4(float4 v){
#ifdef T_SHORT
return convert_short4_sat_rte(v);
#else
return v;
#endif
}
#define FLOAT_MAX 3.402823466e+38f
typedef struct
{
@ -84,29 +94,14 @@ typedef struct
////////////////////////// comp data //////////////////////////
///////////////////////////////////////////////////////////////
float pix_diff_1(__global const uchar *ls, __global const uchar *rs)
inline float pix_diff_1(const uchar4 l, __global const uchar *rs)
{
return abs((int)(*ls) - *rs);
return abs((int)(l.x) - *rs);
}
float pix_diff_3(__global const uchar *ls, __global const uchar *rs)
float pix_diff_4(const uchar4 l, __global const uchar *rs)
{
const float tr = 0.299f;
const float tg = 0.587f;
const float tb = 0.114f;
float val;
val = tb * abs((int)ls[0] - rs[0]);
val += tg * abs((int)ls[1] - rs[1]);
val += tr * abs((int)ls[2] - rs[2]);
return val;
}
float pix_diff_4(__global const uchar *ls, __global const uchar *rs)
{
uchar4 l, r;
l = *((__global uchar4 *)ls);
uchar4 r;
r = *((__global uchar4 *)rs);
const float tr = 0.299f;
@ -122,11 +117,19 @@ float pix_diff_4(__global const uchar *ls, __global const uchar *rs)
return val;
}
inline float pix_diff_3(const uchar4 l, __global const uchar *rs)
{
return pix_diff_4(l, rs);
}
#ifndef CN
#define CN 4
#endif
#ifndef CNDISP
#define CNDISP 64
#endif
#define CAT(X,Y) X##Y
#define CAT2(X,Y) CAT(X,Y)
@ -149,19 +152,20 @@ __kernel void comp_data(__global uchar *left, int left_rows, int left_cols, i
__global T *ds = data + y * data_step + x;
const unsigned int disp_step = data_step * left_rows;
const float weightXterm = con_st -> cdata_weight * con_st -> cmax_data_term;
const uchar4 ls_data = vload4(0, ls);
for (int disp = 0; disp < con_st -> cndisp; disp++)
{
if (x - disp >= 1)
{
float val = 0;
val = PIX_DIFF(ls, rs - disp * CN);
ds[disp * disp_step] = saturate_cast(fmin(con_st -> cdata_weight * val,
con_st -> cdata_weight * con_st -> cmax_data_term));
val = PIX_DIFF(ls_data, rs - disp * CN);
ds[disp * disp_step] = saturate_cast(fmin(con_st -> cdata_weight * val, weightXterm));
}
else
{
ds[disp * disp_step] = saturate_cast(con_st -> cdata_weight * con_st -> cmax_data_term);
ds[disp * disp_step] = saturate_cast(weightXterm);
}
}
}
@ -182,13 +186,20 @@ __kernel void data_step_down(__global T *src, int src_rows,
{
src_step /= sizeof(T);
dst_step /= sizeof(T);
int4 coor_step = (int4)(src_rows * src_step);
int4 coor = (int4)(min(2*y+0, src_rows-1) * src_step + 2*x+0,
min(2*y+1, src_rows-1) * src_step + 2*x+0,
min(2*y+0, src_rows-1) * src_step + 2*x+1,
min(2*y+1, src_rows-1) * src_step + 2*x+1);
for (int d = 0; d < cndisp; ++d)
{
float dst_reg;
dst_reg = src[(d * src_rows + min(2*y+0, src_rows-1)) * src_step + 2*x+0];
dst_reg += src[(d * src_rows + min(2*y+1, src_rows-1)) * src_step + 2*x+0];
dst_reg += src[(d * src_rows + min(2*y+0, src_rows-1)) * src_step + 2*x+1];
dst_reg += src[(d * src_rows + min(2*y+1, src_rows-1)) * src_step + 2*x+1];
dst_reg = src[coor.x];
dst_reg += src[coor.y];
dst_reg += src[coor.z];
dst_reg += src[coor.w];
coor += coor_step;
dst[(d * dst_rows + y) * dst_step + x] = saturate_cast(dst_reg);
}
@ -224,85 +235,95 @@ __kernel void level_up_message(__global T *src, int src_rows, int src_step,
///////////////////////////////////////////////////////////////
//////////////////// calc all iterations /////////////////////
///////////////////////////////////////////////////////////////
void calc_min_linear_penalty(__global T * dst, int disp_step,
int cndisp, float cdisc_single_jump)
void message(__global T *us_, __global T *ds_, __global T *ls_, __global T *rs_,
const __global T *dt,
int u_step, int msg_disp_step, int data_disp_step,
float4 cmax_disc_term, float4 cdisc_single_jump)
{
float prev = dst[0];
float cur;
__global T *us = us_ + u_step;
__global T *ds = ds_ - u_step;
__global T *ls = ls_ + 1;
__global T *rs = rs_ - 1;
for (int disp = 1; disp < cndisp; ++disp)
{
prev += cdisc_single_jump;
cur = dst[disp_step * disp];
float4 minimum = (float4)(FLOAT_MAX);
if (prev < cur)
{
cur = prev;
dst[disp_step * disp] = saturate_cast(prev);
}
T4 t_dst[CNDISP];
float4 dst_reg;
float4 prev;
float4 cur;
prev = cur;
}
T t_us = us[0];
T t_ds = ds[0];
T t_ls = ls[0];
T t_rs = rs[0];
T t_dt = dt[0];
prev = dst[(cndisp - 1) * disp_step];
for (int disp = cndisp - 2; disp >= 0; disp--)
{
prev += cdisc_single_jump;
cur = dst[disp_step * disp];
prev = (float4)(t_us + t_ls + t_rs + t_dt,
t_ds + t_ls + t_rs + t_dt,
t_us + t_ds + t_rs + t_dt,
t_us + t_ds + t_ls + t_dt);
if (prev < cur)
{
cur = prev;
dst[disp_step * disp] = saturate_cast(prev);
}
prev = cur;
}
}
void message(const __global T *msg1, const __global T *msg2,
const __global T *msg3, const __global T *data, __global T *dst,
int msg_disp_step, int data_disp_step, int cndisp, float cmax_disc_term, float cdisc_single_jump)
{
float minimum = FLOAT_MAX;
minimum = min(prev, minimum);
t_dst[0] = saturate_cast4(prev);
for(int i = 0; i < cndisp; ++i)
for(int i = 1, idx = msg_disp_step; i < CNDISP; ++i, idx+=msg_disp_step)
{
float dst_reg;
dst_reg = msg1[msg_disp_step * i];
dst_reg += msg2[msg_disp_step * i];
dst_reg += msg3[msg_disp_step * i];
dst_reg += data[data_disp_step * i];
t_us = us[idx];
t_ds = ds[idx];
t_ls = ls[idx];
t_rs = rs[idx];
t_dt = dt[data_disp_step * i];
if (dst_reg < minimum)
minimum = dst_reg;
dst_reg = (float4)(t_us + t_ls + t_rs + t_dt,
t_ds + t_ls + t_rs + t_dt,
t_us + t_ds + t_rs + t_dt,
t_us + t_ds + t_ls + t_dt);
dst[msg_disp_step * i] = saturate_cast(dst_reg);
}
minimum = min(dst_reg, minimum);
calc_min_linear_penalty(dst, msg_disp_step, cndisp, cdisc_single_jump);
prev += cdisc_single_jump;
prev = min(prev, dst_reg);
t_dst[i] = saturate_cast4(prev);
}
minimum += cmax_disc_term;
float sum = 0;
for(int i = 0; i < cndisp; ++i)
float4 sum = 0;
prev = convert_float4(t_dst[CNDISP - 1]);
for (int disp = CNDISP - 2; disp >= 0; disp--)
{
float dst_reg = dst[msg_disp_step * i];
if (dst_reg > minimum)
{
dst_reg = minimum;
dst[msg_disp_step * i] = saturate_cast(minimum);
}
sum += dst_reg;
prev += cdisc_single_jump;
cur = convert_float4(t_dst[disp]);
prev = min(prev, cur);
cur = min(prev, minimum);
sum += cur;
t_dst[disp] = saturate_cast4(cur);
}
sum /= cndisp;
for(int i = 0; i < cndisp; ++i)
dst[msg_disp_step * i] -= sum;
dst_reg = convert_float4(t_dst[CNDISP - 1]);
dst_reg = min(dst_reg, minimum);
t_dst[CNDISP - 1] = saturate_cast4(dst_reg);
sum += dst_reg;
sum /= CNDISP;
#pragma unroll
for(int i = 0, idx = 0; i < CNDISP; ++i, idx+=msg_disp_step)
{
T4 dst = t_dst[i];
us_[idx] = dst.x - sum.x;
ds_[idx] = dst.y - sum.y;
rs_[idx] = dst.z - sum.z;
ls_[idx] = dst.w - sum.w;
}
}
__kernel void one_iteration(__global T *u, int u_step,
__global T *data, int data_step,
__global T *d, __global T *l, __global T *r,
int t, int cols, int rows,
int cndisp, float cmax_disc_term, float cdisc_single_jump)
float cmax_disc_term, float cdisc_single_jump)
{
const int y = get_global_id(1);
const int x = ((get_global_id(0)) << 1) + ((y + t) & 1);
@ -321,15 +342,9 @@ __kernel void one_iteration(__global T *u, int u_step,
int msg_disp_step = u_step * rows;
int data_disp_step = data_step * rows;
message(us + u_step, ls + 1, rs - 1, dt, us, msg_disp_step, data_disp_step, cndisp,
cmax_disc_term, cdisc_single_jump);
message(ds - u_step, ls + 1, rs - 1, dt, ds, msg_disp_step, data_disp_step, cndisp,
cmax_disc_term, cdisc_single_jump);
message(us + u_step, ds - u_step, rs - 1, dt, rs, msg_disp_step, data_disp_step, cndisp,
cmax_disc_term, cdisc_single_jump);
message(us + u_step, ds - u_step, ls + 1, dt, ls, msg_disp_step, data_disp_step, cndisp,
cmax_disc_term, cdisc_single_jump);
message(us, ds, ls, rs, dt,
u_step, msg_disp_step, data_disp_step,
(float4)(cmax_disc_term), (float4)(cdisc_single_jump));
}
}

@ -235,13 +235,13 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_int) , (void *)&t));
args.push_back( std::make_pair( sizeof(cl_int) , (void *)&cols));
args.push_back( std::make_pair( sizeof(cl_int) , (void *)&rows));
args.push_back( std::make_pair( sizeof(cl_int) , (void *)&cndisp));
args.push_back( std::make_pair( sizeof(cl_float) , (void *)&cmax_disc_term));
args.push_back( std::make_pair( sizeof(cl_float) , (void *)&cdisc_single_jump));
size_t gt[3] = {cols, rows, 1}, lt[3] = {16, 16, 1};
const char* t_opt = data_type == CV_16S ? "-D T_SHORT":"-D T_FLOAT";
openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, t_opt);
char opt[80] = "";
sprintf(opt, "-D %s -D CNDISP=%d", data_type == CV_16S ? "T_SHORT":"T_FLOAT", cndisp);
openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, opt);
}
static void calc_all_iterations_calls(int cols, int rows, int iters, oclMat &u,

@ -40,9 +40,15 @@
Corollary 2: an empty 'properties' dictionary matches every property set.
3) If a matching matcher is found, its 'name' string is presumed to be the name
of the configuration the XML file corresponds to. Otherwise, a warning is
printed. A warning is also printed if two different property sets match to the
same configuration name.
of the configuration the XML file corresponds to. A warning is printed if
two different property sets match to the same configuration name.
4) If a such a matcher isn't found, if --include-unmatched was specified, the
configuration name is assumed to be the relative path from the sheet's
directory to the XML file's containing directory. If the XML file isinstance
directly inside the sheet's directory, the configuration name is instead
a dump of all its properties. If --include-unmatched wasn't specified,
the XML file is ignored and a warning is printed.
* 'configurations': [string]
List of names for compile-time and runtime configurations of OpenCV.
@ -67,6 +73,7 @@
from __future__ import division
import ast
import errno
import fnmatch
import logging
import numbers
@ -74,7 +81,6 @@ import os, os.path
import re
from argparse import ArgumentParser
from collections import OrderedDict
from glob import glob
from itertools import ifilter
@ -96,18 +102,25 @@ error_speedup_style = xlwt.easyxf('pattern: pattern solid, fore_color orange')
header_style = xlwt.easyxf('font: bold true; alignment: horizontal centre, vertical top, wrap True')
class Collector(object):
def __init__(self, config_match_func):
def __init__(self, config_match_func, include_unmatched):
self.__config_cache = {}
self.config_match_func = config_match_func
self.include_unmatched = include_unmatched
self.tests = {}
self.extra_configurations = set()
# Format a sorted sequence of pairs as if it was a dictionary.
# We can't just use a dictionary instead, since we want to preserve the sorted order of the keys.
@staticmethod
def __format_config_cache_key(pairs):
return '{' + ', '.join(repr(k) + ': ' + repr(v) for (k, v) in pairs) + '}'
def collect_from(self, xml_path):
def __format_config_cache_key(pairs, multiline=False):
return (
('{\n' if multiline else '{') +
(',\n' if multiline else ', ').join(
(' ' if multiline else '') + repr(k) + ': ' + repr(v) for (k, v) in pairs) +
('\n}\n' if multiline else '}')
)
def collect_from(self, xml_path, default_configuration):
run = parseLogFile(xml_path)
module = run.properties['module_name']
@ -123,8 +136,17 @@ class Collector(object):
configuration = self.config_match_func(properties)
if configuration is None:
logging.warning('failed to match properties to a configuration: %s',
Collector.__format_config_cache_key(props_key))
if self.include_unmatched:
if default_configuration is not None:
configuration = default_configuration
else:
configuration = Collector.__format_config_cache_key(props_key, multiline=True)
self.extra_configurations.add(configuration)
else:
logging.warning('failed to match properties to a configuration: %s',
Collector.__format_config_cache_key(props_key))
else:
same_config_props = [it[0] for it in self.__config_cache.iteritems() if it[1] == configuration]
if len(same_config_props) > 0:
@ -137,11 +159,17 @@ class Collector(object):
if configuration is None: return
module_tests = self.tests.setdefault(module, OrderedDict())
module_tests = self.tests.setdefault(module, {})
for test in run.tests:
test_results = module_tests.setdefault((test.shortName(), test.param()), {})
test_results[configuration] = test.get("gmean") if test.status == 'run' else test.status
new_result = test.get("gmean") if test.status == 'run' else test.status
test_results[configuration] = min(
test_results.get(configuration), new_result,
key=lambda r: (1, r) if isinstance(r, numbers.Number) else
(2,) if r is not None else
(3,)
) # prefer lower result; prefer numbers to errors and errors to nothing
def make_match_func(matchers):
def match_func(properties):
@ -159,6 +187,8 @@ def main():
arg_parser.add_argument('sheet_dirs', nargs='+', metavar='DIR', help='directory containing perf test logs')
arg_parser.add_argument('-o', '--output', metavar='XLS', default='report.xls', help='name of output file')
arg_parser.add_argument('-c', '--config', metavar='CONF', help='global configuration file')
arg_parser.add_argument('--include-unmatched', action='store_true',
help='include results from XML files that were not recognized by configuration matchers')
args = arg_parser.parse_args()
@ -176,7 +206,8 @@ def main():
try:
with open(os.path.join(sheet_path, 'sheet.conf')) as sheet_conf_file:
sheet_conf = ast.literal_eval(sheet_conf_file.read())
except Exception:
except IOError as ioe:
if ioe.errno != errno.ENOENT: raise
sheet_conf = {}
logging.debug('no sheet.conf for %s', sheet_path)
@ -185,12 +216,18 @@ def main():
config_names = sheet_conf.get('configurations', [])
config_matchers = sheet_conf.get('configuration_matchers', [])
collector = Collector(make_match_func(config_matchers))
collector = Collector(make_match_func(config_matchers), args.include_unmatched)
for root, _, filenames in os.walk(sheet_path):
logging.info('looking in %s', root)
for filename in fnmatch.filter(filenames, '*.xml'):
collector.collect_from(os.path.join(root, filename))
if os.path.normpath(sheet_path) == os.path.normpath(root):
default_conf = None
else:
default_conf = os.path.relpath(root, sheet_path)
collector.collect_from(os.path.join(root, filename), default_conf)
config_names.extend(sorted(collector.extra_configurations - set(config_names)))
sheet = wb.add_sheet(sheet_conf.get('sheet_name', os.path.basename(os.path.abspath(sheet_path))))
@ -203,7 +240,7 @@ def main():
sheet_comparisons = sheet_conf.get('comparisons', [])
for i, w in enumerate([2000, 15000, 2500, 2000, 15000]
+ (len(config_names) + 1 + len(sheet_comparisons)) * [3000]):
+ (len(config_names) + 1 + len(sheet_comparisons)) * [4000]):
sheet.col(i).width = w
for i, caption in enumerate(['Module', 'Test', 'Image\nsize', 'Data\ntype', 'Parameters']
@ -218,7 +255,7 @@ def main():
for module, color in module_colors.iteritems()}
for module, tests in sorted(collector.tests.iteritems()):
for ((test, param), configs) in tests.iteritems():
for ((test, param), configs) in sorted(tests.iteritems()):
sheet.write(row, 0, module, module_styles.get(module, xlwt.Style.default_style))
sheet.write(row, 1, test)

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.engine"
android:versionCode="28@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName="2.8" >
android:versionCode="29@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName="2.9" >
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

@ -14,20 +14,20 @@ manually using adb tool:
.. code-block:: sh
adb install OpenCV-2.4.6-android-sdk/apk/OpenCV_2.4.6_Manager_2.8_<platform>.apk
adb install OpenCV-2.4.6-android-sdk/apk/OpenCV_2.4.6_Manager_2.9_<platform>.apk
Use the table below to determine proper OpenCV Manager package for your device:
+------------------------------+--------------+---------------------------------------------------+
| Hardware Platform | Android ver. | Package name |
+==============================+==============+===================================================+
| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.6_Manager_2.8_armv7a-neon.apk |
| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.6_Manager_2.9_armv7a-neon.apk |
+------------------------------+--------------+---------------------------------------------------+
| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.6_Manager_2.8_armv7a-neon-android8.apk |
| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.6_Manager_2.9_armv7a-neon-android8.apk |
+------------------------------+--------------+---------------------------------------------------+
| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.6_Manager_2.8_armeabi.apk |
| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.6_Manager_2.9_armeabi.apk |
+------------------------------+--------------+---------------------------------------------------+
| Intel x86 | >= 2.3 | OpenCV_2.4.6_Manager_2.8_x86.apk |
| Intel x86 | >= 2.3 | OpenCV_2.4.6_Manager_2.9_x86.apk |
+------------------------------+--------------+---------------------------------------------------+
| MIPS | >= 2.3 | OpenCV_2.4.6_Manager_2.8_mips.apk |
| MIPS | >= 2.3 | OpenCV_2.4.6_Manager_2.9_mips.apk |
+------------------------------+--------------+---------------------------------------------------+

@ -20,7 +20,7 @@
<folderInfo id="0.882924228." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1667980868" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1667980868.2108168132" name=""/>
<builder autoBuildTarget="" command="&quot;${NDKROOT}/ndk-build.cmd&quot;" enableAutoBuild="true" enableCleanBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.328915772" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<builder autoBuildTarget="" command="${NDKROOT}/ndk-build.cmd" enableAutoBuild="true" enableCleanBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.328915772" 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.630148311" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.525090327" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1491216279" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>

@ -10,6 +10,7 @@
<activity android:name="CvNativeActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -17,7 +18,9 @@
</intent-filter>
</activity>
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation">
<meta-data android:name="android.app.lib_name"
android:value="native_activity" />
</activity>

@ -7,7 +7,7 @@ include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE := native_activity
LOCAL_SRC_FILES := native.cpp
LOCAL_LDLIBS += -lm -llog -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue
LOCAL_STATIC_LIBRARIES += android_native_app_glue
include $(BUILD_SHARED_LIBRARY)

@ -78,18 +78,29 @@ static void engine_draw_frame(Engine* engine, const cv::Mat& frame)
return;
}
void* pixels = buffer.bits;
int32_t* pixels = (int32_t*)buffer.bits;
int left_indent = (buffer.width-frame.cols)/2;
int top_indent = (buffer.height-frame.rows)/2;
for (int yy = top_indent; yy < std::min(frame.rows+top_indent, buffer.height); yy++)
if (top_indent > 0)
{
unsigned char* line = (unsigned char*)pixels + left_indent*4*sizeof(unsigned char);
size_t line_size = std::min(frame.cols, buffer.width)*4*sizeof(unsigned char);
memset(pixels, 0, top_indent*buffer.stride*sizeof(int32_t));
pixels += top_indent*buffer.stride;
}
for (int yy = 0; yy < frame.rows; yy++)
{
if (left_indent > 0)
{
memset(pixels, 0, left_indent*sizeof(int32_t));
memset(pixels+left_indent+frame.cols, 0, (buffer.stride-frame.cols-left_indent)*sizeof(int32_t));
}
int32_t* line = pixels + left_indent;
size_t line_size = frame.cols*4*sizeof(unsigned char);
memcpy(line, frame.ptr<unsigned char>(yy), line_size);
// go to next line
pixels = (int32_t*)pixels + buffer.stride;
pixels += buffer.stride;
}
ANativeWindow_unlockAndPost(engine->app->window);
}

Loading…
Cancel
Save