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
57aa089a
Commit
57aa089a
authored
Feb 01, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Feb 01, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #392 from vpisarev:python_fixes2
parents
39b4bf18
54e0765d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
14 deletions
+84
-14
calibration.cpp
modules/calib3d/src/calibration.cpp
+5
-2
modelest.cpp
modules/calib3d/src/modelest.cpp
+11
-6
matrix.cpp
modules/core/src/matrix.cpp
+8
-0
defs
modules/python/src2/defs
+21
-0
test.py
modules/python/test/test.py
+2
-4
test2.py
modules/python/test/test2.py
+37
-2
No files found.
modules/calib3d/src/calibration.cpp
View file @
57aa089a
...
...
@@ -3360,7 +3360,11 @@ void cv::projectPoints( InputArray _opoints,
CvMat
c_cameraMatrix
=
cameraMatrix
;
CvMat
c_rvec
=
rvec
,
c_tvec
=
tvec
;
double
dc0buf
[
5
]
=
{
0
};
Mat
dc0
(
5
,
1
,
CV_64F
,
dc0buf
);
Mat
distCoeffs
=
_distCoeffs
.
getMat
();
if
(
distCoeffs
.
empty
()
)
distCoeffs
=
dc0
;
CvMat
c_distCoeffs
=
distCoeffs
;
int
ndistCoeffs
=
distCoeffs
.
rows
+
distCoeffs
.
cols
-
1
;
...
...
@@ -3375,8 +3379,7 @@ void cv::projectPoints( InputArray _opoints,
pdpddist
=
&
(
dpddist
=
jacobian
.
colRange
(
10
,
10
+
ndistCoeffs
));
}
cvProjectPoints2
(
&
c_objectPoints
,
&
c_rvec
,
&
c_tvec
,
&
c_cameraMatrix
,
(
distCoeffs
.
empty
())
?
0
:
&
c_distCoeffs
,
cvProjectPoints2
(
&
c_objectPoints
,
&
c_rvec
,
&
c_tvec
,
&
c_cameraMatrix
,
&
c_distCoeffs
,
&
c_imagePoints
,
pdpdrot
,
pdpdt
,
pdpdf
,
pdpdc
,
pdpddist
,
aspectRatio
);
}
...
...
modules/calib3d/src/modelest.cpp
View file @
57aa089a
...
...
@@ -460,23 +460,24 @@ int cv::estimateAffine3D(InputArray _from, InputArray _to,
double
param1
,
double
param2
)
{
Mat
from
=
_from
.
getMat
(),
to
=
_to
.
getMat
();
int
count
=
from
.
checkVector
(
3
,
CV_32F
);
int
count
=
from
.
checkVector
(
3
);
CV_Assert
(
count
>=
0
&&
to
.
checkVector
(
3
,
CV_32F
)
==
count
);
CV_Assert
(
count
>=
0
&&
to
.
checkVector
(
3
)
==
count
);
_out
.
create
(
3
,
4
,
CV_64F
);
Mat
out
=
_out
.
getMat
();
_inliers
.
create
(
count
,
1
,
CV_8U
,
-
1
,
true
);
Mat
inliers
=
_inliers
.
getMat
();
Mat
inliers
(
1
,
count
,
CV_8U
);
inliers
=
Scalar
::
all
(
1
);
Mat
dFrom
,
dTo
;
from
.
convertTo
(
dFrom
,
CV_64F
);
to
.
convertTo
(
dTo
,
CV_64F
);
dFrom
=
dFrom
.
reshape
(
3
,
1
);
dTo
=
dTo
.
reshape
(
3
,
1
);
CvMat
F3x4
=
out
;
CvMat
mask
=
inliers
;
CvMat
mask
=
inliers
;
CvMat
m1
=
dFrom
;
CvMat
m2
=
dTo
;
...
...
@@ -484,5 +485,9 @@ int cv::estimateAffine3D(InputArray _from, InputArray _to,
param1
=
param1
<=
0
?
3
:
param1
;
param2
=
(
param2
<
epsilon
)
?
0.99
:
(
param2
>
1
-
epsilon
)
?
0.99
:
param2
;
return
Affine3DEstimator
().
runRANSAC
(
&
m1
,
&
m2
,
&
F3x4
,
&
mask
,
param1
,
param2
);
int
ok
=
Affine3DEstimator
().
runRANSAC
(
&
m1
,
&
m2
,
&
F3x4
,
&
mask
,
param1
,
param2
);
if
(
_inliers
.
needed
()
)
transpose
(
inliers
,
_inliers
);
return
ok
;
}
modules/core/src/matrix.cpp
View file @
57aa089a
...
...
@@ -1927,6 +1927,14 @@ void cv::transpose( InputArray _src, OutputArray _dst )
_dst
.
create
(
src
.
cols
,
src
.
rows
,
src
.
type
());
Mat
dst
=
_dst
.
getMat
();
// handle the case of single-column/single-row matrices, stored in STL vectors.
if
(
src
.
rows
!=
dst
.
cols
||
src
.
cols
!=
dst
.
rows
)
{
CV_Assert
(
src
.
size
()
==
dst
.
size
()
&&
(
src
.
cols
==
1
||
src
.
rows
==
1
)
);
src
.
copyTo
(
dst
);
return
;
}
if
(
dst
.
data
==
src
.
data
)
{
TransposeInplaceFunc
func
=
transposeInplaceTab
[
esz
];
...
...
modules/python/src2/defs
View file @
57aa089a
...
...
@@ -323,6 +323,27 @@
#define CV_CAP_PROP_EXPOSURE 15
#define CV_CAP_PROP_CONVERT_RGB 16
#define CV_CAP_PROP_RECTIFICATION 18
#define CV_CAP_OPENNI 900
#define CV_CAP_OPENNI_DEPTH_GENERATOR 2147483648
#define CV_CAP_OPENNI_IMAGE_GENERATOR 1073741824
#define CV_CAP_OPENNI_DEPTH_MAP 0
#define CV_CAP_OPENNI_POINT_CLOUD_MAP 1
#define CV_CAP_OPENNI_DISPARITY_MAP 2
#define CV_CAP_OPENNI_DISPARITY_MAP_32F 3
#define CV_CAP_OPENNI_VALID_DEPTH_MASK 4
#define CV_CAP_OPENNI_BGR_IMAGE 5
#define CV_CAP_OPENNI_GRAY_IMAGE 6
#define CV_CAP_PROP_OPENNI_OUTPUT_MODE 100
#define CV_CAP_OPENNI_VGA_30HZ 0
#define CV_CAP_OPENNI_SXGA_15HZ 1
#define CV_CAP_PROP_OPENNI_REGISTRATION 104
#define CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH 101
#define CV_CAP_PROP_OPENNI_BASELINE 102
#define CV_CAP_PROP_OPENNI_FOCAL_LENGTH 103
#define CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE 1073741924
#define CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE 2147483750
#define CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH 2147483751
#define CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION 2147483752
#define CV_CN_SHIFT 3
#define CV_IMWRITE_JPEG_QUALITY 1
#define CV_IMWRITE_PNG_COMPRESSION 16
...
...
modules/python/test/test.py
View file @
57aa089a
...
...
@@ -16,6 +16,8 @@ import functools
import
cv2.cv
as
cv
from
test2
import
*
class
OpenCVTests
(
unittest
.
TestCase
):
depths
=
[
cv
.
IPL_DEPTH_8U
,
cv
.
IPL_DEPTH_8S
,
cv
.
IPL_DEPTH_16U
,
cv
.
IPL_DEPTH_16S
,
cv
.
IPL_DEPTH_32S
,
cv
.
IPL_DEPTH_32F
,
cv
.
IPL_DEPTH_64F
]
...
...
@@ -2200,10 +2202,6 @@ class DocumentFragmentTests(OpenCVTests):
self
.
assertEqual
(
self
.
hashimg
(
h1
),
self
.
hashimg
(
h3
))
self
.
assertNotEqual
(
self
.
hashimg
(
h1
),
self
.
hashimg
(
h2
))
class
NewTests
(
OpenCVTests
):
pass
if
__name__
==
'__main__'
:
print
"testing"
,
cv
.
__version__
random
.
seed
(
0
)
...
...
modules/python/test/test2.py
View file @
57aa089a
...
...
@@ -41,12 +41,47 @@ class Hackathon244Tests(NewOpenCVTests):
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
)
self
.
assert
Equal
(
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
)
self
.
assertEqual
(
flag
,
True
)
self
.
assertEqual
(
ajpg
.
dtype
,
np
.
uint8
)
self
.
assertGreater
(
ajpg
.
shape
[
0
],
1
)
self
.
assertEqual
(
ajpg
.
shape
[
1
],
1
)
def
test_projectPoints
(
self
):
objpt
=
np
.
float64
([[
1
,
2
,
3
]])
imgpt0
,
jac0
=
cv2
.
projectPoints
(
objpt
,
np
.
zeros
(
3
),
np
.
zeros
(
3
),
np
.
eye
(
3
),
np
.
float64
([]))
imgpt1
,
jac1
=
cv2
.
projectPoints
(
objpt
,
np
.
zeros
(
3
),
np
.
zeros
(
3
),
np
.
eye
(
3
),
None
)
self
.
assertEqual
(
imgpt0
.
shape
,
(
objpt
.
shape
[
0
],
1
,
2
))
self
.
assertEqual
(
imgpt1
.
shape
,
imgpt0
.
shape
)
self
.
assertEqual
(
jac0
.
shape
,
jac1
.
shape
)
self
.
assertEqual
(
jac0
.
shape
[
0
],
2
*
objpt
.
shape
[
0
])
def
test_estimateAffine3D
(
self
):
pattern_size
=
(
11
,
8
)
pattern_points
=
np
.
zeros
((
np
.
prod
(
pattern_size
),
3
),
np
.
float32
)
pattern_points
[:,:
2
]
=
np
.
indices
(
pattern_size
)
.
T
.
reshape
(
-
1
,
2
)
pattern_points
*=
10
(
retval
,
out
,
inliers
)
=
cv2
.
estimateAffine3D
(
pattern_points
,
pattern_points
)
self
.
assertEqual
(
retval
,
1
)
if
cv2
.
norm
(
out
[
2
,:])
<
1e-3
:
out
[
2
,
2
]
=
1
self
.
assertLess
(
cv2
.
norm
(
out
,
np
.
float64
([[
1
,
0
,
0
,
0
],
[
0
,
1
,
0
,
0
],
[
0
,
0
,
1
,
0
]])),
1e-3
)
self
.
assertEqual
(
cv2
.
countNonZero
(
inliers
),
pattern_size
[
0
]
*
pattern_size
[
1
])
def
test_fast
(
self
):
fd
=
cv2
.
FastFeatureDetector
(
30
,
True
)
img
=
self
.
get_sample
(
"samples/cpp/right02.jpg"
,
0
)
img
=
cv2
.
medianBlur
(
img
,
3
)
imgc
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_GRAY2BGR
)
keypoints
=
fd
.
detect
(
img
)
self
.
assert_
(
600
<=
len
(
keypoints
)
<=
700
)
for
kpt
in
keypoints
:
self
.
assertNotEqual
(
kpt
.
response
,
0
)
if
__name__
==
'__main__'
:
print
"testing"
,
cv
.
__version__
...
...
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