Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4' into merge-2.4
Browse files Browse the repository at this point in the history
Conflicts:
	modules/core/src/gl_core_3_1.cpp
	modules/core/src/opencl/convert.cl
	modules/cudaimgproc/src/cuda/canny.cu
	modules/cudastereo/perf/perf_stereo.cpp
	modules/gpu/perf/perf_imgproc.cpp
	modules/gpu/test/test_denoising.cpp
	modules/ocl/src/opencl/imgproc_resize.cl
	samples/cpp/Qt_sample/main.cpp
  • Loading branch information
Roman Donchenko committed Feb 17, 2014
2 parents a0bb74a + b6dafed commit 029ffb7
Show file tree
Hide file tree
Showing 22 changed files with 476 additions and 332 deletions.
12 changes: 2 additions & 10 deletions 3rdparty/libtiff/tif_config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */
#define HOST_BIGENDIAN 0
#define HOST_BIGENDIAN @WORDS_BIGENDIAN@

/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB
Expand Down Expand Up @@ -156,15 +156,7 @@

/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
#cmakedefine WORDS_BIGENDIAN 1

/* Support Deflate compression */
#define ZIP_SUPPORT 1
58 changes: 47 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_PNG "Include PNG support" ON)
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
Expand Down Expand Up @@ -415,6 +415,12 @@ endif()
include(cmake/OpenCVPCHSupport.cmake)
include(cmake/OpenCVModule.cmake)

# ----------------------------------------------------------------------------
# Detect endianness of build platform
# ----------------------------------------------------------------------------
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)

# ----------------------------------------------------------------------------
# Detect 3rd-party libraries
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -553,16 +559,46 @@ include(cmake/OpenCVGenConfig.cmake)
include(cmake/OpenCVGenInfoPlist.cmake)

# Generate environment setup file
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX AND NOT ANDROID)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
DESTINATION /etc/profile.d/ COMPONENT tests)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX)
if(ANDROID)
get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests)
else()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
DESTINATION /etc/profile.d/ COMPONENT tests)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)

endif()
endif()

if(NOT OPENCV_README_FILE)
if(ANDROID)
set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
endif()
endif()

if(NOT OPENCV_LICENSE_FILE)
set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
endif()

# for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
if(ANDROID OR NOT UNIX)
install(FILES ${OPENCV_LICENSE_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs)
if(OPENCV_README_FILE)
install(FILES ${OPENCV_README_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs)
endif()
endif()

# ----------------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### OpenCV: Open Source Computer Vision Library

[![Gittip](http://img.shields.io/gittip/OpenCV.png)](https://www.gittip.com/OpenCV/)

#### Resources

* Homepage: <http://opencv.org>
Expand All @@ -18,6 +20,3 @@ Summary of guidelines:
* Include tests and documentation;
* Clean up "oops" commits before submitting;
* Follow the coding style guide.

[![Donate OpenCV project](http://opencv.org/wp-content/uploads/2013/07/gittip1.png)](https://www.gittip.com/OpenCV/)
[![Donate OpenCV project](http://opencv.org/wp-content/uploads/2013/07/paypal-donate-button.png)](https://www.paypal.com/cgi-bin/webscr?item_name=Donation+to+OpenCV&cmd=_donations&business=accountant%40opencv.org)
4 changes: 2 additions & 2 deletions cmake/OpenCVModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ macro(ocv_add_module _name)

# parse list of dependencies
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module")
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The category of the module")
set(__ocv_argn__ ${ARGN})
list(REMOVE_AT __ocv_argn__ 0)
ocv_add_dependencies(${the_module} ${__ocv_argn__})
unset(__ocv_argn__)
else()
set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The cathegory of the module")
set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The category of the module")
ocv_add_dependencies(${the_module} ${ARGN})
if(BUILD_${the_module})
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export")
Expand Down
2 changes: 1 addition & 1 deletion cmake/templates/cvconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@
/* Xine video library */
#cmakedefine HAVE_XINE

/* Define to 1 if your processor stores words with the most significant byte
/* Define if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN
51 changes: 51 additions & 0 deletions cmake/templates/opencv_run_all_tests_android.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh

BASE_DIR=`dirname $0`
OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/

if [ $# -ne 1 ]; then
echo "Device architecture is not preset in command line"
echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
echo "Usage: $0 <target_device_arch>"
return 1
else
TARGET_ARCH=$1
fi

if [ -z `which adb` ]; then
echo "adb command was not found in PATH"
return 1
fi

adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata

adb shell "mkdir -p /data/local/tmp/opencv_test"
SUMMARY_STATUS=0
for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*;
do
test_name=`basename "$t"`
report="$test_name-`date --rfc-3339=date`.xml"
adb push $t /data/local/tmp/opencv_test/
adb shell "export OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata && /data/local/tmp/opencv_test/$test_name --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:/data/local/tmp/opencv_test/$report"
adb pull "/data/local/tmp/opencv_test/$report" $report
TEST_STATUS=0
if [ -e $report ]; then
if [ `grep -c "<fail" $report` -ne 0 ]; then
TEST_STATUS=2
fi
else
TEST_STATUS=3
fi
if [ $TEST_STATUS -ne 0 ]; then
SUMMARY_STATUS=$TEST_STATUS
fi
done

if [ $SUMMARY_STATUS -eq 0 ]; then
echo "All OpenCV tests finished successfully"
else
echo "OpenCV tests finished with status $SUMMARY_STATUS"
fi

return $SUMMARY_STATUS
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ result.
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);
}
#. Defines that your activity implements ``CvViewFrameListener2`` interface and fix activity related
#. Defines that your activity implements ``CvCameraViewListener2`` interface and fix activity related
errors by defining missed methods. For this activity define ``onCreate``, ``onDestroy`` and
``onPause`` and implement them according code snippet bellow. Fix errors by adding requited
imports.
Expand Down Expand Up @@ -432,7 +432,7 @@ result.
Lets discuss some most important steps. Every Android application with UI must implement Activity
and View. By the first steps we create blank activity and default view layout. The simplest
OpenCV-centric application must implement OpenCV initialization, create its own view to show
preview from camera and implements ``CvViewFrameListener2`` interface to get frames from camera and
preview from camera and implements ``CvCameraViewListener2`` interface to get frames from camera and
process it.

First of all we create our application view using xml layout. Our layout consists of the only
Expand Down
2 changes: 1 addition & 1 deletion modules/contrib/src/rgbdodometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void computeProjectiveMatrix( const Mat& ksi, Mat& Rt )
{
CV_Assert( ksi.size() == Size(1,6) && ksi.type() == CV_64FC1 );

#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3 && (!defined _MSC_VER || !defined _M_X64 || _MSC_VER > 1500)
const double* ksi_ptr = reinterpret_cast<const double*>(ksi.ptr(0));
Eigen::Matrix<double,4,4> twist, g;
twist << 0., -ksi_ptr[2], ksi_ptr[1], ksi_ptr[3],
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/types_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ enum {
CV_StsVecLengthErr= -28, /* incorrect vector length */
CV_StsFilterStructContentErr= -29, /* incorr. filter structure content */
CV_StsKernelStructContentErr= -30, /* incorr. transform kernel content */
CV_StsFilterOffsetErr= -31, /* incorrect filter ofset value */
CV_StsFilterOffsetErr= -31, /* incorrect filter offset value */
CV_StsBadSize= -201, /* the input/output structure size is incorrect */
CV_StsDivByZero= -202, /* division by zero */
CV_StsInplaceNotSupported= -203, /* in-place operation is not supported */
Expand Down
31 changes: 18 additions & 13 deletions modules/core/src/gl_core_3_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,27 @@
#include "gl_core_3_1.hpp"

#ifdef HAVE_OPENGL
#if defined(__APPLE__)
#include <mach-o/dyld.h>

#ifdef __APPLE__
#include <dlfcn.h>

static void* AppleGLGetProcAddress (const char* name)
{
static const struct mach_header* image = 0;
if (!image)
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);

// prepend a '_' for the Unix C symbol mangling convention
String symbolName = "_";
symbolName += String(name);

NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0;

return symbol ? NSAddressOfSymbol(symbol) : 0;
static bool initialized = false;
static void * handle = NULL;
if (!handle)
{
if (!initialized)
{
initialized = true;
const char * const path = "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL";

handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
}
if (!handle)
return NULL;
}
return dlsym(handle, name);
}
#endif // __APPLE__

Expand Down
9 changes: 8 additions & 1 deletion modules/cudaimgproc/perf/perf_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,14 @@ PERF_TEST_P(Sz_Type_Op, AlphaComp,

TEST_CYCLE() cv::cuda::alphaComp(d_img1, d_img2, dst, alpha_op);

CUDA_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE);
if (CV_MAT_DEPTH(type) < CV_32F)
{
CUDA_SANITY_CHECK(dst, 1);
}
else
{
CUDA_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE);
}
}
else
{
Expand Down
7 changes: 4 additions & 3 deletions modules/cudaimgproc/src/cuda/canny.cu
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

#if !defined CUDA_DISABLER

#include <utility>
#include <algorithm>
#include "opencv2/core/cuda/common.hpp"
#include "opencv2/core/cuda/emulation.hpp"
#include "opencv2/core/cuda/transform.hpp"
Expand Down Expand Up @@ -463,7 +461,10 @@ namespace canny

count = min(count, map.cols * map.rows);

std::swap(st1, st2);
//std::swap(st1, st2);
short2* tmp = st1;
st1 = st2;
st2 = tmp;
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions modules/cudaoptflow/test/test_optflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,15 @@ CUDA_TEST_P(OpticalFlowBM, Accuracy)

cv::Mat frame0 = readImage("opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0.empty());
cv::resize(frame0, frame0, cv::Size(), 0.5, 0.5);

cv::Mat frame1 = readImage("opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame1.empty());
cv::resize(frame1, frame1, cv::Size(), 0.5, 0.5);

cv::Size block_size(16, 16);
cv::Size block_size(8, 8);
cv::Size shift_size(1, 1);
cv::Size max_range(16, 16);
cv::Size max_range(8, 8);

cv::cuda::GpuMat d_velx, d_vely, buf;
cv::cuda::calcOpticalFlowBM(loadMat(frame0), loadMat(frame1),
Expand Down
15 changes: 9 additions & 6 deletions modules/highgui/src/grfmt_tiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,21 @@ bool TiffDecoder::readHeader()
bool result = false;

close();
TIFF* tif = TIFFOpen( m_filename.c_str(), "rb" );
// TIFFOpen() mode flags are different to fopen(). A 'b' in mode "rb" has no effect when reading.
// http://www.remotesensing.org/libtiff/man/TIFFOpen.3tiff.html
TIFF* tif = TIFFOpen( m_filename.c_str(), "r" );

if( tif )
{
int wdth = 0, hght = 0, photometric = 0;
uint32 wdth = 0, hght = 0;
uint16 photometric = 0;
m_tif = tif;

if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &wdth ) &&
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &hght ) &&
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric ))
{
int bpp=8, ncn = photometric > 1 ? 3 : 1;
uint16 bpp=8, ncn = photometric > 1 ? 3 : 1;
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );

Expand Down Expand Up @@ -195,12 +198,12 @@ bool TiffDecoder::readData( Mat& img )
if( m_tif && m_width && m_height )
{
TIFF* tif = (TIFF*)m_tif;
int tile_width0 = m_width, tile_height0 = 0;
uint32 tile_width0 = m_width, tile_height0 = 0;
int x, y, i;
int is_tiled = TIFFIsTiled(tif);
int photometric;
uint16 photometric;
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric );
int bpp = 8, ncn = photometric > 1 ? 3 : 1;
uint16 bpp = 8, ncn = photometric > 1 ? 3 : 1;
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );
const int bitsPerByte = 8;
Expand Down
Loading

0 comments on commit 029ffb7

Please sign in to comment.