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
bcd0aefb
Commit
bcd0aefb
authored
Sep 05, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gcc build errors and warnings
parent
5eac0419
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
138 deletions
+147
-138
jpc_qmfb.c
3rdparty/libjasper/jpc_qmfb.c
+14
-14
internal.hpp
modules/core/include/opencv2/core/internal.hpp
+5
-0
cap_gstreamer.cpp
modules/highgui/src/cap_gstreamer.cpp
+4
-4
surf.cpp
modules/nonfree/src/surf.cpp
+84
-81
haar.cpp
modules/objdetect/src/haar.cpp
+8
-7
cv2.cv.hpp
modules/python/src2/cv2.cv.hpp
+32
-32
No files found.
3rdparty/libjasper/jpc_qmfb.c
View file @
bcd0aefb
...
...
@@ -94,14 +94,14 @@
#define QMFB_SPLITBUFSIZE 4096
#define QMFB_JOINBUFSIZE 4096
int
jpc_ft_analyze
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
jpc_ft_analyze
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
);
int
jpc_ft_synthesize
(
int
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
);
int
jpc_ns_analyze
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
jpc_ns_analyze
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
);
int
jpc_ns_synthesize
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
jpc_ns_synthesize
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
);
void
jpc_ft_fwdlift_row
(
jpc_fix_t
*
a
,
int
numcols
,
int
parity
);
...
...
@@ -1556,7 +1556,7 @@ void jpc_ft_invlift_colres(jpc_fix_t *a, int numrows, int numcols, int stride,
}
int
jpc_ft_analyze
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
jpc_ft_analyze
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
)
{
int
numrows
=
height
;
...
...
@@ -1568,7 +1568,7 @@ int jpc_ft_analyze(jpc_fix_t *a, int xstart, int ystart, int width, int height,
int
maxcols
;
maxcols
=
(
numcols
/
JPC_QMFB_COLGRPSIZE
)
*
JPC_QMFB_COLGRPSIZE
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
maxcols
;
i
+=
JPC_QMFB_COLGRPSIZE
)
{
jpc_qmfb_split_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
jpc_ft_fwdlift_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
...
...
@@ -1581,7 +1581,7 @@ int jpc_ft_analyze(jpc_fix_t *a, int xstart, int ystart, int width, int height,
rowparity
);
}
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
numrows
;
++
i
)
{
jpc_qmfb_split_row
(
startptr
,
numcols
,
colparity
);
jpc_ft_fwdlift_row
(
startptr
,
numcols
,
colparity
);
...
...
@@ -1604,7 +1604,7 @@ int jpc_ft_synthesize(int *a, int xstart, int ystart, int width, int height,
jpc_fix_t
*
startptr
;
int
i
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
numrows
;
++
i
)
{
jpc_ft_invlift_row
(
startptr
,
numcols
,
colparity
);
jpc_qmfb_join_row
(
startptr
,
numcols
,
colparity
);
...
...
@@ -1612,7 +1612,7 @@ int jpc_ft_synthesize(int *a, int xstart, int ystart, int width, int height,
}
maxcols
=
(
numcols
/
JPC_QMFB_COLGRPSIZE
)
*
JPC_QMFB_COLGRPSIZE
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
maxcols
;
i
+=
JPC_QMFB_COLGRPSIZE
)
{
jpc_ft_invlift_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
jpc_qmfb_join_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
...
...
@@ -3068,7 +3068,7 @@ void jpc_ns_invlift_col(jpc_fix_t *a, int numrows, int stride,
}
int
jpc_ns_analyze
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
jpc_ns_analyze
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
)
{
...
...
@@ -3081,7 +3081,7 @@ int jpc_ns_analyze(jpc_fix_t *a, int xstart, int ystart, int width, int height,
int
maxcols
;
maxcols
=
(
numcols
/
JPC_QMFB_COLGRPSIZE
)
*
JPC_QMFB_COLGRPSIZE
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
maxcols
;
i
+=
JPC_QMFB_COLGRPSIZE
)
{
jpc_qmfb_split_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
jpc_ns_fwdlift_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
...
...
@@ -3094,7 +3094,7 @@ int jpc_ns_analyze(jpc_fix_t *a, int xstart, int ystart, int width, int height,
rowparity
);
}
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
numrows
;
++
i
)
{
jpc_qmfb_split_row
(
startptr
,
numcols
,
colparity
);
jpc_ns_fwdlift_row
(
startptr
,
numcols
,
colparity
);
...
...
@@ -3105,7 +3105,7 @@ int jpc_ns_analyze(jpc_fix_t *a, int xstart, int ystart, int width, int height,
}
int
jpc_ns_synthesize
(
jpc_fix_
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
jpc_ns_synthesize
(
in
t
*
a
,
int
xstart
,
int
ystart
,
int
width
,
int
height
,
int
stride
)
{
...
...
@@ -3117,7 +3117,7 @@ int jpc_ns_synthesize(jpc_fix_t *a, int xstart, int ystart, int width,
jpc_fix_t
*
startptr
;
int
i
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
numrows
;
++
i
)
{
jpc_ns_invlift_row
(
startptr
,
numcols
,
colparity
);
jpc_qmfb_join_row
(
startptr
,
numcols
,
colparity
);
...
...
@@ -3125,7 +3125,7 @@ int jpc_ns_synthesize(jpc_fix_t *a, int xstart, int ystart, int width,
}
maxcols
=
(
numcols
/
JPC_QMFB_COLGRPSIZE
)
*
JPC_QMFB_COLGRPSIZE
;
startptr
=
&
a
[
0
];
startptr
=
(
jpc_fix_t
*
)
&
a
[
0
];
for
(
i
=
0
;
i
<
maxcols
;
i
+=
JPC_QMFB_COLGRPSIZE
)
{
jpc_ns_invlift_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
jpc_qmfb_join_colgrp
(
startptr
,
numrows
,
stride
,
rowparity
);
...
...
modules/core/include/opencv2/core/internal.hpp
View file @
bcd0aefb
...
...
@@ -135,6 +135,11 @@ CV_INLINE IppiSize ippiSize(int width, int height)
# if defined __AVX__ || (defined _MSC_FULL_VER && _MSC_FULL_VER >= 160040219)
# include <immintrin.h>
# define CV_AVX 1
# if defined(_XCR_XFEATURE_ENABLED_MASK)
# define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
# else
# define __xgetbv() 0
# endif
# else
# define CV_AVX 0
# endif
...
...
modules/highgui/src/cap_gstreamer.cpp
View file @
bcd0aefb
...
...
@@ -183,7 +183,7 @@ bool CvCapture_GStreamer::grabFrame()
IplImage
*
CvCapture_GStreamer
::
retrieveFrame
(
int
)
{
if
(
!
buffer
)
return
false
;
return
0
;
if
(
!
frame
)
{
gint
height
,
width
;
...
...
@@ -193,7 +193,7 @@ IplImage * CvCapture_GStreamer::retrieveFrame(int)
if
(
!
gst_structure_get_int
(
structure
,
"width"
,
&
width
)
||
!
gst_structure_get_int
(
structure
,
"height"
,
&
height
))
return
false
;
return
0
;
frame
=
cvCreateImageHeader
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
3
);
gst_caps_unref
(
buff_caps
);
...
...
@@ -572,7 +572,7 @@ CvVideoWriter* cvCreateVideoWriter_GStreamer(const char* filename, int fourcc, d
return
wrt
;
delete
wrt
;
return
false
;
return
0
;
}
void
CvCapture_GStreamer
::
close
()
...
...
@@ -746,5 +746,5 @@ CvCapture* cvCreateCapture_GStreamer(int type, const char* filename )
return
capture
;
delete
capture
;
return
false
;
return
0
;
}
modules/nonfree/src/surf.cpp
View file @
bcd0aefb
...
...
@@ -257,16 +257,97 @@ interpolateKeypoint( float N9[3][9], int dx, int dy, int ds, KeyPoint& kpt )
return
ok
;
}
// Multi-threaded construction of the scale-space pyramid
struct
SURFBuildInvoker
{
SURFBuildInvoker
(
const
Mat
&
_sum
,
const
vector
<
int
>&
_sizes
,
const
vector
<
int
>&
_sampleSteps
,
vector
<
Mat
>&
_dets
,
vector
<
Mat
>&
_traces
)
{
sum
=
&
_sum
;
sizes
=
&
_sizes
;
sampleSteps
=
&
_sampleSteps
;
dets
=
&
_dets
;
traces
=
&
_traces
;
}
void
operator
()(
const
BlockedRange
&
range
)
const
{
for
(
int
i
=
range
.
begin
();
i
<
range
.
end
();
i
++
)
calcLayerDetAndTrace
(
*
sum
,
(
*
sizes
)[
i
],
(
*
sampleSteps
)[
i
],
(
*
dets
)[
i
],
(
*
traces
)[
i
]
);
}
const
Mat
*
sum
;
const
vector
<
int
>
*
sizes
;
const
vector
<
int
>
*
sampleSteps
;
vector
<
Mat
>*
dets
;
vector
<
Mat
>*
traces
;
};
// Multi-threaded search of the scale-space pyramid for keypoints
struct
SURFFindInvoker
{
SURFFindInvoker
(
const
Mat
&
_sum
,
const
Mat
&
_mask_sum
,
const
vector
<
Mat
>&
_dets
,
const
vector
<
Mat
>&
_traces
,
const
vector
<
int
>&
_sizes
,
const
vector
<
int
>&
_sampleSteps
,
const
vector
<
int
>&
_middleIndices
,
vector
<
KeyPoint
>&
_keypoints
,
int
_nOctaveLayers
,
float
_hessianThreshold
)
{
sum
=
&
_sum
;
mask_sum
=
&
_mask_sum
;
dets
=
&
_dets
;
traces
=
&
_traces
;
sizes
=
&
_sizes
;
sampleSteps
=
&
_sampleSteps
;
middleIndices
=
&
_middleIndices
;
keypoints
=
&
_keypoints
;
nOctaveLayers
=
_nOctaveLayers
;
hessianThreshold
=
_hessianThreshold
;
}
static
void
findMaximaInLayer
(
const
Mat
&
sum
,
const
Mat
&
mask_sum
,
const
vector
<
Mat
>&
dets
,
const
vector
<
Mat
>&
traces
,
const
vector
<
int
>&
sizes
,
vector
<
KeyPoint
>&
keypoints
,
int
octave
,
int
layer
,
float
hessianThreshold
,
int
sampleStep
);
void
operator
()(
const
BlockedRange
&
range
)
const
{
for
(
int
i
=
range
.
begin
();
i
<
range
.
end
();
i
++
)
{
int
layer
=
(
*
middleIndices
)[
i
];
int
octave
=
i
/
nOctaveLayers
;
findMaximaInLayer
(
*
sum
,
*
mask_sum
,
*
dets
,
*
traces
,
*
sizes
,
*
keypoints
,
octave
,
layer
,
hessianThreshold
,
(
*
sampleSteps
)[
layer
]
);
}
}
const
Mat
*
sum
;
const
Mat
*
mask_sum
;
const
vector
<
Mat
>*
dets
;
const
vector
<
Mat
>*
traces
;
const
vector
<
int
>*
sizes
;
const
vector
<
int
>*
sampleSteps
;
const
vector
<
int
>*
middleIndices
;
vector
<
KeyPoint
>*
keypoints
;
int
nOctaveLayers
;
float
hessianThreshold
;
#ifdef HAVE_TBB
static
tbb
::
mutex
findMaximaInLayer_m
;
#endif
};
#ifdef HAVE_TBB
static
tbb
::
mutex
findMaximaInLayer_m
;
tbb
::
mutex
SURFFindInvoker
::
findMaximaInLayer_m
;
#endif
/*
* Find the maxima in the determinant of the Hessian in a layer of the
* scale-space pyramid
*/
static
void
findMaximaInLayer
(
const
Mat
&
sum
,
const
Mat
&
mask_sum
,
void
SURFFindInvoker
::
findMaximaInLayer
(
const
Mat
&
sum
,
const
Mat
&
mask_sum
,
const
vector
<
Mat
>&
dets
,
const
vector
<
Mat
>&
traces
,
const
vector
<
int
>&
sizes
,
vector
<
KeyPoint
>&
keypoints
,
int
octave
,
int
layer
,
float
hessianThreshold
,
int
sampleStep
)
...
...
@@ -367,84 +448,6 @@ findMaximaInLayer( const Mat& sum, const Mat& mask_sum,
}
}
// Multi-threaded construction of the scale-space pyramid
struct
SURFBuildInvoker
{
SURFBuildInvoker
(
const
Mat
&
_sum
,
const
vector
<
int
>&
_sizes
,
const
vector
<
int
>&
_sampleSteps
,
vector
<
Mat
>&
_dets
,
vector
<
Mat
>&
_traces
)
{
sum
=
&
_sum
;
sizes
=
&
_sizes
;
sampleSteps
=
&
_sampleSteps
;
dets
=
&
_dets
;
traces
=
&
_traces
;
}
void
operator
()(
const
BlockedRange
&
range
)
const
{
for
(
int
i
=
range
.
begin
();
i
<
range
.
end
();
i
++
)
calcLayerDetAndTrace
(
*
sum
,
(
*
sizes
)[
i
],
(
*
sampleSteps
)[
i
],
(
*
dets
)[
i
],
(
*
traces
)[
i
]
);
}
const
Mat
*
sum
;
const
vector
<
int
>
*
sizes
;
const
vector
<
int
>
*
sampleSteps
;
vector
<
Mat
>*
dets
;
vector
<
Mat
>*
traces
;
};
// Multi-threaded search of the scale-space pyramid for keypoints
struct
SURFFindInvoker
{
SURFFindInvoker
(
const
Mat
&
_sum
,
const
Mat
&
_mask_sum
,
const
vector
<
Mat
>&
_dets
,
const
vector
<
Mat
>&
_traces
,
const
vector
<
int
>&
_sizes
,
const
vector
<
int
>&
_sampleSteps
,
const
vector
<
int
>&
_middleIndices
,
vector
<
KeyPoint
>&
_keypoints
,
int
_nOctaveLayers
,
float
_hessianThreshold
)
{
sum
=
&
_sum
;
mask_sum
=
&
_mask_sum
;
dets
=
&
_dets
;
traces
=
&
_traces
;
sizes
=
&
_sizes
;
sampleSteps
=
&
_sampleSteps
;
middleIndices
=
&
_middleIndices
;
keypoints
=
&
_keypoints
;
nOctaveLayers
=
_nOctaveLayers
;
hessianThreshold
=
_hessianThreshold
;
#ifdef HAVE_TBB
//touch the mutex to ensure that it's initialization is finished
CV_Assert
(
&
findMaximaInLayer_m
>
0
);
#endif
}
void
operator
()(
const
BlockedRange
&
range
)
const
{
for
(
int
i
=
range
.
begin
();
i
<
range
.
end
();
i
++
)
{
int
layer
=
(
*
middleIndices
)[
i
];
int
octave
=
i
/
nOctaveLayers
;
findMaximaInLayer
(
*
sum
,
*
mask_sum
,
*
dets
,
*
traces
,
*
sizes
,
*
keypoints
,
octave
,
layer
,
hessianThreshold
,
(
*
sampleSteps
)[
layer
]
);
}
}
const
Mat
*
sum
;
const
Mat
*
mask_sum
;
const
vector
<
Mat
>*
dets
;
const
vector
<
Mat
>*
traces
;
const
vector
<
int
>*
sizes
;
const
vector
<
int
>*
sampleSteps
;
const
vector
<
int
>*
middleIndices
;
vector
<
KeyPoint
>*
keypoints
;
int
nOctaveLayers
;
float
hessianThreshold
;
};
struct
KeypointGreater
{
inline
bool
operator
()(
const
KeyPoint
&
kp1
,
const
KeyPoint
&
kp2
)
const
...
...
modules/objdetect/src/haar.cpp
View file @
bcd0aefb
...
...
@@ -43,6 +43,7 @@
#include "precomp.hpp"
#include <stdio.h>
#include "opencv2/core/internal.hpp"
#if CV_SSE2 || CV_SSE3
...
...
@@ -780,7 +781,7 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
#ifdef CV_HAAR_USE_AVX
bool
haveAVX
=
false
;
if
(
cv
::
checkHardwareSupport
(
CV_CPU_AVX
))
if
(
_
xgetbv
(
_XCR_XFEATURE_ENABLED_MASK
)
&
0x6
)
// Check if the OS will save the YMM registers
if
(
_
_xgetbv
(
)
&
0x6
)
// Check if the OS will save the YMM registers
{
haveAVX
=
true
;
}
...
...
@@ -867,7 +868,7 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
for
(
i
=
start_stage
;
i
<
cascade
->
count
;
i
++
)
{
stage_sum
=
0.0
;
int
j
=
0
;
j
=
0
;
float
CV_DECL_ALIGNED
(
32
)
buf
[
8
];
if
(
cascade
->
stage_classifier
[
i
].
two_rects
)
{
...
...
@@ -1020,12 +1021,12 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
}
else
#endif
#if defined CV_HAAR_USE_SSE && CV_HAAR_USE_SSE &&
!CV_HAAR_USE_AVX
//old SSE optimization
#if defined CV_HAAR_USE_SSE && CV_HAAR_USE_SSE &&
(!defined CV_HAAR_USE_AVX || !CV_HAAR_USE_AVX)
//old SSE optimization
if
(
haveSSE2
)
{
for
(
i
=
start_stage
;
i
<
cascade
->
count
;
i
++
)
{
__m128d
stage_sum
=
_mm_setzero_pd
();
__m128d
v
stage_sum
=
_mm_setzero_pd
();
if
(
cascade
->
stage_classifier
[
i
].
two_rects
)
{
for
(
j
=
0
;
j
<
cascade
->
stage_classifier
[
i
].
count
;
j
++
)
...
...
@@ -1040,7 +1041,7 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
__m128d
sum
=
_mm_set_sd
(
calc_sum
(
node
->
feature
.
rect
[
0
],
p_offset
)
*
node
->
feature
.
rect
[
0
].
weight
+
calc_sum
(
node
->
feature
.
rect
[
1
],
p_offset
)
*
node
->
feature
.
rect
[
1
].
weight
);
t
=
_mm_cmpgt_sd
(
t
,
sum
);
stage_sum
=
_mm_add_sd
(
stage_sum
,
_mm_blendv_pd
(
b
,
a
,
t
));
vstage_sum
=
_mm_add_sd
(
v
stage_sum
,
_mm_blendv_pd
(
b
,
a
,
t
));
}
}
else
...
...
@@ -1060,11 +1061,11 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
__m128d
sum
=
_mm_set_sd
(
_sum
);
t
=
_mm_cmpgt_sd
(
t
,
sum
);
stage_sum
=
_mm_add_sd
(
stage_sum
,
_mm_blendv_pd
(
b
,
a
,
t
));
vstage_sum
=
_mm_add_sd
(
v
stage_sum
,
_mm_blendv_pd
(
b
,
a
,
t
));
}
}
__m128d
i_threshold
=
_mm_set1_pd
(
cascade
->
stage_classifier
[
i
].
threshold
);
if
(
_mm_comilt_sd
(
stage_sum
,
i_threshold
)
)
if
(
_mm_comilt_sd
(
v
stage_sum
,
i_threshold
)
)
return
-
i
;
}
}
...
...
modules/python/src2/cv2.cv.hpp
View file @
bcd0aefb
...
...
@@ -256,7 +256,7 @@ static PyObject *iplimage_tostring(PyObject *self, PyObject *args)
cv
::
Mat
img
(
i
);
size_t
esz
=
img
.
elemSize
();
int
nrows
=
img
.
rows
,
ncols
=
img
.
cols
;
if
(
!
img
.
isContinuous
()
)
img
=
img
.
clone
();
return
PyString_FromStringAndSize
((
char
*
)
img
.
data
,
(
Py_ssize_t
)(
esz
*
nrows
*
ncols
));
...
...
@@ -338,7 +338,7 @@ static void cvmat_dealloc(PyObject *self)
{
cvmat_t
*
pc
=
(
cvmat_t
*
)
self
;
Py_XDECREF
(
pc
->
data
);
//cvDecRefData(pc->a);
//cvDecRefData(pc->a);
cvFree
(
&
pc
->
a
);
PyObject_Del
(
self
);
}
...
...
@@ -656,7 +656,7 @@ static void cvmatnd_dealloc(PyObject *self)
{
cvmatnd_t
*
pc
=
(
cvmatnd_t
*
)
self
;
Py_XDECREF
(
pc
->
data
);
cvDecRefData
(
pc
->
a
);
cvDecRefData
(
pc
->
a
);
cvFree
(
&
pc
->
a
);
PyObject_Del
(
self
);
}
...
...
@@ -1186,7 +1186,7 @@ static PyObject* cvseq_map_getitem(PyObject *o, PyObject *item)
}
}
static
static
PySequenceMethods
cvseq_sequence
=
{
cvseq_seq_length
,
NULL
,
...
...
@@ -1606,8 +1606,8 @@ static int convert_to_CvMat(PyObject *o, CvMat **dst, const char *name)
*
dst
=
m
->
a
;
return
1
;
}
else
if
(
m
->
data
&&
m
->
a
->
data
.
ptr
){
*
dst
=
m
->
a
;
return
1
;
*
dst
=
m
->
a
;
return
1
;
}
else
{
return
failmsg
(
"CvMat argument '%s' has no data"
,
name
);
...
...
@@ -2174,7 +2174,7 @@ static int convert_to_CvSubdiv2DEdge(PyObject *o, CvSubdiv2DEdge *dst, const cha
static
PyObject
*
pythonize_CvMat
(
cvmat_t
*
m
)
{
// Need to make this CvMat look like any other, with a Python
// Need to make this CvMat look like any other, with a Python
// buffer object as its data.
CvMat
*
mat
=
m
->
a
;
assert
(
mat
->
step
!=
0
);
...
...
@@ -2204,9 +2204,9 @@ static PyObject *pythonize_CvMat(cvmat_t *m)
static
PyObject
*
pythonize_IplImage
(
iplimage_t
*
cva
)
{
// Need to make this iplimage look like any other, with a Python
// Need to make this iplimage look like any other, with a Python
// string as its data.
// So copy the image data into a Python string object, then release
// So copy the image data into a Python string object, then release
// it.
IplImage
*
ipl
=
(
IplImage
*
)(
cva
->
a
);
...
...
@@ -2233,7 +2233,7 @@ static PyObject *pythonize_IplImage(iplimage_t *cva)
static
PyObject
*
pythonize_CvMatND
(
cvmatnd_t
*
m
,
PyObject
*
backing
=
NULL
)
{
//
// Need to make this CvMatND look like any other, with a Python
// Need to make this CvMatND look like any other, with a Python
// buffer object as its data.
//
...
...
@@ -2341,9 +2341,9 @@ static PyObject *FROM_CvSeqOfCvConvexityDefectPTR(CvSeqOfCvConvexityDefect *r)
for
(
int
i
=
0
;
i
<
r
->
total
;
i
++
)
{
CvConvexityDefect
*
pd
=
CV_GET_SEQ_ELEM
(
CvConvexityDefect
,
r
,
i
);
PyList_SetItem
(
pr
,
i
,
Py_BuildValue
(
"(ii)(ii)(ii)f"
,
pd
->
start
->
x
,
pd
->
start
->
y
,
pd
->
end
->
x
,
pd
->
end
->
y
,
pd
->
depth_point
->
x
,
pd
->
depth_point
->
y
,
pd
->
start
->
x
,
pd
->
start
->
y
,
pd
->
end
->
x
,
pd
->
end
->
y
,
pd
->
depth_point
->
x
,
pd
->
depth_point
->
y
,
pd
->
depth
));
}
// This function has copied the CvSeq data into a list. Hence the
...
...
@@ -2360,8 +2360,8 @@ static PyObject *FROM_CvSeqOfCvAvgCompPTR(CvSeqOfCvAvgComp *r)
for
(
int
i
=
0
;
i
<
r
->
total
;
i
++
)
{
CvAvgComp
*
pd
=
CV_GET_SEQ_ELEM
(
CvAvgComp
,
r
,
i
);
PyList_SetItem
(
pr
,
i
,
Py_BuildValue
(
"(iiii)i"
,
pd
->
rect
.
x
,
pd
->
rect
.
y
,
pd
->
rect
.
width
,
pd
->
rect
.
height
,
pd
->
rect
.
x
,
pd
->
rect
.
y
,
pd
->
rect
.
width
,
pd
->
rect
.
height
,
pd
->
neighbors
));
}
// This function has copied the CvSeq data into a list. Hence the
...
...
@@ -2378,7 +2378,7 @@ static PyObject *FROM_CvSeqOfCvStarKeypointPTR(CvSeqOfCvStarKeypoint *r)
for
(
int
i
=
0
;
i
<
r
->
total
;
i
++
)
{
CvStarKeypoint
*
pd
=
CV_GET_SEQ_ELEM
(
CvStarKeypoint
,
r
,
i
);
PyList_SetItem
(
pr
,
i
,
Py_BuildValue
(
"(ii)if"
,
pd
->
pt
.
x
,
pd
->
pt
.
y
,
pd
->
pt
.
x
,
pd
->
pt
.
y
,
pd
->
size
,
pd
->
response
));
}
...
...
@@ -2396,7 +2396,7 @@ static PyObject *FROM_CvSeqOfCvSURFPointPTR(CvSeqOfCvSURFPoint *r)
for
(
int
i
=
0
;
i
<
r
->
total
;
i
++
)
{
CvSURFPoint
*
pd
=
CV_GET_SEQ_ELEM
(
CvSURFPoint
,
r
,
i
);
PyList_SetItem
(
pr
,
i
,
Py_BuildValue
(
"(ff)iiff"
,
pd
->
pt
.
x
,
pd
->
pt
.
y
,
pd
->
pt
.
x
,
pd
->
pt
.
y
,
pd
->
laplacian
,
pd
->
size
,
pd
->
dir
,
...
...
@@ -2587,7 +2587,7 @@ static PyObject *FROM_CvPoints(CvPoints src)
/************************************************************************/
/* A few functions are too odd to be generated,
/* A few functions are too odd to be generated,
* so are handwritten here */
static
PyObject
*
pycvWaitKey
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
...
...
@@ -2808,7 +2808,7 @@ static PyObject *fromarray(PyObject *o, int allowND)
else
if
(
pai
->
itemsize
==
8
)
type
=
CV_64FC1
;
break
;
}
if
(
type
==
-
1
)
{
PyErr_SetString
(
PyExc_TypeError
,
"the array type is not supported by OpenCV"
);
...
...
@@ -2826,20 +2826,20 @@ static PyObject *fromarray(PyObject *o, int allowND)
m
->
a
->
step
=
(
int
)
pai
->
strides
[
0
];
}
else
if
(
pai
->
nd
==
3
)
{
if
(
pai
->
shape
[
2
]
>
CV_CN_MAX
)
{
Py_DECREF
(
ao
);
Py_DECREF
(
ao
);
return
failmsg
(
"cv.fromarray too many channels, see allowND argument"
),
(
PyObject
*
)
0
;
}
ERRWRAP
(
m
->
a
=
cvCreateMatHeader
((
int
)
pai
->
shape
[
0
],
(
int
)
pai
->
shape
[
1
],
type
+
((
int
)(
pai
->
shape
[
2
]
-
1
)
<<
CV_CN_SHIFT
)));
m
->
a
->
step
=
(
int
)
pai
->
strides
[
0
];
}
else
{
Py_DECREF
(
ao
);
Py_DECREF
(
ao
);
return
failmsg
(
"cv.fromarray array can be 2D or 3D only, see allowND argument"
),
(
PyObject
*
)
0
;
}
m
->
a
->
data
.
ptr
=
(
uchar
*
)
pai
->
data
;
//retval = pythonize_foreign_CvMat(m);
m
->
data
=
o
;
m
->
offset
=
0
;
retval
=
(
PyObject
*
)
m
;
m
->
data
=
o
;
m
->
offset
=
0
;
retval
=
(
PyObject
*
)
m
;
}
else
{
int
dims
[
CV_MAX_DIM
];
int
i
;
...
...
@@ -2848,13 +2848,13 @@ static PyObject *fromarray(PyObject *o, int allowND)
cvmatnd_t
*
m
=
PyObject_NEW
(
cvmatnd_t
,
&
cvmatnd_Type
);
ERRWRAP
(
m
->
a
=
cvCreateMatNDHeader
(
pai
->
nd
,
dims
,
type
));
m
->
a
->
data
.
ptr
=
(
uchar
*
)
pai
->
data
;
m
->
data
=
o
;
m
->
offset
=
0
;
retval
=
(
PyObject
*
)
m
;
m
->
data
=
o
;
m
->
offset
=
0
;
retval
=
(
PyObject
*
)
m
;
//retval = pythonize_CvMatND(m, ao);
}
Py_DECREF
(
ao
);
Py_INCREF
(
o
);
Py_INCREF
(
o
);
return
retval
;
}
#endif
...
...
@@ -2875,7 +2875,7 @@ public:
rr
=
new
float
*
[
len
];
for
(
Py_ssize_t
i
=
0
;
i
<
len
;
i
++
)
{
PyObject
*
item
=
PySequence_Fast_GET_ITEM
(
fi
,
i
);
floats
ff
;
floats
ff
;
ff
.
f
=
0
;
if
(
!
convert_to_floats
(
item
,
&
ff
))
return
0
;
rr
[
i
]
=
ff
.
f
;
...
...
@@ -4040,13 +4040,13 @@ static PyObject* init_cv()
PUBLISH
(
GC_INIT_WITH_RECT
);
PUBLISH
(
GC_INIT_WITH_MASK
);
PUBLISH
(
GC_EVAL
);
#include "generated2.i"
#undef PUBLISH
#undef PUBLISHU
#undef PUBLISH2
#undef PUBLISH2
return
m
;
}
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