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
6dbf13d7
Commit
6dbf13d7
authored
Feb 13, 2015
by
ASUS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saveBestModel() is modified. accuracy test is passed.
parent
87c2b819
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
16 deletions
+44
-16
fundam.cpp
modules/calib3d/src/fundam.cpp
+8
-5
rhorefc.cpp
modules/calib3d/src/rhorefc.cpp
+36
-11
No files found.
modules/calib3d/src/fundam.cpp
View file @
6dbf13d7
...
@@ -399,16 +399,18 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
...
@@ -399,16 +399,18 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
{
{
tempMask
=
Mat
::
ones
(
npoints
,
1
,
CV_8U
);
tempMask
=
Mat
::
ones
(
npoints
,
1
,
CV_8U
);
result
=
cb
->
runKernel
(
src
,
dst
,
H
)
>
0
;
result
=
cb
->
runKernel
(
src
,
dst
,
H
)
>
0
;
}
}
else
if
(
method
==
RANSAC
)
else
if
(
method
==
RANSAC
)
result
=
createRANSACPointSetRegistrator
(
cb
,
4
,
ransacReprojThreshold
,
confidence
,
maxIters
)
->
run
(
src
,
dst
,
H
,
tempMask
);
result
=
createRANSACPointSetRegistrator
(
cb
,
4
,
ransacReprojThreshold
,
confidence
,
maxIters
)
->
run
(
src
,
dst
,
H
,
tempMask
);
else
if
(
method
==
LMEDS
)
else
if
(
method
==
LMEDS
)
result
=
createLMeDSPointSetRegistrator
(
cb
,
4
,
confidence
,
maxIters
)
->
run
(
src
,
dst
,
H
,
tempMask
);
result
=
createLMeDSPointSetRegistrator
(
cb
,
4
,
confidence
,
maxIters
)
->
run
(
src
,
dst
,
H
,
tempMask
);
else
if
(
method
==
RHO
)
{
else
if
(
method
==
RHO
)
result
=
createAndRunRHORegistrator
(
confidence
,
maxIters
,
ransacReprojThreshold
,
npoints
,
src
,
dst
,
H
,
tempMask
);
result
=
createAndRunRHORegistrator
(
confidence
,
maxIters
,
ransacReprojThreshold
,
npoints
,
src
,
dst
,
H
,
tempMask
);
}
else
else
CV_Error
(
Error
::
StsBadArg
,
"Unknown estimation method"
);
CV_Error
(
Error
::
StsBadArg
,
"Unknown estimation method"
);
if
(
result
&&
npoints
>
4
&&
method
!=
RHO
)
if
(
result
&&
npoints
>
4
&&
method
!=
RHO
)
{
{
compressPoints
(
src
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
compressPoints
(
src
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
...
@@ -419,8 +421,9 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
...
@@ -419,8 +421,9 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
Mat
dst1
=
dst
.
rowRange
(
0
,
npoints
);
Mat
dst1
=
dst
.
rowRange
(
0
,
npoints
);
src
=
src1
;
src
=
src1
;
dst
=
dst1
;
dst
=
dst1
;
if
(
method
==
RANSAC
||
method
==
LMEDS
)
if
(
method
==
RANSAC
||
method
==
LMEDS
)
cb
->
runKernel
(
src
,
dst
,
H
);
cb
->
runKernel
(
src
,
dst
,
H
);
Mat
H8
(
8
,
1
,
CV_64F
,
H
.
ptr
<
double
>
());
Mat
H8
(
8
,
1
,
CV_64F
,
H
.
ptr
<
double
>
());
createLMSolver
(
makePtr
<
HomographyRefineCallback
>
(
src
,
dst
),
10
)
->
run
(
H8
);
createLMSolver
(
makePtr
<
HomographyRefineCallback
>
(
src
,
dst
),
10
)
->
run
(
H8
);
}
}
...
...
modules/calib3d/src/rhorefc.cpp
View file @
6dbf13d7
...
@@ -55,7 +55,6 @@
...
@@ -55,7 +55,6 @@
#include "rhorefc.h"
#include "rhorefc.h"
/* Defines */
/* Defines */
#define MEM_ALIGN 32
#define MEM_ALIGN 32
#define HSIZE (3*3*sizeof(float))
#define HSIZE (3*3*sizeof(float))
...
@@ -383,7 +382,7 @@ unsigned rhoRefC(RHO_HEST_REFC* restrict p, /* Homography estimation conte
...
@@ -383,7 +382,7 @@ unsigned rhoRefC(RHO_HEST_REFC* restrict p, /* Homography estimation conte
* PROSAC Loop
* PROSAC Loop
*/
*/
for
(
p
->
ctrl
.
i
=
0
;
p
->
ctrl
.
i
<
p
->
arg
.
maxI
;
p
->
ctrl
.
i
++
){
for
(
p
->
ctrl
.
i
=
0
;
p
->
ctrl
.
i
<
p
->
arg
.
maxI
||
p
->
ctrl
.
i
<
100
;
p
->
ctrl
.
i
++
){
sacHypothesize
(
p
)
&&
sacVerify
(
p
);
sacHypothesize
(
p
)
&&
sacVerify
(
p
);
}
}
...
@@ -861,7 +860,28 @@ static inline int sacIsSampleDegenerate(RHO_HEST_REFC* p){
...
@@ -861,7 +860,28 @@ static inline int sacIsSampleDegenerate(RHO_HEST_REFC* p){
*/
*/
static
inline
void
sacGenerateModel
(
RHO_HEST_REFC
*
p
){
static
inline
void
sacGenerateModel
(
RHO_HEST_REFC
*
p
){
#if 1
hFuncRefC
(
p
->
curr
.
pkdPts
,
p
->
curr
.
H
);
hFuncRefC
(
p
->
curr
.
pkdPts
,
p
->
curr
.
H
);
#else
int
mm
=
4
;
cv
::
Mat
_H
(
3
,
3
,
CV_32FC1
);
std
::
vector
<
cv
::
Point2f
>
_srcPoints
(
mm
,
cv
::
Point2f
());
std
::
vector
<
cv
::
Point2f
>
_dstPoints
(
mm
,
cv
::
Point2f
());
for
(
int
i
=
0
;
i
<
mm
;
i
++
){
cv
::
Point2f
tempPoint2f
(
p
->
curr
.
pkdPts
[
2
*
i
],
p
->
curr
.
pkdPts
[
2
*
i
+
1
]);
_srcPoints
[
i
]
=
tempPoint2f
;
tempPoint2f
=
cv
::
Point2f
((
float
)
p
->
curr
.
pkdPts
[
2
*
i
+
8
],(
float
)
p
->
curr
.
pkdPts
[
2
*
i
+
9
]);
_dstPoints
[
i
]
=
tempPoint2f
;
}
_H
=
cv
::
findHomography
(
_srcPoints
,
_dstPoints
,
0
,
3
);
double
*
data
=
(
double
*
)
_H
.
data
;
p
->
curr
.
H
[
0
]
=
data
[
0
];
p
->
curr
.
H
[
1
]
=
data
[
1
];
p
->
curr
.
H
[
2
]
=
data
[
2
];
p
->
curr
.
H
[
3
]
=
data
[
3
];
p
->
curr
.
H
[
4
]
=
data
[
4
];
p
->
curr
.
H
[
5
]
=
data
[
5
];
p
->
curr
.
H
[
6
]
=
data
[
6
];
p
->
curr
.
H
[
7
]
=
data
[
7
];
p
->
curr
.
H
[
8
]
=
1.0
;
#endif
}
}
/**
/**
...
@@ -1074,17 +1094,22 @@ static inline int sacIsBestModelGoodEnough(RHO_HEST_REFC* p){
...
@@ -1074,17 +1094,22 @@ static inline int sacIsBestModelGoodEnough(RHO_HEST_REFC* p){
*/
*/
static
inline
void
sacSaveBestModel
(
RHO_HEST_REFC
*
p
){
static
inline
void
sacSaveBestModel
(
RHO_HEST_REFC
*
p
){
float
*
H
=
p
->
curr
.
H
;
char
*
inl
=
p
->
curr
.
inl
;
unsigned
numInl
=
p
->
curr
.
numInl
;
p
->
curr
.
H
=
p
->
best
.
H
;
memcpy
(
p
->
best
.
H
,
p
->
curr
.
H
,
HSIZE
);
p
->
curr
.
inl
=
p
->
best
.
inl
;
memcpy
(
p
->
best
.
inl
,
p
->
curr
.
inl
,
p
->
arg
.
N
);
p
->
curr
.
numInl
=
p
->
best
.
numInl
;
p
->
best
.
numInl
=
p
->
curr
.
numInl
;
// float* H = p->curr.H;
// char* inl = p->curr.inl;
// unsigned numInl = p->curr.numInl;
// p->curr.H = p->best.H;
// p->curr.inl = p->best.inl;
// p->curr.numInl = p->best.numInl;
p
->
best
.
H
=
H
;
//
p->best.H = H;
p
->
best
.
inl
=
inl
;
//
p->best.inl = inl;
p
->
best
.
numInl
=
numInl
;
//
p->best.numInl = numInl;
}
}
/**
/**
...
...
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