Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
794c14b2
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
794c14b2
编写于
1月 11, 2019
作者:
S
Suleyman TURKMEN
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean up
上级
78bd55c8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
33 addition
and
36 deletion
+33
-36
modules/calib3d/src/circlesgrid.cpp
modules/calib3d/src/circlesgrid.cpp
+7
-8
modules/calib3d/src/quadsubpix.cpp
modules/calib3d/src/quadsubpix.cpp
+2
-3
modules/calib3d/test/test_cameracalibration.cpp
modules/calib3d/test/test_cameracalibration.cpp
+3
-3
modules/calib3d/test/test_cameracalibration_artificial.cpp
modules/calib3d/test/test_cameracalibration_artificial.cpp
+1
-1
modules/calib3d/test/test_chessboardgenerator.cpp
modules/calib3d/test/test_chessboardgenerator.cpp
+8
-8
modules/calib3d/test/test_solvepnp_ransac.cpp
modules/calib3d/test/test_solvepnp_ransac.cpp
+3
-3
modules/features2d/src/blobdetector.cpp
modules/features2d/src/blobdetector.cpp
+6
-7
modules/objdetect/src/qrcode.cpp
modules/objdetect/src/qrcode.cpp
+3
-3
未找到文件。
modules/calib3d/src/circlesgrid.cpp
浏览文件 @
794c14b2
...
...
@@ -160,7 +160,7 @@ void CirclesGridClusterFinder::findGrid(const std::vector<cv::Point2f> &points,
#endif
std
::
vector
<
Point2f
>
hull2f
;
convexHull
(
Mat
(
patternPoints
)
,
hull2f
,
false
);
convexHull
(
patternPoints
,
hull2f
,
false
);
const
size_t
cornersCount
=
isAsymmetricGrid
?
6
:
4
;
if
(
hull2f
.
size
()
<
cornersCount
)
return
;
...
...
@@ -411,7 +411,7 @@ void CirclesGridClusterFinder::rectifyPatternPoints(const std::vector<cv::Point2
}
}
Mat
homography
=
findHomography
(
Mat
(
sortedCorners
),
Mat
(
idealPoints
)
,
0
);
Mat
homography
=
findHomography
(
sortedCorners
,
idealPoints
,
0
);
Mat
rectifiedPointsMat
;
transform
(
patternPoints
,
rectifiedPointsMat
,
homography
);
rectifiedPatternPoints
.
clear
();
...
...
@@ -871,8 +871,8 @@ Mat CirclesGridFinder::rectifyGrid(Size detectedGridSize, const std::vector<Poin
}
}
Mat
H
=
findHomography
(
Mat
(
centers
),
Mat
(
dstPoints
)
,
RANSAC
);
//Mat H = findHomography(
Mat( corners ), Mat( dstPoints )
);
Mat
H
=
findHomography
(
centers
,
dstPoints
,
RANSAC
);
//Mat H = findHomography(
corners, dstPoints
);
if
(
H
.
empty
())
{
...
...
@@ -888,7 +888,7 @@ Mat CirclesGridFinder::rectifyGrid(Size detectedGridSize, const std::vector<Poin
}
Mat
dstKeypointsMat
;
transform
(
Mat
(
srcKeypoints
)
,
dstKeypointsMat
,
H
);
transform
(
srcKeypoints
,
dstKeypointsMat
,
H
);
std
::
vector
<
Point2f
>
dstKeypoints
;
convertPointsFromHomogeneous
(
dstKeypointsMat
,
dstKeypoints
);
...
...
@@ -1176,7 +1176,7 @@ void CirclesGridFinder::findBasis(const std::vector<Point2f> &samples, std::vect
}
for
(
size_t
i
=
0
;
i
<
basis
.
size
();
i
++
)
{
convexHull
(
Mat
(
clusters
[
i
])
,
hulls
[
i
]);
convexHull
(
clusters
[
i
]
,
hulls
[
i
]);
}
basisGraphs
.
resize
(
basis
.
size
(),
Graph
(
keypoints
.
size
()));
...
...
@@ -1191,7 +1191,7 @@ void CirclesGridFinder::findBasis(const std::vector<Point2f> &samples, std::vect
for
(
size_t
k
=
0
;
k
<
hulls
.
size
();
k
++
)
{
if
(
pointPolygonTest
(
Mat
(
hulls
[
k
])
,
vec
,
false
)
>=
0
)
if
(
pointPolygonTest
(
hulls
[
k
]
,
vec
,
false
)
>=
0
)
{
basisGraphs
[
k
].
addEdge
(
i
,
j
);
}
...
...
@@ -1422,7 +1422,6 @@ void CirclesGridFinder::drawHoles(const Mat &srcImage, Mat &drawImage) const
if
(
i
!=
holes
.
size
()
-
1
)
line
(
drawImage
,
keypoints
[
holes
[
i
][
j
]],
keypoints
[
holes
[
i
+
1
][
j
]],
Scalar
(
255
,
0
,
0
),
2
);
//circle(drawImage, keypoints[holes[i][j]], holeRadius, holeColor, holeThickness);
circle
(
drawImage
,
keypoints
[
holes
[
i
][
j
]],
holeRadius
,
holeColor
,
holeThickness
);
}
}
...
...
modules/calib3d/src/quadsubpix.cpp
浏览文件 @
794c14b2
...
...
@@ -194,9 +194,8 @@ bool cv::find4QuadCornerSubpix(InputArray _img, InputOutputArray _corners, Size
erode
(
white_comp
,
white_comp
,
Mat
(),
Point
(
-
1
,
-
1
),
erode_count
);
std
::
vector
<
std
::
vector
<
Point
>
>
white_contours
,
black_contours
;
std
::
vector
<
Vec4i
>
white_hierarchy
,
black_hierarchy
;
findContours
(
black_comp
,
black_contours
,
black_hierarchy
,
RETR_LIST
,
CHAIN_APPROX_SIMPLE
);
findContours
(
white_comp
,
white_contours
,
white_hierarchy
,
RETR_LIST
,
CHAIN_APPROX_SIMPLE
);
findContours
(
black_comp
,
black_contours
,
RETR_LIST
,
CHAIN_APPROX_SIMPLE
);
findContours
(
white_comp
,
white_contours
,
RETR_LIST
,
CHAIN_APPROX_SIMPLE
);
if
(
black_contours
.
size
()
<
5
||
white_contours
.
size
()
<
5
)
continue
;
...
...
modules/calib3d/test/test_cameracalibration.cpp
浏览文件 @
794c14b2
...
...
@@ -1514,7 +1514,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
for
(
x
=
0
;
x
<
N
;
x
++
)
pts
.
push_back
(
Point2f
((
float
)
x
*
imgsize
.
width
/
(
N
-
1
),
(
float
)
y
*
imgsize
.
height
/
(
N
-
1
)));
undistortPoints
(
Mat
(
pts
)
,
upts
,
M
,
D
,
R
,
P
);
undistortPoints
(
pts
,
upts
,
M
,
D
,
R
,
P
);
for
(
k
=
0
;
k
<
N
*
N
;
k
++
)
if
(
upts
[
k
].
x
<
-
imgsize
.
width
*
eps
||
upts
[
k
].
x
>
imgsize
.
width
*
(
1
+
eps
)
||
upts
[
k
].
y
<
-
imgsize
.
height
*
eps
||
upts
[
k
].
y
>
imgsize
.
height
*
(
1
+
eps
)
)
...
...
@@ -1823,8 +1823,8 @@ void CV_StereoCalibrationTest::run( int )
for
(
int
i
=
0
,
k
=
0
;
i
<
nframes
;
i
++
)
{
vector
<
Point2f
>
temp
[
2
];
undistortPoints
(
Mat
(
imgpt1
[
i
])
,
temp
[
0
],
M1
,
D1
,
R1
,
P1
);
undistortPoints
(
Mat
(
imgpt2
[
i
])
,
temp
[
1
],
M2
,
D2
,
R2
,
P2
);
undistortPoints
(
imgpt1
[
i
]
,
temp
[
0
],
M1
,
D1
,
R1
,
P1
);
undistortPoints
(
imgpt2
[
i
]
,
temp
[
1
],
M2
,
D2
,
R2
,
P2
);
for
(
int
j
=
0
;
j
<
npoints
;
j
++
,
k
++
)
{
...
...
modules/calib3d/test/test_cameracalibration_artificial.cpp
浏览文件 @
794c14b2
...
...
@@ -353,7 +353,7 @@ protected:
rvecs_spnp
.
resize
(
brdsNum
);
tvecs_spnp
.
resize
(
brdsNum
);
for
(
size_t
i
=
0
;
i
<
brdsNum
;
++
i
)
solvePnP
(
Mat
(
objectPoints
[
i
]),
Mat
(
imagePoints
[
i
])
,
camMat
,
distCoeffs
,
rvecs_spnp
[
i
],
tvecs_spnp
[
i
]);
solvePnP
(
objectPoints
[
i
],
imagePoints
[
i
]
,
camMat
,
distCoeffs
,
rvecs_spnp
[
i
],
tvecs_spnp
[
i
]);
compareShiftVecs
(
tvecs_exp
,
tvecs_spnp
);
compareRotationVecs
(
rvecs_exp
,
rvecs_spnp
);
...
...
modules/calib3d/test/test_chessboardgenerator.cpp
浏览文件 @
794c14b2
...
...
@@ -126,10 +126,10 @@ Mat ChessBoardGenerator::generateChessBoard(const Mat& bg, const Mat& camMat, co
generateEdge
(
p3
,
p4
,
pts_square3d
);
generateEdge
(
p4
,
p1
,
pts_square3d
);
projectPoints
(
Mat
(
pts_square3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts_square2d
);
projectPoints
(
pts_square3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts_square2d
);
squares_black
.
resize
(
squares_black
.
size
()
+
1
);
vector
<
Point2f
>
temp
;
approxPolyDP
(
Mat
(
pts_square2d
)
,
temp
,
1.0
,
true
);
approxPolyDP
(
pts_square2d
,
temp
,
1.0
,
true
);
transform
(
temp
.
begin
(),
temp
.
end
(),
back_inserter
(
squares_black
.
back
()),
Mult
(
rendererResolutionMultiplier
));
}
...
...
@@ -139,7 +139,7 @@ Mat ChessBoardGenerator::generateChessBoard(const Mat& bg, const Mat& camMat, co
for
(
int
i
=
0
;
i
<
patternSize
.
width
-
1
;
++
i
)
corners3d
.
push_back
(
zero
+
(
i
+
1
)
*
sqWidth
*
pb1
+
(
j
+
1
)
*
sqHeight
*
pb2
);
corners
.
clear
();
projectPoints
(
Mat
(
corners3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
corners
);
projectPoints
(
corners3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
corners
);
vector
<
Point3f
>
whole3d
;
vector
<
Point2f
>
whole2d
;
...
...
@@ -147,9 +147,9 @@ Mat ChessBoardGenerator::generateChessBoard(const Mat& bg, const Mat& camMat, co
generateEdge
(
whole
[
1
],
whole
[
2
],
whole3d
);
generateEdge
(
whole
[
2
],
whole
[
3
],
whole3d
);
generateEdge
(
whole
[
3
],
whole
[
0
],
whole3d
);
projectPoints
(
Mat
(
whole3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
whole2d
);
projectPoints
(
whole3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
whole2d
);
vector
<
Point2f
>
temp_whole2d
;
approxPolyDP
(
Mat
(
whole2d
)
,
temp_whole2d
,
1.0
,
true
);
approxPolyDP
(
whole2d
,
temp_whole2d
,
1.0
,
true
);
vector
<
vector
<
Point
>
>
whole_contour
(
1
);
transform
(
temp_whole2d
.
begin
(),
temp_whole2d
.
end
(),
...
...
@@ -213,7 +213,7 @@ Mat ChessBoardGenerator::operator ()(const Mat& bg, const Mat& camMat, const Mat
pts3d
[
3
]
=
p
-
pb1
*
cbHalfWidthEx
+
cbHalfHeightEx
*
pb2
;
/* can remake with better perf */
projectPoints
(
Mat
(
pts3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
projectPoints
(
pts3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
bool
inrect1
=
pts2d
[
0
].
x
<
bg
.
cols
&&
pts2d
[
0
].
y
<
bg
.
rows
&&
pts2d
[
0
].
x
>
0
&&
pts2d
[
0
].
y
>
0
;
bool
inrect2
=
pts2d
[
1
].
x
<
bg
.
cols
&&
pts2d
[
1
].
y
<
bg
.
rows
&&
pts2d
[
1
].
x
>
0
&&
pts2d
[
1
].
y
>
0
;
...
...
@@ -278,7 +278,7 @@ Mat ChessBoardGenerator::operator ()(const Mat& bg, const Mat& camMat, const Mat
pts3d
[
3
]
=
p
-
pb1
*
cbHalfWidthEx
+
cbHalfHeightEx
*
pb2
;
/* can remake with better perf */
projectPoints
(
Mat
(
pts3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
projectPoints
(
pts3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
bool
inrect1
=
pts2d
[
0
].
x
<
bg
.
cols
&&
pts2d
[
0
].
y
<
bg
.
rows
&&
pts2d
[
0
].
x
>
0
&&
pts2d
[
0
].
y
>
0
;
bool
inrect2
=
pts2d
[
1
].
x
<
bg
.
cols
&&
pts2d
[
1
].
y
<
bg
.
rows
&&
pts2d
[
1
].
x
>
0
&&
pts2d
[
1
].
y
>
0
;
...
...
@@ -320,7 +320,7 @@ Mat ChessBoardGenerator::operator ()(const Mat& bg, const Mat& camMat, const Mat
pts3d
[
3
]
=
p
-
pb1
*
cbHalfWidthEx
+
cbHalfHeightEx
*
pb2
;
/* can remake with better perf */
projectPoints
(
Mat
(
pts3d
)
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
projectPoints
(
pts3d
,
rvec
,
tvec
,
camMat
,
distCoeffs
,
pts2d
);
Point3f
zero
=
p
-
pb1
*
cbHalfWidth
-
cbHalfHeight
*
pb2
;
...
...
modules/calib3d/test/test_solvepnp_ransac.cpp
浏览文件 @
794c14b2
...
...
@@ -124,7 +124,7 @@ protected:
vector
<
Point2f
>
projectedPoints
;
projectedPoints
.
resize
(
points
.
size
());
projectPoints
(
Mat
(
points
)
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
projectPoints
(
points
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
for
(
size_t
i
=
0
;
i
<
projectedPoints
.
size
();
i
++
)
{
if
(
i
%
20
==
0
)
...
...
@@ -241,7 +241,7 @@ protected:
vector
<
Point2f
>
projectedPoints
;
projectedPoints
.
resize
(
opoints
.
size
());
projectPoints
(
Mat
(
opoints
)
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
projectPoints
(
opoints
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
bool
isEstimateSuccess
=
solvePnP
(
opoints
,
projectedPoints
,
intrinsics
,
distCoeffs
,
rvec
,
tvec
,
false
,
method
);
if
(
isEstimateSuccess
==
false
)
...
...
@@ -291,7 +291,7 @@ class CV_solveP3P_Test : public CV_solvePnPRansac_Test
vector
<
Point2f
>
projectedPoints
;
projectedPoints
.
resize
(
opoints
.
size
());
projectPoints
(
Mat
(
opoints
)
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
projectPoints
(
opoints
,
trueRvec
,
trueTvec
,
intrinsics
,
distCoeffs
,
projectedPoints
);
int
num_of_solutions
=
solveP3P
(
opoints
,
projectedPoints
,
intrinsics
,
distCoeffs
,
rvecs
,
tvecs
,
method
);
if
(
num_of_solutions
!=
(
int
)
rvecs
.
size
()
||
num_of_solutions
!=
(
int
)
tvecs
.
size
()
||
num_of_solutions
==
0
)
...
...
modules/features2d/src/blobdetector.cpp
浏览文件 @
794c14b2
...
...
@@ -197,8 +197,7 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
centers
.
clear
();
std
::
vector
<
std
::
vector
<
Point
>
>
contours
;
Mat
tmpBinaryImage
=
binaryImage
.
clone
();
findContours
(
tmpBinaryImage
,
contours
,
RETR_LIST
,
CHAIN_APPROX_NONE
);
findContours
(
binaryImage
,
contours
,
RETR_LIST
,
CHAIN_APPROX_NONE
);
#ifdef DEBUG_BLOB_DETECTOR
// Mat keypointsImage;
...
...
@@ -214,7 +213,7 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
{
Center
center
;
center
.
confidence
=
1
;
Moments
moms
=
moments
(
Mat
(
contours
[
contourIdx
])
);
Moments
moms
=
moments
(
contours
[
contourIdx
]
);
if
(
params
.
filterByArea
)
{
double
area
=
moms
.
m00
;
...
...
@@ -225,7 +224,7 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
if
(
params
.
filterByCircularity
)
{
double
area
=
moms
.
m00
;
double
perimeter
=
arcLength
(
Mat
(
contours
[
contourIdx
])
,
true
);
double
perimeter
=
arcLength
(
contours
[
contourIdx
]
,
true
);
double
ratio
=
4
*
CV_PI
*
area
/
(
perimeter
*
perimeter
);
if
(
ratio
<
params
.
minCircularity
||
ratio
>=
params
.
maxCircularity
)
continue
;
...
...
@@ -261,9 +260,9 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag
if
(
params
.
filterByConvexity
)
{
std
::
vector
<
Point
>
hull
;
convexHull
(
Mat
(
contours
[
contourIdx
])
,
hull
);
double
area
=
contourArea
(
Mat
(
contours
[
contourIdx
])
);
double
hullArea
=
contourArea
(
Mat
(
hull
)
);
convexHull
(
contours
[
contourIdx
]
,
hull
);
double
area
=
contourArea
(
contours
[
contourIdx
]
);
double
hullArea
=
contourArea
(
hull
);
if
(
fabs
(
hullArea
)
<
DBL_EPSILON
)
continue
;
double
ratio
=
area
/
hullArea
;
...
...
modules/objdetect/src/qrcode.cpp
浏览文件 @
794c14b2
...
...
@@ -387,7 +387,7 @@ bool QRDetect::computeTransformationPoints()
findNonZero
(
mask_roi
,
non_zero_elem
[
i
]);
newHull
.
insert
(
newHull
.
end
(),
non_zero_elem
[
i
].
begin
(),
non_zero_elem
[
i
].
end
());
}
convexHull
(
Mat
(
newHull
)
,
locations
);
convexHull
(
newHull
,
locations
);
for
(
size_t
i
=
0
;
i
<
locations
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
3
;
j
++
)
...
...
@@ -556,7 +556,7 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
}
vector
<
Point
>
integer_hull
;
convexHull
(
Mat
(
locations
)
,
integer_hull
);
convexHull
(
locations
,
integer_hull
);
int
hull_size
=
(
int
)
integer_hull
.
size
();
vector
<
Point2f
>
hull
(
hull_size
);
for
(
int
i
=
0
;
i
<
hull_size
;
i
++
)
...
...
@@ -910,7 +910,7 @@ bool QRDecode::versionDefinition()
vector
<
Point
>
locations
,
non_zero_elem
;
Mat
mask_roi
=
mask
(
Range
(
1
,
intermediate
.
rows
-
1
),
Range
(
1
,
intermediate
.
cols
-
1
));
findNonZero
(
mask_roi
,
non_zero_elem
);
convexHull
(
Mat
(
non_zero_elem
)
,
locations
);
convexHull
(
non_zero_elem
,
locations
);
Point
offset
=
computeOffset
(
locations
);
Point
temp_remote
=
locations
[
0
],
remote_point
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录