Merge branch '2.4'
This commit is contained in:
commit
57d3152cd0
@ -22,7 +22,7 @@ endif()
|
||||
|
||||
if(NOT HAVE_TBB)
|
||||
set(TBB_DEFAULT_INCLUDE_DIRS
|
||||
"/opt/intel/tbb" "/usr/local/include" "/usr/include"
|
||||
"/opt/intel/tbb/include" "/usr/local/include" "/usr/include"
|
||||
"C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
|
||||
"C:/Program Files (x86)/tbb/include"
|
||||
"C:/Program Files (x86)/tbb/include"
|
||||
|
@ -100,7 +100,7 @@ namespace cv { namespace gpu
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef signed char schar;
|
||||
#ifdef WIN32
|
||||
#if defined (_WIN32) || defined (__APPLE__)
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#if !defined CUDA_DISABLER
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>//std::swap
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
#include "opencv2/gpu/device/emulation.hpp"
|
||||
#include "opencv2/gpu/device/transform.hpp"
|
||||
|
@ -1203,7 +1203,7 @@ bool videoInput::setupDevice(int deviceNumber, int w, int h){
|
||||
bool videoInput::setupDeviceFourcc(int deviceNumber, int w, int h,int fourcc){
|
||||
if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false;
|
||||
|
||||
if ( fourcc > 0 ) {
|
||||
if ( fourcc != -1 ) {
|
||||
GUID *mediaType = getMediaSubtypeFromFourcc(fourcc);
|
||||
if ( mediaType ) {
|
||||
setAttemptCaptureSize(deviceNumber,w,h,*mediaType);
|
||||
@ -2193,7 +2193,7 @@ int videoInput::getFourccFromMediaSubtype(GUID type) {
|
||||
GUID *videoInput::getMediaSubtypeFromFourcc(int fourcc){
|
||||
|
||||
for (int i=0;i<VI_NUM_TYPES;i++) {
|
||||
if ( (unsigned long)fourcc == mediaSubtypes[i].Data1 ) {
|
||||
if ( (unsigned long)(unsigned)fourcc == mediaSubtypes[i].Data1 ) {
|
||||
return &mediaSubtypes[i];
|
||||
}
|
||||
}
|
||||
@ -3268,8 +3268,8 @@ bool CvCaptureCAM_DShow::setProperty( int property_id, double value )
|
||||
break;
|
||||
|
||||
case CV_CAP_PROP_FOURCC:
|
||||
fourcc = cvRound(value);
|
||||
if ( fourcc < 0 ) {
|
||||
fourcc = (int)(unsigned long)(value);
|
||||
if ( fourcc == -1 ) {
|
||||
// following cvCreateVideo usage will pop up caprturepindialog here if fourcc=-1
|
||||
// TODO - how to create a capture pin dialog
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ make & enjoy!
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifdef HAVE_CAMVAL
|
||||
#ifdef HAVE_CAMV4L
|
||||
#include <linux/videodev.h>
|
||||
#endif
|
||||
|
||||
|
@ -499,7 +499,7 @@ CV_IMPL void cvDestroyWindow(const char* name)
|
||||
CV_IMPL void cvDestroyAllWindows()
|
||||
{
|
||||
if (!guiMainThread)
|
||||
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
|
||||
return;
|
||||
|
||||
QMetaObject::invokeMethod(guiMainThread,
|
||||
"destroyAllWindow",
|
||||
|
115
modules/highgui/test/test_fourcc.cpp
Normal file
115
modules/highgui/test/test_fourcc.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
#undef DEFINE_GUID
|
||||
#define DEFINE_GUID(n, fourcc, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) fourcc,
|
||||
|
||||
unsigned long allfourcc[] = {
|
||||
|
||||
DEFINE_GUID(MEDIASUBTYPE_GREY, 0x59455247, 0x0000, 0x0010, 0x80, 0x00,
|
||||
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_Y8, 0x20203859, 0x0000, 0x0010, 0x80, 0x00,
|
||||
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_Y800, 0x30303859, 0x0000, 0x0010, 0x80, 0x00,
|
||||
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
|
||||
|
||||
DEFINE_GUID(CLSID_CaptureGraphBuilder2,0xbf87b6e1,0x8c27,0x11d0,0xb3,0xf0,0x00,0xaa,0x00,0x37,0x61,0xc5)
|
||||
DEFINE_GUID(CLSID_FilterGraph,0xe436ebb3,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(CLSID_NullRenderer,0xc1f400a4,0x3f08,0x11d3,0x9f,0x0b,0x00,0x60,0x08,0x03,0x9e,0x37)
|
||||
DEFINE_GUID(CLSID_SampleGrabber,0xc1f400a0,0x3f08,0x11d3,0x9f,0x0b,0x00,0x60,0x08,0x03,0x9e,0x37)
|
||||
DEFINE_GUID(CLSID_SystemDeviceEnum,0x62be5d10,0x60eb,0x11d0,0xbd,0x3b,0x00,0xa0,0xc9,0x11,0xce,0x86)
|
||||
DEFINE_GUID(CLSID_VideoInputDeviceCategory,0x860bb310,0x5d01,0x11d0,0xbd,0x3b,0x00,0xa0,0xc9,0x11,0xce,0x86)
|
||||
DEFINE_GUID(FORMAT_VideoInfo,0x05589f80,0xc356,0x11ce,0xbf,0x01,0x00,0xaa,0x00,0x55,0x59,0x5a)
|
||||
DEFINE_GUID(IID_IAMAnalogVideoDecoder,0xc6e13350,0x30ac,0x11d0,0xa1,0x8c,0x00,0xa0,0xc9,0x11,0x89,0x56)
|
||||
DEFINE_GUID(IID_IAMCameraControl,0xc6e13370,0x30ac,0x11d0,0xa1,0x8c,0x00,0xa0,0xc9,0x11,0x89,0x56)
|
||||
DEFINE_GUID(IID_IAMCrossbar,0xc6e13380,0x30ac,0x11d0,0xa1,0x8c,0x00,0xa0,0xc9,0x11,0x89,0x56)
|
||||
DEFINE_GUID(IID_IAMStreamConfig,0xc6e13340,0x30ac,0x11d0,0xa1,0x8c,0x00,0xa0,0xc9,0x11,0x89,0x56)
|
||||
DEFINE_GUID(IID_IAMVideoProcAmp,0xc6e13360,0x30ac,0x11d0,0xa1,0x8c,0x00,0xa0,0xc9,0x11,0x89,0x56)
|
||||
DEFINE_GUID(IID_IBaseFilter,0x56a86895,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(IID_ICaptureGraphBuilder2,0x93e5a4e0,0x2d50,0x11d2,0xab,0xfa,0x00,0xa0,0xc9,0xc6,0xe3,0x8d)
|
||||
DEFINE_GUID(IID_ICreateDevEnum,0x29840822,0x5b84,0x11d0,0xbd,0x3b,0x00,0xa0,0xc9,0x11,0xce,0x86)
|
||||
DEFINE_GUID(IID_IGraphBuilder,0x56a868a9,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(IID_IMPEG2PIDMap,0xafb6c2a1,0x2c41,0x11d3,0x8a,0x60,0x00,0x00,0xf8,0x1e,0x0e,0x4a)
|
||||
DEFINE_GUID(IID_IMediaControl,0x56a868b1,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(IID_IMediaFilter,0x56a86899,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(IID_ISampleGrabber,0x6b652fff,0x11fe,0x4fce,0x92,0xad,0x02,0x66,0xb5,0xd7,0xc7,0x8f)
|
||||
DEFINE_GUID(LOOK_UPSTREAM_ONLY,0xac798be0,0x98e3,0x11d1,0xb3,0xf1,0x00,0xaa,0x00,0x37,0x61,0xc5)
|
||||
DEFINE_GUID(MEDIASUBTYPE_AYUV,0x56555941,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_IYUV,0x56555949,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_RGB24,0xe436eb7d,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(MEDIASUBTYPE_RGB32,0xe436eb7e,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(MEDIASUBTYPE_RGB555,0xe436eb7c,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(MEDIASUBTYPE_RGB565,0xe436eb7b,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70)
|
||||
DEFINE_GUID(MEDIASUBTYPE_I420,0x49343230,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_UYVY,0x59565955,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_Y211,0x31313259,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_Y411,0x31313459,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_Y41P,0x50313459,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_YUY2,0x32595559,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_YUYV,0x56595559,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_YV12,0x32315659,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_YVU9,0x39555659,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_YVYU,0x55595659,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIASUBTYPE_MJPG,0x47504A4D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71) // MGB
|
||||
DEFINE_GUID(MEDIATYPE_Interleaved,0x73766169,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(MEDIATYPE_Video,0x73646976,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71)
|
||||
DEFINE_GUID(PIN_CATEGORY_CAPTURE,0xfb6c4281,0x0353,0x11d1,0x90,0x5f,0x00,0x00,0xc0,0xcc,0x16,0xba)
|
||||
DEFINE_GUID(PIN_CATEGORY_PREVIEW,0xfb6c4282,0x0353,0x11d1,0x90,0x5f,0x00,0x00,0xc0,0xcc,0x16,0xba)
|
||||
|
||||
0};
|
||||
|
||||
|
||||
TEST(Highgui_dshow, fourcc_conversion)
|
||||
{
|
||||
for(int i = 0; allfourcc[i]; ++i)
|
||||
{
|
||||
unsigned long fourcc = allfourcc[i];
|
||||
|
||||
double paramValue = fourcc;
|
||||
int fourccFromParam = (int)(unsigned long)(paramValue);
|
||||
|
||||
EXPECT_EQ(fourcc, (unsigned long)(unsigned)fourccFromParam);
|
||||
}
|
||||
}
|
@ -294,7 +294,12 @@ TEST(Highgui_Jpeg, encode_empty)
|
||||
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
// these defines are used to resolve conflict between tiff.h and opencv2/core/types_c.h
|
||||
#define uint64 uint64_hack_
|
||||
#define int64 int64_hack_
|
||||
#include "tiff.h"
|
||||
|
||||
TEST(Highgui_Tiff, decode_tile16384x16384)
|
||||
{
|
||||
// see issue #2161
|
||||
|
@ -58,6 +58,9 @@ void Foo(int /*k*/, void* /*z*/) {}
|
||||
|
||||
void CV_HighGuiOnlyGuiTest::run( int /*start_from */)
|
||||
{
|
||||
ts->printf(ts->LOG, "GUI 0\n");
|
||||
cvDestroyAllWindows();
|
||||
|
||||
ts->printf(ts->LOG, "GUI 1\n");
|
||||
namedWindow("Win");
|
||||
|
||||
|
148
modules/imgproc/test/test_houghLines.cpp
Normal file
148
modules/imgproc/test/test_houghLines.cpp
Normal file
@ -0,0 +1,148 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
class CV_HoughLinesTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
enum {STANDART = 0, PROBABILISTIC};
|
||||
CV_HoughLinesTest() {}
|
||||
~CV_HoughLinesTest() {}
|
||||
protected:
|
||||
void run_test(int type);
|
||||
};
|
||||
|
||||
class CV_StandartHoughLinesTest : public CV_HoughLinesTest
|
||||
{
|
||||
public:
|
||||
CV_StandartHoughLinesTest() {}
|
||||
~CV_StandartHoughLinesTest() {}
|
||||
virtual void run(int);
|
||||
};
|
||||
|
||||
class CV_ProbabilisticHoughLinesTest : public CV_HoughLinesTest
|
||||
{
|
||||
public:
|
||||
CV_ProbabilisticHoughLinesTest() {}
|
||||
~CV_ProbabilisticHoughLinesTest() {}
|
||||
virtual void run(int);
|
||||
};
|
||||
|
||||
void CV_StandartHoughLinesTest::run(int)
|
||||
{
|
||||
run_test(STANDART);
|
||||
}
|
||||
|
||||
void CV_ProbabilisticHoughLinesTest::run(int)
|
||||
{
|
||||
run_test(PROBABILISTIC);
|
||||
}
|
||||
|
||||
void CV_HoughLinesTest::run_test(int type)
|
||||
{
|
||||
Mat src = imread(string(ts->get_data_path()) + "shared/pic1.png");
|
||||
if (src.empty())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
string xml;
|
||||
if (type == STANDART)
|
||||
xml = string(ts->get_data_path()) + "imgproc/HoughLines.xml";
|
||||
else if (type == PROBABILISTIC)
|
||||
xml = string(ts->get_data_path()) + "imgproc/HoughLinesP.xml";
|
||||
else
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Error: unknown HoughLines algorithm type.\n");
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat dst;
|
||||
Canny(src, dst, 50, 200, 3);
|
||||
|
||||
Mat lines;
|
||||
if (type == STANDART)
|
||||
HoughLines(dst, lines, 1, CV_PI/180, 100, 0, 0);
|
||||
else if (type == PROBABILISTIC)
|
||||
HoughLinesP(dst, lines, 1, CV_PI/180, 100, 0, 0);
|
||||
|
||||
FileStorage fs(xml, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
fs.open(xml, FileStorage::WRITE);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
fs << "exp_lines" << lines;
|
||||
fs.release();
|
||||
fs.open(xml, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Mat exp_lines;
|
||||
read( fs["exp_lines"], exp_lines, Mat() );
|
||||
fs.release();
|
||||
|
||||
if ( exp_lines.size != lines.size || norm(exp_lines, lines, NORM_INF) > 1e-4 )
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
|
||||
return;
|
||||
}
|
||||
|
||||
ts->set_failed_test_info(cvtest::TS::OK);
|
||||
}
|
||||
|
||||
TEST(Imgproc_HoughLines, regression) { CV_StandartHoughLinesTest test; test.safe_run(); }
|
||||
|
||||
TEST(Imgproc_HoughLinesP, regression) { CV_ProbabilisticHoughLinesTest test; test.safe_run(); }
|
@ -2,11 +2,9 @@ package org.opencv.test;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
@ -62,7 +62,7 @@ public class MatTest extends OpenCVTestCase {
|
||||
assertEquals(2, new Mat(2, 10, CvType.CV_8U).checkVector(10));
|
||||
assertEquals(2, new Mat(1, 2, CvType.CV_8UC(10)).checkVector(10));
|
||||
assertEquals(2, new Mat(2, 1, CvType.CV_8UC(10)).checkVector(10));
|
||||
assertEquals(2, new Mat(1, 10, CvType.CV_8UC2).checkVector(10));
|
||||
assertEquals(10, new Mat(1, 10, CvType.CV_8UC2).checkVector(2));
|
||||
|
||||
assertTrue(0 > new Mat().checkVector(0));
|
||||
assertTrue(0 > new Mat(10, 1, CvType.CV_8U).checkVector(10));
|
||||
@ -73,7 +73,7 @@ public class MatTest extends OpenCVTestCase {
|
||||
assertEquals(2, new Mat(2, 10, CvType.CV_8U).checkVector(10, CvType.CV_8U));
|
||||
assertEquals(2, new Mat(1, 2, CvType.CV_8UC(10)).checkVector(10, CvType.CV_8U));
|
||||
assertEquals(2, new Mat(2, 1, CvType.CV_8UC(10)).checkVector(10, CvType.CV_8U));
|
||||
assertEquals(2, new Mat(1, 10, CvType.CV_8UC2).checkVector(10, CvType.CV_8U));
|
||||
assertEquals(10, new Mat(1, 10, CvType.CV_8UC2).checkVector(2, CvType.CV_8U));
|
||||
|
||||
assertTrue(0 > new Mat(2, 10, CvType.CV_8U).checkVector(10, CvType.CV_8S));
|
||||
assertTrue(0 > new Mat(1, 2, CvType.CV_8UC(10)).checkVector(10, CvType.CV_8S));
|
||||
|
@ -698,11 +698,12 @@ struct SURFInvoker
|
||||
cvGetQuadrangleSubPix( img, &win, &W );
|
||||
*/
|
||||
|
||||
// Nearest neighbour version (faster)
|
||||
float win_offset = -(float)(win_size-1)/2;
|
||||
float start_x = center.x + win_offset*cos_dir + win_offset*sin_dir;
|
||||
float start_y = center.y - win_offset*sin_dir + win_offset*cos_dir;
|
||||
uchar* WIN = win.data;
|
||||
#if 0
|
||||
// Nearest neighbour version (faster)
|
||||
for( i = 0; i < win_size; i++, start_x += sin_dir, start_y += cos_dir )
|
||||
{
|
||||
float pixel_x = start_x;
|
||||
@ -714,6 +715,36 @@ struct SURFInvoker
|
||||
WIN[i*win_size + j] = img->at<uchar>(y, x);
|
||||
}
|
||||
}
|
||||
#else
|
||||
int ncols1 = img->cols-1, nrows1 = img->rows-1;
|
||||
size_t imgstep = img->step;
|
||||
for( i = 0; i < win_size; i++, start_x += sin_dir, start_y += cos_dir )
|
||||
{
|
||||
double pixel_x = start_x;
|
||||
double pixel_y = start_y;
|
||||
for( j = 0; j < win_size; j++, pixel_x += cos_dir, pixel_y -= sin_dir )
|
||||
{
|
||||
int ix = cvFloor(pixel_x), iy = cvFloor(pixel_y);
|
||||
if( (unsigned)ix < (unsigned)ncols1 &&
|
||||
(unsigned)iy < (unsigned)nrows1 )
|
||||
{
|
||||
float a = (float)(pixel_x - ix), b = (float)(pixel_y - iy);
|
||||
const uchar* imgptr = &img->at<uchar>(iy, ix);
|
||||
WIN[i*win_size + j] = (uchar)
|
||||
cvRound(imgptr[0]*(1.f - a)*(1.f - b) +
|
||||
imgptr[1]*a*(1.f - b) +
|
||||
imgptr[imgstep]*(1.f - a)*b +
|
||||
imgptr[imgstep+1]*a*b);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = std::min(std::max(cvRound(pixel_x), 0), ncols1);
|
||||
int y = std::min(std::max(cvRound(pixel_y), 0), nrows1);
|
||||
WIN[i*win_size + j] = img->at<uchar>(y, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -844,10 +875,10 @@ struct SURFInvoker
|
||||
SURF::SURF()
|
||||
{
|
||||
hessianThreshold = 100;
|
||||
extended = true;
|
||||
extended = false;
|
||||
upright = false;
|
||||
nOctaves = 4;
|
||||
nOctaveLayers = 2;
|
||||
nOctaveLayers = 3;
|
||||
}
|
||||
|
||||
SURF::SURF(double _threshold, int _nOctaves, int _nOctaveLayers, bool _extended, bool _upright)
|
||||
|
@ -1114,6 +1114,10 @@ protected:
|
||||
Mat d1, d2;
|
||||
f->operator()(img1, Mat(), kpt1, d1);
|
||||
f->operator()(img1, Mat(), kpt2, d2);
|
||||
for( size_t i = 0; i < kpt1.size(); i++ )
|
||||
CV_Assert(kpt1[i].response > 0 );
|
||||
for( size_t i = 0; i < kpt2.size(); i++ )
|
||||
CV_Assert(kpt2[i].response > 0 );
|
||||
|
||||
vector<DMatch> matches;
|
||||
BFMatcher(NORM_L2, true).match(d1, d2, matches);
|
||||
@ -1140,4 +1144,4 @@ protected:
|
||||
};
|
||||
|
||||
TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80); test.safe_run(); }
|
||||
//TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80); test.safe_run(); }
|
||||
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80); test.safe_run(); }
|
||||
|
@ -616,7 +616,7 @@ protected:
|
||||
TEST(Features2d_RotationInvariance_Detector_SURF, regression)
|
||||
{
|
||||
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
||||
0.45f,
|
||||
0.44f,
|
||||
0.76f);
|
||||
test.safe_run();
|
||||
}
|
||||
|
@ -21,15 +21,15 @@ The word "cascade" in the classifier name means that the resultant classifier co
|
||||
The feature used in a particular classifier is specified by its shape (1a, 2b etc.), position within the region of interest and the scale (this scale is not the same as the scale used at the detection stage, though these two scales are multiplied). For example, in the case of the third line feature (2c) the response is calculated as the difference between the sum of image pixels under the rectangle covering the whole feature (including the two white stripes and the black stripe in the middle) and the sum of the image pixels under the black stripe multiplied by 3 in order to compensate for the differences in the size of areas. The sums of pixel values over a rectangular regions are calculated rapidly using integral images (see below and the :ocv:func:`integral` description).
|
||||
|
||||
To see the object detector at work, have a look at the facedetect demo:
|
||||
http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/facedetect.cpp
|
||||
http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/dbt_face_detection.cpp
|
||||
|
||||
The following reference is for the detection part only. There is a separate application called ``opencv_traincascade`` that can train a cascade of boosted classifiers from a set of samples.
|
||||
|
||||
.. note:: In the new C++ interface it is also possible to use LBP (local binary pattern) features in addition to Haar-like features.
|
||||
|
||||
.. [Viola01] Paul Viola and Michael J. Jones. Rapid Object Detection using a Boosted Cascade of Simple Features. IEEE CVPR, 2001. The paper is available online at http://www.ai.mit.edu/people/viola/
|
||||
.. [Viola01] Paul Viola and Michael J. Jones. Rapid Object Detection using a Boosted Cascade of Simple Features. IEEE CVPR, 2001. The paper is available online at http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_CVPR2001.pdf
|
||||
|
||||
.. [Lienhart02] Rainer Lienhart and Jochen Maydt. An Extended Set of Haar-like Features for Rapid Object Detection. IEEE ICIP 2002, Vol. 1, pp. 900-903, Sep. 2002. This paper, as well as the extended technical report, can be retrieved at http://www.lienhart.de/Publications/publications.html
|
||||
.. [Lienhart02] Rainer Lienhart and Jochen Maydt. An Extended Set of Haar-like Features for Rapid Object Detection. IEEE ICIP 2002, Vol. 1, pp. 900-903, Sep. 2002. This paper, as well as the extended technical report, can be retrieved at http://www.multimedia-computing.de/mediawiki//images/5/52/MRL-TR-May02-revised-Dec02.pdf
|
||||
|
||||
|
||||
FeatureEvaluator
|
||||
|
@ -138,7 +138,7 @@ void HOGDescriptor::write(FileStorage& fs, const String& objName) const
|
||||
<< "gammaCorrection" << gammaCorrection
|
||||
<< "nlevels" << nlevels;
|
||||
if( !svmDetector.empty() )
|
||||
fs << "SVMDetector" << "[:" << svmDetector << "]";
|
||||
fs << "SVMDetector" << svmDetector;
|
||||
fs << "}";
|
||||
}
|
||||
|
||||
|
@ -461,5 +461,30 @@ int CV_HOGDetectorTest::detectMultiScale( int di, const Mat& img,
|
||||
return cvtest::TS::OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------- HOGDetectorReadWriteTest -----------------------------------
|
||||
TEST(Objdetect_HOGDetectorReadWrite, regression)
|
||||
{
|
||||
// Inspired by bug #2607
|
||||
Mat img;
|
||||
img = imread(cvtest::TS::ptr()->get_data_path() + "/cascadeandhog/images/karen-and-rob.png");
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
HOGDescriptor hog;
|
||||
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
|
||||
|
||||
string tempfilename = cv::tempfile(".xml");
|
||||
FileStorage fs(tempfilename, FileStorage::WRITE);
|
||||
hog.write(fs, "myHOG");
|
||||
|
||||
fs.open(tempfilename, FileStorage::READ);
|
||||
remove(tempfilename.c_str());
|
||||
|
||||
FileNode n = fs["opencv_storage"]["myHOG"];
|
||||
|
||||
ASSERT_NO_THROW(hog.read(n));
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(Objdetect_CascadeDetector, regression) { CV_CascadeDetectorTest test; test.safe_run(); }
|
||||
TEST(Objdetect_HOGDetector, regression) { CV_HOGDetectorTest test; test.safe_run(); }
|
||||
|
@ -141,7 +141,7 @@ namespace cv
|
||||
}
|
||||
|
||||
|
||||
inline oclMat::oclMat(const oclMat &m, const Range &rowRange, const Range &colRange)
|
||||
inline oclMat::oclMat(const oclMat &m, const Range &rRange, const Range &cRange)
|
||||
{
|
||||
flags = m.flags;
|
||||
step = m.step;
|
||||
@ -152,22 +152,22 @@ namespace cv
|
||||
wholerows = m.wholerows;
|
||||
wholecols = m.wholecols;
|
||||
offset = m.offset;
|
||||
if( rowRange == Range::all() )
|
||||
if( rRange == Range::all() )
|
||||
rows = m.rows;
|
||||
else
|
||||
{
|
||||
CV_Assert( 0 <= rowRange.start && rowRange.start <= rowRange.end && rowRange.end <= m.rows );
|
||||
rows = rowRange.size();
|
||||
offset += step * rowRange.start;
|
||||
CV_Assert( 0 <= rRange.start && rRange.start <= rRange.end && rRange.end <= m.rows );
|
||||
rows = rRange.size();
|
||||
offset += step * rRange.start;
|
||||
}
|
||||
|
||||
if( colRange == Range::all() )
|
||||
if( cRange == Range::all() )
|
||||
cols = m.cols;
|
||||
else
|
||||
{
|
||||
CV_Assert( 0 <= colRange.start && colRange.start <= colRange.end && colRange.end <= m.cols );
|
||||
cols = colRange.size();
|
||||
offset += colRange.start * elemSize();
|
||||
CV_Assert( 0 <= cRange.start && cRange.start <= cRange.end && cRange.end <= m.cols );
|
||||
cols = cRange.size();
|
||||
offset += cRange.start * elemSize();
|
||||
flags &= cols < m.cols ? ~Mat::CONTINUOUS_FLAG : -1;
|
||||
}
|
||||
|
||||
@ -296,12 +296,12 @@ namespace cv
|
||||
//CPP void oclMat::copyTo( oclMat& m, const oclMat& mask ) const;
|
||||
//CPP void oclMat::convertTo( oclMat& m, int rtype, double alpha=1, double beta=0 ) const;
|
||||
|
||||
inline void oclMat::assignTo( oclMat &m, int type ) const
|
||||
inline void oclMat::assignTo( oclMat &m, int mtype ) const
|
||||
{
|
||||
if( type < 0 )
|
||||
if( mtype < 0 )
|
||||
m = *this;
|
||||
else
|
||||
convertTo(m, type);
|
||||
convertTo(m, mtype);
|
||||
}
|
||||
|
||||
//CPP oclMat& oclMat::operator = (const Scalar& s);
|
||||
@ -370,9 +370,9 @@ namespace cv
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline oclMat oclMat::operator()( Range rowRange, Range colRange ) const
|
||||
inline oclMat oclMat::operator()( Range rRange, Range cRange ) const
|
||||
{
|
||||
return oclMat(*this, rowRange, colRange);
|
||||
return oclMat(*this, rRange, cRange);
|
||||
}
|
||||
inline oclMat oclMat::operator()( const Rect &roi ) const
|
||||
{
|
||||
|
@ -213,8 +213,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
int iw11 = (1 << W_BITS) - iw00 - iw01 - iw10;
|
||||
|
||||
int dstep = (int)(derivI.step/derivI.elemSize1());
|
||||
int step = (int)(I.step/I.elemSize1());
|
||||
CV_Assert( step == (int)(J.step/J.elemSize1()) );
|
||||
int stepI = (int)(I.step/I.elemSize1());
|
||||
int stepJ = (int)(J.step/J.elemSize1());
|
||||
float A11 = 0, A12 = 0, A22 = 0;
|
||||
|
||||
#if CV_SSE2
|
||||
@ -230,7 +230,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
int x, y;
|
||||
for( y = 0; y < winSize.height; y++ )
|
||||
{
|
||||
const uchar* src = (const uchar*)I.data + (y + iprevPt.y)*step + iprevPt.x*cn;
|
||||
const uchar* src = (const uchar*)I.data + (y + iprevPt.y)*stepI + iprevPt.x*cn;
|
||||
const deriv_type* dsrc = (const deriv_type*)derivI.data + (y + iprevPt.y)*dstep + iprevPt.x*cn2;
|
||||
|
||||
deriv_type* Iptr = (deriv_type*)(IWinBuf.data + y*IWinBuf.step);
|
||||
@ -245,8 +245,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
|
||||
v00 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x)), z);
|
||||
v01 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x + cn)), z);
|
||||
v10 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x + step)), z);
|
||||
v11 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x + step + cn)), z);
|
||||
v10 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x + stepI)), z);
|
||||
v11 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*(const int*)(src + x + stepI + cn)), z);
|
||||
|
||||
t0 = _mm_add_epi32(_mm_madd_epi16(_mm_unpacklo_epi16(v00, v01), qw0),
|
||||
_mm_madd_epi16(_mm_unpacklo_epi16(v10, v11), qw1));
|
||||
@ -282,7 +282,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
for( ; x < winSize.width*cn; x++, dsrc += 2, dIptr += 2 )
|
||||
{
|
||||
int ival = CV_DESCALE(src[x]*iw00 + src[x+cn]*iw01 +
|
||||
src[x+step]*iw10 + src[x+step+cn]*iw11, W_BITS1-5);
|
||||
src[x+stepI]*iw10 + src[x+stepI+cn]*iw11, W_BITS1-5);
|
||||
int ixval = CV_DESCALE(dsrc[0]*iw00 + dsrc[cn2]*iw01 +
|
||||
dsrc[dstep]*iw10 + dsrc[dstep+cn2]*iw11, W_BITS1);
|
||||
int iyval = CV_DESCALE(dsrc[1]*iw00 + dsrc[cn2+1]*iw01 + dsrc[dstep+1]*iw10 +
|
||||
@ -359,7 +359,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
|
||||
for( y = 0; y < winSize.height; y++ )
|
||||
{
|
||||
const uchar* Jptr = (const uchar*)J.data + (y + inextPt.y)*step + inextPt.x*cn;
|
||||
const uchar* Jptr = (const uchar*)J.data + (y + inextPt.y)*stepJ + inextPt.x*cn;
|
||||
const deriv_type* Iptr = (const deriv_type*)(IWinBuf.data + y*IWinBuf.step);
|
||||
const deriv_type* dIptr = (const deriv_type*)(derivIWinBuf.data + y*derivIWinBuf.step);
|
||||
|
||||
@ -371,8 +371,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
__m128i diff0 = _mm_loadu_si128((const __m128i*)(Iptr + x)), diff1;
|
||||
__m128i v00 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x)), z);
|
||||
__m128i v01 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x + cn)), z);
|
||||
__m128i v10 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x + step)), z);
|
||||
__m128i v11 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x + step + cn)), z);
|
||||
__m128i v10 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x + stepJ)), z);
|
||||
__m128i v11 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(Jptr + x + stepJ + cn)), z);
|
||||
|
||||
__m128i t0 = _mm_add_epi32(_mm_madd_epi16(_mm_unpacklo_epi16(v00, v01), qw0),
|
||||
_mm_madd_epi16(_mm_unpacklo_epi16(v10, v11), qw1));
|
||||
@ -403,7 +403,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
for( ; x < winSize.width*cn; x++, dIptr += 2 )
|
||||
{
|
||||
int diff = CV_DESCALE(Jptr[x]*iw00 + Jptr[x+cn]*iw01 +
|
||||
Jptr[x+step]*iw10 + Jptr[x+step+cn]*iw11,
|
||||
Jptr[x+stepJ]*iw10 + Jptr[x+stepJ+cn]*iw11,
|
||||
W_BITS1-5) - Iptr[x];
|
||||
b1 += (float)(diff*dIptr[0]);
|
||||
b2 += (float)(diff*dIptr[1]);
|
||||
@ -465,13 +465,13 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
|
||||
|
||||
for( y = 0; y < winSize.height; y++ )
|
||||
{
|
||||
const uchar* Jptr = (const uchar*)J.data + (y + inextPoint.y)*step + inextPoint.x*cn;
|
||||
const uchar* Jptr = (const uchar*)J.data + (y + inextPoint.y)*stepJ + inextPoint.x*cn;
|
||||
const deriv_type* Iptr = (const deriv_type*)(IWinBuf.data + y*IWinBuf.step);
|
||||
|
||||
for( x = 0; x < winSize.width*cn; x++ )
|
||||
{
|
||||
int diff = CV_DESCALE(Jptr[x]*iw00 + Jptr[x+cn]*iw01 +
|
||||
Jptr[x+step]*iw10 + Jptr[x+step+cn]*iw11,
|
||||
Jptr[x+stepJ]*iw10 + Jptr[x+stepJ+cn]*iw11,
|
||||
W_BITS1-5) - Iptr[x];
|
||||
errval += std::abs((float)diff);
|
||||
}
|
||||
@ -1911,8 +1911,11 @@ cv::Mat cv::estimateRigidTransform( InputArray src1,
|
||||
{
|
||||
Mat M(2, 3, CV_64F), A = src1.getMat(), B = src2.getMat();
|
||||
CvMat matA = A, matB = B, matM = M;
|
||||
cvEstimateRigidTransform(&matA, &matB, &matM, fullAffine);
|
||||
return M;
|
||||
int err = cvEstimateRigidTransform(&matA, &matB, &matM, fullAffine);
|
||||
if (err == 1)
|
||||
return M;
|
||||
else
|
||||
return Mat();
|
||||
}
|
||||
|
||||
/* End of file. */
|
||||
|
@ -211,4 +211,34 @@ _exit_:
|
||||
|
||||
TEST(Video_OpticalFlowPyrLK, accuracy) { CV_OptFlowPyrLKTest test; test.safe_run(); }
|
||||
|
||||
/* End of file. */
|
||||
TEST(Video_OpticalFlowPyrLK, submat)
|
||||
{
|
||||
// see bug #2075
|
||||
std::string path = cvtest::TS::ptr()->get_data_path() + "../cv/shared/lena.png";
|
||||
|
||||
cv::Mat lenaImg = cv::imread(path);
|
||||
ASSERT_FALSE(lenaImg.empty());
|
||||
|
||||
cv::Mat wholeImage;
|
||||
cv::resize(lenaImg, wholeImage, cv::Size(1024, 1024));
|
||||
|
||||
cv::Mat img1 = wholeImage(cv::Rect(0, 0, 640, 360)).clone();
|
||||
cv::Mat img2 = wholeImage(cv::Rect(40, 60, 640, 360));
|
||||
|
||||
std::vector<uchar> status;
|
||||
std::vector<float> error;
|
||||
std::vector<cv::Point2f> prev;
|
||||
std::vector<cv::Point2f> next;
|
||||
|
||||
cv::RNG rng(123123);
|
||||
|
||||
for(int i = 0; i < 50; ++i)
|
||||
{
|
||||
int x = rng.uniform(0, 640);
|
||||
int y = rng.uniform(0, 360);
|
||||
|
||||
prev.push_back(cv::Point2f((float)x, (float)y));
|
||||
}
|
||||
|
||||
ASSERT_NO_THROW(cv::calcOpticalFlowPyrLK(img1, img2, prev, next, status, error));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
void help()
|
||||
static void help()
|
||||
{
|
||||
cout << "\nThis program demonstrates the cascade recognizer.\n"
|
||||
"This classifier can recognize many ~rigid objects, it's most known use is for faces.\n"
|
||||
|
@ -14,7 +14,7 @@
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
void help()
|
||||
static void help()
|
||||
{
|
||||
cout <<
|
||||
"\nA program using OCL module pyramid scaling, Canny, dilate functions, threshold, split; cpu contours, contour simpification and\n"
|
||||
@ -34,7 +34,7 @@ const char* wndname = "OpenCL Square Detection Demo";
|
||||
// helper function:
|
||||
// finds a cosine of angle between vectors
|
||||
// from pt0->pt1 and from pt0->pt2
|
||||
double angle( Point pt1, Point pt2, Point pt0 )
|
||||
static double angle( Point pt1, Point pt2, Point pt0 )
|
||||
{
|
||||
double dx1 = pt1.x - pt0.x;
|
||||
double dy1 = pt1.y - pt0.y;
|
||||
@ -45,7 +45,7 @@ double angle( Point pt1, Point pt2, Point pt0 )
|
||||
|
||||
// returns sequence of squares detected on the image.
|
||||
// the sequence is stored in the specified memory storage
|
||||
void findSquares( const Mat& image, vector<vector<Point> >& squares )
|
||||
static void findSquares( const Mat& image, vector<vector<Point> >& squares )
|
||||
{
|
||||
squares.clear();
|
||||
|
||||
@ -131,7 +131,7 @@ void findSquares( const Mat& image, vector<vector<Point> >& squares )
|
||||
|
||||
|
||||
// the function draws all the squares in the image
|
||||
void drawSquares( Mat& image, const vector<vector<Point> >& squares )
|
||||
static void drawSquares( Mat& image, const vector<vector<Point> >& squares )
|
||||
{
|
||||
for( size_t i = 0; i < squares.size(); i++ )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user