Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
78a33815
Commit
78a33815
authored
Jan 29, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4'
parents
013e9294
63873a83
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
154 additions
and
26 deletions
+154
-26
calibration.cpp
modules/calib3d/src/calibration.cpp
+1
-1
posit.cpp
modules/calib3d/src/posit.cpp
+6
-6
persistence.cpp
modules/core/src/persistence.cpp
+2
-1
perf_input.cpp
modules/highgui/perf/perf_input.cpp
+4
-3
perf_output.cpp
modules/highgui/perf/perf_output.cpp
+4
-4
perf_precomp.hpp
modules/highgui/perf/perf_precomp.hpp
+25
-0
test_ffmpeg.cpp
modules/highgui/test/test_ffmpeg.cpp
+6
-6
matching.cpp
modules/objdetect/src/matching.cpp
+1
-0
initialization.cpp
modules/ocl/src/initialization.cpp
+1
-1
cv2.cpp
modules/python/src2/cv2.cpp
+50
-4
test2.py
modules/python/test/test2.py
+54
-0
No files found.
modules/calib3d/src/calibration.cpp
View file @
78a33815
...
...
@@ -412,7 +412,7 @@ CV_IMPL void cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1,
cvRodrigues2
(
&
r1
,
&
R1
,
&
dR1dr1
);
cvRodrigues2
(
&
r2
,
&
R2
,
&
dR2dr2
);
if
(
_rvec3
||
dr3dr1
||
dr3dr
1
)
if
(
_rvec3
||
dr3dr1
||
dr3dr
2
)
{
double
_r3
[
3
],
_R3
[
9
],
_dR3dR1
[
9
*
9
],
_dR3dR2
[
9
*
9
],
_dr3dR3
[
9
*
3
];
double
_W1
[
9
*
3
],
_W2
[
3
*
3
];
...
...
modules/calib3d/src/posit.cpp
View file @
78a33815
...
...
@@ -119,12 +119,6 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
float
diff
=
(
float
)
criteria
.
epsilon
;
float
inv_focalLength
=
1
/
focalLength
;
/* init variables */
int
N
=
pObject
->
N
;
float
*
objectVectors
=
pObject
->
obj_vecs
;
float
*
invMatrix
=
pObject
->
inv_matr
;
float
*
imgVectors
=
pObject
->
img_vecs
;
/* Check bad arguments */
if
(
imagePoints
==
NULL
)
return
CV_NULLPTR_ERR
;
...
...
@@ -143,6 +137,12 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
if
(
(
criteria
.
type
&
CV_TERMCRIT_ITER
)
&&
criteria
.
max_iter
<=
0
)
return
CV_BADFACTOR_ERR
;
/* init variables */
int
N
=
pObject
->
N
;
float
*
objectVectors
=
pObject
->
obj_vecs
;
float
*
invMatrix
=
pObject
->
inv_matr
;
float
*
imgVectors
=
pObject
->
img_vecs
;
while
(
!
converged
)
{
if
(
count
==
0
)
...
...
modules/core/src/persistence.cpp
View file @
78a33815
...
...
@@ -584,11 +584,12 @@ cvGetHashedKey( CvFileStorage* fs, const char* str, int len, int create_missing
CvStringHashNode
*
node
=
0
;
unsigned
hashval
=
0
;
int
i
,
tab_size
;
CvStringHash
*
map
=
fs
->
str_hash
;
if
(
!
fs
)
return
0
;
CvStringHash
*
map
=
fs
->
str_hash
;
if
(
len
<
0
)
{
for
(
i
=
0
;
str
[
i
]
!=
'\0'
;
i
++
)
...
...
modules/highgui/perf/perf_input.cpp
View file @
78a33815
#include "perf_precomp.hpp"
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
#ifndef ANDROID
typedef
perf
::
TestBaseWithParam
<
String
>
VideoCapture_Reading
;
...
...
@@ -26,4 +27,4 @@ PERF_TEST_P(VideoCapture_Reading, ReadFile, testing::Values( "highgui/video/big_
SANITY_CHECK
(
dummy
);
}
#endif //ANDROID
\ No newline at end of file
#endif // BUILD_WITH_VIDEO_INPUT_SUPPORT
\ No newline at end of file
modules/highgui/perf/perf_output.cpp
View file @
78a33815
#include "perf_precomp.hpp"
#if BUILD_WITH_VIDEO_OUTPUT_SUPPORT
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
#ifndef ANDROID
typedef
std
::
tr1
::
tuple
<
String
,
bool
>
VideoWriter_Writing_t
;
typedef
perf
::
TestBaseWithParam
<
VideoWriter_Writing_t
>
VideoWriter_Writing
;
...
...
@@ -31,4 +31,4 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
SANITY_CHECK
(
dummy
);
}
#endif //ANDROID
\ No newline at end of file
#endif // BUILD_WITH_VIDEO_OUTPUT_SUPPORT
\ No newline at end of file
modules/highgui/perf/perf_precomp.hpp
View file @
78a33815
...
...
@@ -16,4 +16,29 @@
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
#endif
#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_AVFOUNDATION) || \
/*defined(HAVE_OPENNI) || too specialized */
\
defined(HAVE_FFMPEG) || \
defined(WIN32)
/* assume that we have ffmpeg */
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1
#else
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0
#endif
#if
/*defined(HAVE_XINE) || */
\
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_FFMPEG) || \
defined(WIN32)
/* assume that we have ffmpeg */
# define BUILD_WITH_VIDEO_OUTPUT_SUPPORT 1
#else
# define BUILD_WITH_VIDEO_OUTPUT_SUPPORT 0
#endif
#endif
modules/highgui/test/test_ffmpeg.cpp
View file @
78a33815
...
...
@@ -186,7 +186,7 @@ class CreateVideoWriterInvoker :
public
:
const
static
Size
FrameSize
;
static
std
::
string
TmpDirectory
;
CreateVideoWriterInvoker
(
std
::
vector
<
VideoWriter
*>&
_writers
,
std
::
vector
<
std
::
string
>&
_files
)
:
ParallelLoopBody
(),
writers
(
&
_writers
),
files
(
&
_files
)
{
...
...
@@ -221,7 +221,7 @@ class WriteVideo_Invoker :
{
public
:
enum
{
FrameCount
=
300
};
static
const
Scalar
ObjectColor
;
static
const
Point
Center
;
...
...
@@ -229,11 +229,11 @@ public:
ParallelLoopBody
(),
writers
(
&
_writers
)
{
}
static
void
GenerateFrame
(
Mat
&
frame
,
unsigned
int
i
)
{
frame
=
Scalar
::
all
(
i
%
255
);
std
::
string
text
=
to_string
(
i
);
putText
(
frame
,
text
,
Point
(
50
,
Center
.
y
),
FONT_HERSHEY_SIMPLEX
,
5.0
,
ObjectColor
,
5
,
CV_AA
);
circle
(
frame
,
Center
,
i
+
2
,
ObjectColor
,
2
,
CV_AA
);
...
...
@@ -245,7 +245,7 @@ public:
VideoWriter
*
writer
=
writers
->
operator
[](
range
.
start
);
CV_Assert
(
writer
!=
NULL
);
CV_Assert
(
writer
->
isOpened
());
Mat
frame
(
CreateVideoWriterInvoker
::
FrameSize
,
CV_8UC3
);
for
(
unsigned
int
i
=
0
;
i
<
FrameCount
;
++
i
)
{
...
...
@@ -253,7 +253,7 @@ public:
writer
->
operator
<<
(
frame
);
}
}
protected
:
static
std
::
string
to_string
(
unsigned
int
i
)
{
...
...
modules/objdetect/src/matching.cpp
View file @
78a33815
...
...
@@ -1212,6 +1212,7 @@ int maxFunctionalScore(const CvLSVMFilterObject **all_F, int n,
free
(
tmpPartsDisplacement
[
i
]);
}
free
(
tmpPoints
);
free
(
tmpPartsDisplacement
);
free
(
tmpScore
);
free
(
tmpKPoints
);
...
...
modules/ocl/src/initialization.cpp
View file @
78a33815
...
...
@@ -615,7 +615,7 @@ namespace cv
CL_PROGRAM_BUILD_LOG
,
buildLogSize
,
buildLog
,
NULL
));
cout
<<
"
\n\t\t\t
BUILD LOG
\n
"
;
cout
<<
buildLog
<<
endl
;
delete
buildLog
;
delete
[]
buildLog
;
}
openCLVerifyCall
(
status
);
}
...
...
modules/python/src2/cv2.cpp
View file @
78a33815
...
...
@@ -224,9 +224,42 @@ static int pyopencv_to(const PyObject* o, Mat& m, const ArgInfo info, bool allow
return
true
;
}
if
(
PyInt_Check
(
o
)
)
{
double
v
[]
=
{
PyInt_AsLong
((
PyObject
*
)
o
),
0.
,
0.
,
0.
};
m
=
Mat
(
4
,
1
,
CV_64F
,
v
).
clone
();
return
true
;
}
if
(
PyFloat_Check
(
o
)
)
{
double
v
[]
=
{
PyFloat_AsDouble
((
PyObject
*
)
o
),
0.
,
0.
,
0.
};
m
=
Mat
(
4
,
1
,
CV_64F
,
v
).
clone
();
return
true
;
}
if
(
PyTuple_Check
(
o
)
)
{
int
i
,
sz
=
(
int
)
PyTuple_Size
((
PyObject
*
)
o
);
m
=
Mat
(
sz
,
1
,
CV_64F
);
for
(
i
=
0
;
i
<
sz
;
i
++
)
{
PyObject
*
oi
=
PyTuple_GET_ITEM
(
o
,
i
);
if
(
PyInt_Check
(
oi
)
)
m
.
at
<
double
>
(
i
)
=
(
double
)
PyInt_AsLong
(
oi
);
else
if
(
PyFloat_Check
(
oi
)
)
m
.
at
<
double
>
(
i
)
=
(
double
)
PyFloat_AsDouble
(
oi
);
else
{
failmsg
(
"%s is not a numerical tuple"
,
info
.
name
);
m
.
release
();
return
false
;
}
}
return
true
;
}
if
(
!
PyArray_Check
(
o
)
)
{
failmsg
(
"%s is not a numpy array"
,
info
.
name
);
failmsg
(
"%s is not a numpy array
, neither a scalar
"
,
info
.
name
);
return
false
;
}
...
...
@@ -236,6 +269,7 @@ static int pyopencv_to(const PyObject* o, Mat& m, const ArgInfo info, bool allow
typenum
==
NPY_BYTE
?
CV_8S
:
typenum
==
NPY_USHORT
?
CV_16U
:
typenum
==
NPY_SHORT
?
CV_16S
:
typenum
==
NPY_INT
?
CV_32S
:
typenum
==
NPY_INT32
?
CV_32S
:
typenum
==
NPY_FLOAT
?
CV_32F
:
typenum
==
NPY_DOUBLE
?
CV_64F
:
-
1
;
...
...
@@ -245,7 +279,7 @@ static int pyopencv_to(const PyObject* o, Mat& m, const ArgInfo info, bool allow
if
(
typenum
==
NPY_INT64
||
typenum
==
NPY_UINT64
||
type
==
NPY_LONG
)
{
needcopy
=
needcast
=
true
;
new_typenum
=
NPY_INT
32
;
new_typenum
=
NPY_INT
;
type
=
CV_32S
;
}
else
...
...
@@ -442,7 +476,12 @@ static bool pyopencv_to(PyObject* obj, int& value, const char* name = "<unknown>
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
value
=
(
int
)
PyInt_AsLong
(
obj
);
if
(
PyInt_Check
(
obj
))
value
=
(
int
)
PyInt_AsLong
(
obj
);
else
if
(
PyLong_Check
(
obj
))
value
=
(
int
)
PyLong_AsLong
(
obj
);
else
return
false
;
return
value
!=
-
1
||
!
PyErr_Occurred
();
}
...
...
@@ -714,7 +753,14 @@ template<typename _Tp> struct pyopencvVecConverter
PyObject
*
item_ij
=
items_i
[
j
];
if
(
PyInt_Check
(
item_ij
))
{
int
v
=
PyInt_AsLong
(
item_ij
);
int
v
=
(
int
)
PyInt_AsLong
(
item_ij
);
if
(
v
==
-
1
&&
PyErr_Occurred
()
)
break
;
data
[
j
]
=
saturate_cast
<
_Cp
>
(
v
);
}
else
if
(
PyLong_Check
(
item_ij
))
{
int
v
=
(
int
)
PyLong_AsLong
(
item_ij
);
if
(
v
==
-
1
&&
PyErr_Occurred
()
)
break
;
data
[
j
]
=
saturate_cast
<
_Cp
>
(
v
);
...
...
modules/python/test/test2.py
0 → 100644
View file @
78a33815
#/usr/bin/env python
import
unittest
import
random
import
time
import
math
import
sys
import
array
import
urllib
import
tarfile
import
hashlib
import
os
import
getopt
import
operator
import
functools
import
numpy
as
np
import
cv2
import
cv2.cv
as
cv
class
NewOpenCVTests
(
unittest
.
TestCase
):
def
get_sample
(
self
,
filename
,
iscolor
=
cv
.
CV_LOAD_IMAGE_COLOR
):
if
not
filename
in
self
.
image_cache
:
filedata
=
urllib
.
urlopen
(
"https://raw.github.com/Itseez/opencv/master/"
+
filename
)
.
read
()
self
.
image_cache
[
filename
]
=
cv2
.
imdecode
(
np
.
fromstring
(
filedata
,
dtype
=
np
.
uint8
),
iscolor
)
return
self
.
image_cache
[
filename
]
def
setUp
(
self
):
self
.
image_cache
=
{}
def
hashimg
(
self
,
im
):
""" Compute a hash for an image, useful for image comparisons """
return
hashlib
.
md5
(
im
.
tostring
())
.
digest
()
# Tests to run first; check the handful of basic operations that the later tests rely on
class
Hackathon244Tests
(
NewOpenCVTests
):
def
test_int_array
(
self
):
a
=
np
.
array
([
-
1
,
2
,
-
3
,
4
,
-
5
])
absa0
=
np
.
abs
(
a
)
self
.
assert_
(
cv2
.
norm
(
a
,
cv2
.
NORM_L1
)
==
15
)
absa1
=
cv2
.
absdiff
(
a
,
0
)
self
.
assert_
(
cv2
.
norm
(
absa1
,
absa0
,
cv2
.
NORM_INF
)
==
0
)
def
test_imencode
(
self
):
a
=
np
.
zeros
((
480
,
640
),
dtype
=
np
.
uint8
)
flag
,
ajpg
=
cv2
.
imencode
(
"img_q90.jpg"
,
a
,
[
cv2
.
IMWRITE_JPEG_QUALITY
,
90
])
self
.
assert_
(
flag
==
True
and
ajpg
.
dtype
==
np
.
uint8
and
ajpg
.
shape
[
0
]
>
1
and
ajpg
.
shape
[
1
]
==
1
)
if
__name__
==
'__main__'
:
print
"testing"
,
cv
.
__version__
random
.
seed
(
0
)
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment