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
fbc44bcb
Commit
fbc44bcb
authored
Sep 22, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6845 from jbosch:master
parents
0330322d
5384a220
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
fisheye.cpp
modules/calib3d/src/fisheye.cpp
+23
-16
No files found.
modules/calib3d/src/fisheye.cpp
View file @
fbc44bcb
...
@@ -531,12 +531,16 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
...
@@ -531,12 +531,16 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
int
w
=
image_size
.
width
,
h
=
image_size
.
height
;
int
w
=
image_size
.
width
,
h
=
image_size
.
height
;
balance
=
std
::
min
(
std
::
max
(
balance
,
0.0
),
1.0
);
balance
=
std
::
min
(
std
::
max
(
balance
,
0.0
),
1.0
);
cv
::
Mat
points
(
1
,
4
,
CV_64FC2
);
cv
::
Mat
points
(
1
,
8
,
CV_64FC2
);
Vec2d
*
pptr
=
points
.
ptr
<
Vec2d
>
();
Vec2d
*
pptr
=
points
.
ptr
<
Vec2d
>
();
pptr
[
0
]
=
Vec2d
(
w
/
2
,
0
);
pptr
[
0
]
=
Vec2d
(
0
,
0
);
pptr
[
1
]
=
Vec2d
(
w
,
h
/
2
);
pptr
[
1
]
=
Vec2d
(
w
/
2
,
0
);
pptr
[
2
]
=
Vec2d
(
w
/
2
,
h
);
pptr
[
2
]
=
Vec2d
(
w
,
0
);
pptr
[
3
]
=
Vec2d
(
0
,
h
/
2
);
pptr
[
3
]
=
Vec2d
(
w
,
h
/
2
);
pptr
[
4
]
=
Vec2d
(
w
,
h
);
pptr
[
5
]
=
Vec2d
(
w
/
2
,
h
);
pptr
[
6
]
=
Vec2d
(
0
,
h
);
pptr
[
7
]
=
Vec2d
(
0
,
h
/
2
);
#if 0
#if 0
const int N = 10;
const int N = 10;
...
@@ -546,7 +550,6 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
...
@@ -546,7 +550,6 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
{
{
pptr[k++] = Vec2d(w/2, 0) - Vec2d(w/8, 0) + Vec2d(w/4/N*i, 0);
pptr[k++] = Vec2d(w/2, 0) - Vec2d(w/8, 0) + Vec2d(w/4/N*i, 0);
pptr[k++] = Vec2d(w/2, h-1) - Vec2d(w/8, h-1) + Vec2d(w/4/N*i, h-1);
pptr[k++] = Vec2d(w/2, h-1) - Vec2d(w/8, h-1) + Vec2d(w/4/N*i, h-1);
pptr[k++] = Vec2d(0, h/2) - Vec2d(0, h/8) + Vec2d(0, h/4/N*i);
pptr[k++] = Vec2d(0, h/2) - Vec2d(0, h/8) + Vec2d(0, h/4/N*i);
pptr[k++] = Vec2d(w-1, h/2) - Vec2d(w-1, h/8) + Vec2d(w-1, h/4/N*i);
pptr[k++] = Vec2d(w-1, h/2) - Vec2d(w-1, h/8) + Vec2d(w-1, h/4/N*i);
}
}
...
@@ -567,10 +570,14 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
...
@@ -567,10 +570,14 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
double
minx
=
DBL_MAX
,
miny
=
DBL_MAX
,
maxx
=
-
DBL_MAX
,
maxy
=
-
DBL_MAX
;
double
minx
=
DBL_MAX
,
miny
=
DBL_MAX
,
maxx
=
-
DBL_MAX
,
maxy
=
-
DBL_MAX
;
for
(
size_t
i
=
0
;
i
<
points
.
total
();
++
i
)
for
(
size_t
i
=
0
;
i
<
points
.
total
();
++
i
)
{
{
miny
=
std
::
min
(
miny
,
pptr
[
i
][
1
]);
if
(
i
!=
1
&&
i
!=
5
){
maxy
=
std
::
max
(
maxy
,
pptr
[
i
][
1
]);
minx
=
std
::
min
(
minx
,
std
::
abs
(
pptr
[
i
][
0
]
-
cn
[
0
]));
minx
=
std
::
min
(
minx
,
pptr
[
i
][
0
]);
}
maxx
=
std
::
max
(
maxx
,
pptr
[
i
][
0
]);
if
(
i
!=
3
&&
i
!=
7
){
miny
=
std
::
min
(
miny
,
std
::
abs
(
pptr
[
i
][
1
]
-
cn
[
1
]));
}
maxy
=
std
::
max
(
maxy
,
std
::
abs
(
pptr
[
i
][
1
]
-
cn
[
1
]));
maxx
=
std
::
max
(
maxx
,
std
::
abs
(
pptr
[
i
][
0
]
-
cn
[
0
]));
}
}
#if 0
#if 0
...
@@ -584,13 +591,13 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
...
@@ -584,13 +591,13 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
}
}
#endif
#endif
double
f1
=
w
*
0.5
/
(
cn
[
0
]
-
minx
);
double
f1
=
w
*
0.5
/
(
minx
);
double
f2
=
w
*
0.5
/
(
maxx
-
cn
[
0
]
);
double
f2
=
w
*
0.5
/
(
maxx
);
double
f3
=
h
*
0.5
*
aspect_ratio
/
(
cn
[
1
]
-
miny
);
double
f3
=
h
*
0.5
*
aspect_ratio
/
(
miny
);
double
f4
=
h
*
0.5
*
aspect_ratio
/
(
maxy
-
cn
[
1
]
);
double
f4
=
h
*
0.5
*
aspect_ratio
/
(
maxy
);
double
fm
in
=
std
::
min
(
f1
,
std
::
min
(
f2
,
std
::
min
(
f3
,
f4
))
);
double
fm
ax
=
std
::
max
(
f1
,
f3
);
double
fm
ax
=
std
::
max
(
f1
,
std
::
max
(
f2
,
std
::
max
(
f3
,
f4
))
);
double
fm
in
=
std
::
min
(
f2
,
f4
);
double
f
=
balance
*
fmin
+
(
1.0
-
balance
)
*
fmax
;
double
f
=
balance
*
fmin
+
(
1.0
-
balance
)
*
fmax
;
f
*=
fov_scale
>
0
?
1.0
/
fov_scale
:
1.0
;
f
*=
fov_scale
>
0
?
1.0
/
fov_scale
:
1.0
;
...
...
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