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
8a1d8c84
Commit
8a1d8c84
authored
10 years ago
by
Olexa Bilaniuk
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'refs/remotes/upstream/master'
parents
6d27d488
e12a04ac
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
337 additions
and
234 deletions
+337
-234
CMakeLists.txt
CMakeLists.txt
+18
-2
imagestorage.cpp
apps/traincascade/imagestorage.cpp
+1
-9
OpenCVGenConfig.cmake
cmake/OpenCVGenConfig.cmake
+5
-18
CMakeLists.txt
data/CMakeLists.txt
+3
-9
CMakeLists.txt
doc/CMakeLists.txt
+4
-23
calib3d.hpp
modules/calib3d/include/opencv2/calib3d.hpp
+10
-0
perf_pnp.cpp
modules/calib3d/perf/perf_pnp.cpp
+8
-6
calibration.cpp
modules/calib3d/src/calibration.cpp
+4
-1
epnp.cpp
modules/calib3d/src/epnp.cpp
+13
-8
epnp.h
modules/calib3d/src/epnp.h
+5
-0
fundam.cpp
modules/calib3d/src/fundam.cpp
+2
-16
precomp.hpp
modules/calib3d/src/precomp.hpp
+13
-0
solvepnp.cpp
modules/calib3d/src/solvepnp.cpp
+63
-38
cvdef.h
modules/core/include/opencv2/core/cvdef.h
+8
-8
perf_cvround.cpp
modules/core/perf/perf_cvround.cpp
+45
-0
lapack.cpp
modules/core/src/lapack.cpp
+2
-2
hough.cpp
modules/imgproc/src/hough.cpp
+3
-6
CMakeLists.txt
modules/java/CMakeLists.txt
+5
-10
gen_java.py
modules/java/generator/gen_java.py
+1
-1
cascadedetect.cpp
modules/objdetect/src/cascadedetect.cpp
+1
-1
videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+14
-3
videoio_c.h
modules/videoio/include/opencv2/videoio/videoio_c.h
+1
-1
cap_dshow.cpp
modules/videoio/src/cap_dshow.cpp
+3
-3
cap_pvapi.cpp
modules/videoio/src/cap_pvapi.cpp
+82
-58
setup_winrt.ps1
platforms/winrt/setup_winrt.ps1
+23
-11
No files found.
CMakeLists.txt
View file @
8a1d8c84
...
...
@@ -274,8 +274,6 @@ endif()
if
(
ANDROID OR WIN32
)
set
(
OPENCV_DOC_INSTALL_PATH doc
)
elseif
(
INSTALL_TO_MANGLED_PATHS
)
set
(
OPENCV_DOC_INSTALL_PATH share/OpenCV-
${
OPENCV_VERSION
}
/doc
)
else
()
set
(
OPENCV_DOC_INSTALL_PATH share/OpenCV/doc
)
endif
()
...
...
@@ -309,6 +307,10 @@ if(NOT OPENCV_TEST_INSTALL_PATH)
set
(
OPENCV_TEST_INSTALL_PATH
"
${
OPENCV_BIN_INSTALL_PATH
}
"
)
endif
()
if
(
OPENCV_TEST_DATA_PATH
)
get_filename_component
(
OPENCV_TEST_DATA_PATH
${
OPENCV_TEST_DATA_PATH
}
ABSOLUTE
)
endif
()
if
(
OPENCV_TEST_DATA_PATH AND NOT OPENCV_TEST_DATA_INSTALL_PATH
)
if
(
ANDROID
)
set
(
OPENCV_TEST_DATA_INSTALL_PATH
"sdk/etc/testdata"
)
...
...
@@ -327,9 +329,11 @@ if(ANDROID)
set
(
OPENCV_CONFIG_INSTALL_PATH sdk/native/jni
)
set
(
OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include
)
set
(
OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native
)
set
(
OPENCV_OTHER_INSTALL_PATH sdk/etc
)
else
()
set
(
LIBRARY_OUTPUT_PATH
"
${
OpenCV_BINARY_DIR
}
/lib"
)
set
(
3P_LIBRARY_OUTPUT_PATH
"
${
OpenCV_BINARY_DIR
}
/3rdparty/lib
${
LIB_SUFFIX
}
"
)
if
(
WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows
)
if
(
OpenCV_STATIC
)
set
(
OPENCV_LIB_INSTALL_PATH
"
${
OpenCV_INSTALL_BINARIES_PREFIX
}
staticlib
${
LIB_SUFFIX
}
"
)
...
...
@@ -338,10 +342,14 @@ else()
endif
()
set
(
OPENCV_3P_LIB_INSTALL_PATH
"
${
OpenCV_INSTALL_BINARIES_PREFIX
}
staticlib
${
LIB_SUFFIX
}
"
)
set
(
OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native
)
set
(
OPENCV_JAR_INSTALL_PATH java
)
set
(
OPENCV_OTHER_INSTALL_PATH etc
)
else
()
set
(
OPENCV_LIB_INSTALL_PATH lib
${
LIB_SUFFIX
}
)
set
(
OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/
${
OPENCV_LIB_INSTALL_PATH
}
)
set
(
OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples
)
set
(
OPENCV_JAR_INSTALL_PATH share/OpenCV/java
)
set
(
OPENCV_OTHER_INSTALL_PATH share/OpenCV
)
endif
()
set
(
OPENCV_INCLUDE_INSTALL_PATH
"include"
)
...
...
@@ -358,8 +366,16 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if
(
INSTALL_TO_MANGLED_PATHS
)
set
(
OPENCV_INCLUDE_INSTALL_PATH
${
OPENCV_INCLUDE_INSTALL_PATH
}
/opencv-
${
OPENCV_VERSION
}
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_3P_LIB_INSTALL_PATH
"
${
OPENCV_3P_LIB_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_SAMPLES_SRC_INSTALL_PATH
"
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_CONFIG_INSTALL_PATH
"
${
OPENCV_CONFIG_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_DOC_INSTALL_PATH
"
${
OPENCV_DOC_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_JAR_INSTALL_PATH
"
${
OPENCV_JAR_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_TEST_DATA_INSTALL_PATH
"
${
OPENCV_TEST_DATA_INSTALL_PATH
}
"
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OPENCV_OTHER_INSTALL_PATH
"
${
OPENCV_OTHER_INSTALL_PATH
}
"
)
endif
()
if
(
WIN32
)
# Postfix of DLLs:
set
(
OPENCV_DLLVERSION
"
${
OPENCV_VERSION_MAJOR
}${
OPENCV_VERSION_MINOR
}${
OPENCV_VERSION_PATCH
}
"
)
...
...
This diff is collapsed.
Click to expand it.
apps/traincascade/imagestorage.cpp
View file @
8a1d8c84
...
...
@@ -33,20 +33,12 @@ bool CvCascadeImageReader::NegReader::create( const string _filename, Size _winS
if
(
!
file
.
is_open
()
)
return
false
;
size_t
pos
=
_filename
.
rfind
(
'\\'
);
char
dlmrt
=
'\\'
;
if
(
pos
==
string
::
npos
)
{
pos
=
_filename
.
rfind
(
'/'
);
dlmrt
=
'/'
;
}
dirname
=
pos
==
string
::
npos
?
""
:
_filename
.
substr
(
0
,
pos
)
+
dlmrt
;
while
(
!
file
.
eof
()
)
{
std
::
getline
(
file
,
str
);
if
(
str
.
empty
())
break
;
if
(
str
.
at
(
0
)
==
'#'
)
continue
;
/* comment */
imgFilenames
.
push_back
(
dirname
+
str
);
imgFilenames
.
push_back
(
str
);
}
file
.
close
();
...
...
This diff is collapsed.
Click to expand it.
cmake/OpenCVGenConfig.cmake
View file @
8a1d8c84
...
...
@@ -101,10 +101,7 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.
set
(
OpenCV_INCLUDE_DIRS_CONFIGCMAKE
"
\"\$
{OpenCV_INSTALL_PATH}/
${
OPENCV_INCLUDE_INSTALL_PATH
}
/opencv"
"
\$
{OpenCV_INSTALL_PATH}/
${
OPENCV_INCLUDE_INSTALL_PATH
}
\"
"
)
set
(
OpenCV2_INCLUDE_DIRS_CONFIGCMAKE
"
\"\"
"
)
if
(
INSTALL_TO_MANGLED_PATHS
)
string
(
REPLACE
"OpenCV"
"OpenCV-
${
OPENCV_VERSION
}
"
OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE
"
${
OPENCV_3P_LIB_INSTALL_PATH
}
"
)
set
(
OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE
"
\"\$
{OpenCV_INSTALL_PATH}/
${
OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE
}
\"
"
)
endif
()
set
(
OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE
"
\"\$
{OpenCV_INSTALL_PATH}/
${
OPENCV_3P_LIB_INSTALL_PATH
}
\"
"
)
if
(
UNIX
)
# ANDROID configuration is created here also
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference
...
...
@@ -114,23 +111,13 @@ if(UNIX) # ANDROID configuration is created here also
# <prefix>/(share|lib)/<name>*/ (U)
# <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
if
(
USE_IPPICV
)
if
(
INSTALL_TO_MANGLED_PATHS
)
file
(
RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV
"
${
CMAKE_INSTALL_PREFIX
}
/
${
OPENCV_CONFIG_INSTALL_PATH
}
-
${
OPENCV_VERSION
}
/"
${
IPPICV_INSTALL_PATH
}
)
else
()
file
(
RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV
"
${
CMAKE_INSTALL_PREFIX
}
/
${
OPENCV_CONFIG_INSTALL_PATH
}
/"
${
IPPICV_INSTALL_PATH
}
)
endif
()
file
(
RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV
"
${
CMAKE_INSTALL_PREFIX
}
/
${
OPENCV_CONFIG_INSTALL_PATH
}
/"
${
IPPICV_INSTALL_PATH
}
)
endif
()
configure_file
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/templates/OpenCVConfig.cmake.in"
"
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig.cmake"
@ONLY
)
configure_file
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/templates/OpenCVConfig-version.cmake.in"
"
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig-version.cmake"
@ONLY
)
if
(
INSTALL_TO_MANGLED_PATHS
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig.cmake DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
-
${
OPENCV_VERSION
}
/ COMPONENT dev
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig-version.cmake DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
-
${
OPENCV_VERSION
}
/ COMPONENT dev
)
install
(
EXPORT OpenCVModules DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
-
${
OPENCV_VERSION
}
/ FILE OpenCVModules
${
modules_file_suffix
}
.cmake COMPONENT dev
)
else
()
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig.cmake"
DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ COMPONENT dev
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig-version.cmake DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ COMPONENT dev
)
install
(
EXPORT OpenCVModules DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ FILE OpenCVModules
${
modules_file_suffix
}
.cmake COMPONENT dev
)
endif
()
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig.cmake"
DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ COMPONENT dev
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/OpenCVConfig-version.cmake DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ COMPONENT dev
)
install
(
EXPORT OpenCVModules DESTINATION
${
OPENCV_CONFIG_INSTALL_PATH
}
/ FILE OpenCVModules
${
modules_file_suffix
}
.cmake COMPONENT dev
)
endif
()
if
(
ANDROID
)
...
...
This diff is collapsed.
Click to expand it.
data/CMakeLists.txt
View file @
8a1d8c84
file
(
GLOB HAAR_CASCADES haarcascades/*.xml
)
file
(
GLOB LBP_CASCADES lbpcascades/*.xml
)
if
(
ANDROID
)
install
(
FILES
${
HAAR_CASCADES
}
DESTINATION sdk/etc/haarcascades COMPONENT libs
)
install
(
FILES
${
LBP_CASCADES
}
DESTINATION sdk/etc/lbpcascades COMPONENT libs
)
else
()
install
(
FILES
${
HAAR_CASCADES
}
DESTINATION share/OpenCV/haarcascades COMPONENT libs
)
install
(
FILES
${
LBP_CASCADES
}
DESTINATION share/OpenCV/lbpcascades COMPONENT libs
)
endif
()
install
(
FILES
${
HAAR_CASCADES
}
DESTINATION
${
OPENCV_OTHER_INSTALL_PATH
}
/haarcascades COMPONENT libs
)
install
(
FILES
${
LBP_CASCADES
}
DESTINATION
${
OPENCV_OTHER_INSTALL_PATH
}
/lbpcascades COMPONENT libs
)
if
(
INSTALL_TESTS AND OPENCV_TEST_DATA_PATH
)
install
(
DIRECTORY
"
${
OPENCV_TEST_DATA_PATH
}
/"
DESTINATION
"
${
OPENCV_TEST_DATA_INSTALL_PATH
}
"
COMPONENT
"tests"
)
endif
()
\ No newline at end of file
endif
()
This diff is collapsed.
Click to expand it.
doc/CMakeLists.txt
View file @
8a1d8c84
...
...
@@ -27,15 +27,6 @@ if(HAVE_DOC_GENERATOR)
set
(
FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect ml flann photo stitching
)
list
(
REMOVE_ITEM BASE_MODULES
${
FIXED_ORDER_MODULES
}
)
set
(
BASE_MODULES
${
FIXED_ORDER_MODULES
}
${
BASE_MODULES
}
)
set
(
DOC_LIST
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo2.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv-logo-white.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/opencv.ico"
"
${
OpenCV_SOURCE_DIR
}
/doc/pattern.png"
"
${
OpenCV_SOURCE_DIR
}
/doc/acircles_pattern.png"
)
set
(
OPTIONAL_DOC_LIST
""
)
endif
(
HAVE_DOC_GENERATOR
)
# ========= Doxygen docs =========
...
...
@@ -160,18 +151,8 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
COMMAND
${
DOXYGEN_EXECUTABLE
}
${
doxyfile
}
DEPENDS
${
doxyfile
}
${
rootfile
}
${
bibfile
}
${
deps
}
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/doxygen/html
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
COMPONENT
"docs"
OPTIONAL
)
endif
()
if
(
HAVE_DOC_GENERATOR
)
# installation
foreach
(
f
${
DOC_LIST
}
)
install
(
FILES
"
${
f
}
"
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
COMPONENT docs
)
endforeach
()
foreach
(
f
${
OPTIONAL_DOC_LIST
}
)
install
(
FILES
"
${
f
}
"
DESTINATION
"
${
OPENCV_DOC_INSTALL_PATH
}
"
OPTIONAL COMPONENT docs
)
endforeach
()
# dummy targets
add_custom_target
(
docs
)
add_custom_target
(
html_docs
)
endif
(
HAVE_DOC_GENERATOR
)
This diff is collapsed.
Click to expand it.
modules/calib3d/include/opencv2/calib3d.hpp
View file @
8a1d8c84
...
...
@@ -514,6 +514,16 @@ projections, as well as the camera matrix and the distortion coefficients.
@note
- An example of how to use solvePnP for planar augmented reality can be found at
opencv_source_code/samples/python2/plane_ar.py
- If you are using Python:
- Numpy array slices won't work as input because solvePnP requires contiguous
arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
modules/calib3d/src/solvepnp.cpp version 2.4.9)
- The P3P algorithm requires image points to be in an array of shape (N,1,2) due
to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
which requires 2-channel information.
- Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
*/
CV_EXPORTS_W
bool
solvePnP
(
InputArray
objectPoints
,
InputArray
imagePoints
,
InputArray
cameraMatrix
,
InputArray
distCoeffs
,
...
...
This diff is collapsed.
Click to expand it.
modules/calib3d/perf/perf_pnp.cpp
View file @
8a1d8c84
...
...
@@ -19,8 +19,8 @@ typedef perf::TestBaseWithParam<int> PointsNum;
PERF_TEST_P
(
PointsNum_Algo
,
solvePnP
,
testing
::
Combine
(
testing
::
Values
(
4
,
3
*
9
,
7
*
13
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
((
int
)
SOLVEPNP_ITERATIVE
,
(
int
)
SOLVEPNP_EPNP
)
testing
::
Values
(
5
,
3
*
9
,
7
*
13
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
((
int
)
SOLVEPNP_ITERATIVE
,
(
int
)
SOLVEPNP_EPNP
,
(
int
)
SOLVEPNP_UPNP
,
(
int
)
SOLVEPNP_DLS
)
)
)
{
...
...
@@ -64,13 +64,15 @@ PERF_TEST_P(PointsNum_Algo, solvePnP,
PERF_TEST_P
(
PointsNum_Algo
,
solvePnPSmallPoints
,
testing
::
Combine
(
testing
::
Values
(
4
),
//TODO: find why results on 4 points are too unstable
testing
::
Values
((
int
)
SOLVEPNP_P3P
,
(
int
)
SOLVEPNP_DLS
,
(
int
)
SOLVEPNP_UPNP
)
testing
::
Values
(
5
),
testing
::
Values
((
int
)
SOLVEPNP_P3P
,
(
int
)
SOLVEPNP_
EPNP
,
(
int
)
SOLVEPNP_
DLS
,
(
int
)
SOLVEPNP_UPNP
)
)
)
{
int
pointsNum
=
get
<
0
>
(
GetParam
());
pnpAlgo
algo
=
get
<
1
>
(
GetParam
());
if
(
algo
==
SOLVEPNP_P3P
)
pointsNum
=
4
;
vector
<
Point2f
>
points2d
(
pointsNum
);
vector
<
Point3f
>
points3d
(
pointsNum
);
...
...
@@ -92,7 +94,7 @@ PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints,
//add noise
Mat
noise
(
1
,
(
int
)
points2d
.
size
(),
CV_32FC2
);
randu
(
noise
,
0
,
0.
01
);
randu
(
noise
,
-
0.001
,
0.0
01
);
add
(
points2d
,
noise
,
points2d
);
declare
.
in
(
points3d
,
points2d
);
...
...
@@ -107,7 +109,7 @@ PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints,
SANITY_CHECK
(
tvec
,
1e-2
);
}
PERF_TEST_P
(
PointsNum
,
DISABLED_SolvePnPRansac
,
testing
::
Values
(
4
,
3
*
9
,
7
*
13
))
PERF_TEST_P
(
PointsNum
,
DISABLED_SolvePnPRansac
,
testing
::
Values
(
5
,
3
*
9
,
7
*
13
))
{
int
count
=
GetParam
();
...
...
This diff is collapsed.
Click to expand it.
modules/calib3d/src/calibration.cpp
View file @
8a1d8c84
...
...
@@ -1595,7 +1595,10 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
my
=
imgHeight
/
apertureHeight
;
}
else
{
mx
=
1.0
;
my
=
*
pasp
;
if
(
pasp
)
my
=
*
pasp
;
else
my
=
1.0
;
}
/* Calculate fovx and fovy. */
...
...
This diff is collapsed.
Click to expand it.
modules/calib3d/src/epnp.cpp
View file @
8a1d8c84
...
...
@@ -2,7 +2,10 @@
#include "precomp.hpp"
#include "epnp.h"
epnp
::
epnp
(
const
cv
::
Mat
&
cameraMatrix
,
const
cv
::
Mat
&
opoints
,
const
cv
::
Mat
&
ipoints
)
namespace
cv
{
epnp
::
epnp
(
const
Mat
&
cameraMatrix
,
const
Mat
&
opoints
,
const
Mat
&
ipoints
)
{
if
(
cameraMatrix
.
depth
()
==
CV_32F
)
init_camera_parameters
<
float
>
(
cameraMatrix
);
...
...
@@ -17,14 +20,14 @@ epnp::epnp(const cv::Mat& cameraMatrix, const cv::Mat& opoints, const cv::Mat& i
if
(
opoints
.
depth
()
==
ipoints
.
depth
())
{
if
(
opoints
.
depth
()
==
CV_32F
)
init_points
<
cv
::
Point3f
,
cv
::
Point2f
>
(
opoints
,
ipoints
);
init_points
<
Point3f
,
Point2f
>
(
opoints
,
ipoints
);
else
init_points
<
cv
::
Point3d
,
cv
::
Point2d
>
(
opoints
,
ipoints
);
init_points
<
Point3d
,
Point2d
>
(
opoints
,
ipoints
);
}
else
if
(
opoints
.
depth
()
==
CV_32F
)
init_points
<
cv
::
Point3f
,
cv
::
Point2d
>
(
opoints
,
ipoints
);
init_points
<
Point3f
,
Point2d
>
(
opoints
,
ipoints
);
else
init_points
<
cv
::
Point3d
,
cv
::
Point2f
>
(
opoints
,
ipoints
);
init_points
<
Point3d
,
Point2f
>
(
opoints
,
ipoints
);
alphas
.
resize
(
4
*
number_of_correspondences
);
pcs
.
resize
(
3
*
number_of_correspondences
);
...
...
@@ -144,7 +147,7 @@ void epnp::compute_pcs(void)
}
}
void
epnp
::
compute_pose
(
cv
::
Mat
&
R
,
cv
::
Mat
&
t
)
void
epnp
::
compute_pose
(
Mat
&
R
,
Mat
&
t
)
{
choose_control_points
();
compute_barycentric_coordinates
();
...
...
@@ -189,8 +192,8 @@ void epnp::compute_pose(cv::Mat& R, cv::Mat& t)
if
(
rep_errors
[
2
]
<
rep_errors
[
1
])
N
=
2
;
if
(
rep_errors
[
3
]
<
rep_errors
[
N
])
N
=
3
;
cv
::
Mat
(
3
,
1
,
CV_64F
,
ts
[
N
]).
copyTo
(
t
);
cv
::
Mat
(
3
,
3
,
CV_64F
,
Rs
[
N
]).
copyTo
(
R
);
Mat
(
3
,
1
,
CV_64F
,
ts
[
N
]).
copyTo
(
t
);
Mat
(
3
,
3
,
CV_64F
,
Rs
[
N
]).
copyTo
(
R
);
}
void
epnp
::
copy_R_and_t
(
const
double
R_src
[
3
][
3
],
const
double
t_src
[
3
],
...
...
@@ -621,3 +624,5 @@ void epnp::qr_solve(CvMat * A, CvMat * b, CvMat * X)
pX
[
i
]
=
(
pb
[
i
]
-
sum
)
/
A2
[
i
];
}
}
}
This diff is collapsed.
Click to expand it.
modules/calib3d/src/epnp.h
View file @
8a1d8c84
...
...
@@ -4,6 +4,9 @@
#include "precomp.hpp"
#include "opencv2/core/core_c.h"
namespace
cv
{
class
epnp
{
public
:
epnp
(
const
cv
::
Mat
&
cameraMatrix
,
const
cv
::
Mat
&
opoints
,
const
cv
::
Mat
&
ipoints
);
...
...
@@ -78,4 +81,6 @@ class epnp {
double
*
A1
,
*
A2
;
};
}
#endif
This diff is collapsed.
Click to expand it.
modules/calib3d/src/fundam.cpp
View file @
8a1d8c84
...
...
@@ -70,20 +70,6 @@ static bool haveCollinearPoints( const Mat& m, int count )
}
template
<
typename
T
>
int
compressPoints
(
T
*
ptr
,
const
uchar
*
mask
,
int
mstep
,
int
count
)
{
int
i
,
j
;
for
(
i
=
j
=
0
;
i
<
count
;
i
++
)
if
(
mask
[
i
*
mstep
]
)
{
if
(
i
>
j
)
ptr
[
j
]
=
ptr
[
i
];
j
++
;
}
return
j
;
}
class
HomographyEstimatorCallback
:
public
PointSetRegistrator
::
Callback
{
public
:
...
...
@@ -404,8 +390,8 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2,
if
(
result
&&
npoints
>
4
&&
method
!=
RHO
)
{
compress
Point
s
(
src
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
npoints
=
compress
Point
s
(
dst
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
compress
Elem
s
(
src
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
npoints
=
compress
Elem
s
(
dst
.
ptr
<
Point2f
>
(),
tempMask
.
ptr
<
uchar
>
(),
1
,
npoints
);
if
(
npoints
>
0
)
{
Mat
src1
=
src
.
rowRange
(
0
,
npoints
);
...
...
This diff is collapsed.
Click to expand it.
modules/calib3d/src/precomp.hpp
View file @
8a1d8c84
...
...
@@ -102,6 +102,19 @@ CV_EXPORTS Ptr<PointSetRegistrator> createRANSACPointSetRegistrator(const Ptr<Po
CV_EXPORTS
Ptr
<
PointSetRegistrator
>
createLMeDSPointSetRegistrator
(
const
Ptr
<
PointSetRegistrator
::
Callback
>&
cb
,
int
modelPoints
,
double
confidence
=
0.99
,
int
maxIters
=
1000
);
template
<
typename
T
>
inline
int
compressElems
(
T
*
ptr
,
const
uchar
*
mask
,
int
mstep
,
int
count
)
{
int
i
,
j
;
for
(
i
=
j
=
0
;
i
<
count
;
i
++
)
if
(
mask
[
i
*
mstep
]
)
{
if
(
i
>
j
)
ptr
[
j
]
=
ptr
[
i
];
j
++
;
}
return
j
;
}
}
#endif
This diff is collapsed.
Click to expand it.
modules/calib3d/src/solvepnp.cpp
View file @
8a1d8c84
...
...
@@ -48,41 +48,43 @@
#include "opencv2/calib3d/calib3d_c.h"
#include <iostream>
using
namespace
cv
;
bool
cv
::
solvePnP
(
InputArray
_opoints
,
InputArray
_ipoints
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
OutputArray
_rvec
,
OutputArray
_tvec
,
bool
useExtrinsicGuess
,
int
flags
)
namespace
cv
{
bool
solvePnP
(
InputArray
_opoints
,
InputArray
_ipoints
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
OutputArray
_rvec
,
OutputArray
_tvec
,
bool
useExtrinsicGuess
,
int
flags
)
{
Mat
opoints
=
_opoints
.
getMat
(),
ipoints
=
_ipoints
.
getMat
();
int
npoints
=
std
::
max
(
opoints
.
checkVector
(
3
,
CV_32F
),
opoints
.
checkVector
(
3
,
CV_64F
));
CV_Assert
(
npoints
>=
0
&&
npoints
==
std
::
max
(
ipoints
.
checkVector
(
2
,
CV_32F
),
ipoints
.
checkVector
(
2
,
CV_64F
))
);
_rvec
.
create
(
3
,
1
,
CV_64F
);
_tvec
.
create
(
3
,
1
,
CV_64F
);
Mat
cameraMatrix
=
_cameraMatrix
.
getMat
(),
distCoeffs
=
_distCoeffs
.
getMat
(
);
Mat
cameraMatrix
=
Mat_
<
double
>
(
_cameraMatrix
.
getMat
()),
distCoeffs
=
Mat_
<
double
>
(
_distCoeffs
.
getMat
()
);
if
(
flags
==
SOLVEPNP_EPNP
)
if
(
flags
==
SOLVEPNP_EPNP
||
flags
==
SOLVEPNP_DLS
||
flags
==
SOLVEPNP_UPNP
)
{
cv
::
Mat
undistortedPoints
;
cv
::
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
Mat
undistortedPoints
;
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
epnp
PnP
(
cameraMatrix
,
opoints
,
undistortedPoints
);
cv
::
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
PnP
.
compute_pose
(
R
,
tvec
);
cv
::
Rodrigues
(
R
,
rvec
);
Rodrigues
(
R
,
rvec
);
return
true
;
}
else
if
(
flags
==
SOLVEPNP_P3P
)
{
CV_Assert
(
npoints
==
4
);
cv
::
Mat
undistortedPoints
;
cv
::
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
Mat
undistortedPoints
;
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
p3p
P3Psolver
(
cameraMatrix
);
cv
::
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
bool
result
=
P3Psolver
.
solve
(
R
,
tvec
,
opoints
,
undistortedPoints
);
if
(
result
)
cv
::
Rodrigues
(
R
,
rvec
);
Rodrigues
(
R
,
rvec
);
return
result
;
}
else
if
(
flags
==
SOLVEPNP_ITERATIVE
)
...
...
@@ -95,32 +97,32 @@ bool cv::solvePnP( InputArray _opoints, InputArray _ipoints,
&
c_rvec
,
&
c_tvec
,
useExtrinsicGuess
);
return
true
;
}
else
if
(
flags
==
SOLVEPNP_DLS
)
/*
else if (flags == SOLVEPNP_DLS)
{
cv
::
Mat
undistortedPoints
;
cv
::
undistortPoints
(
ipoints
,
undistortedPoints
,
cameraMatrix
,
distCoeffs
);
Mat undistortedPoints;
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
dls PnP(opoints, undistortedPoints);
cv
::
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
Mat R, rvec = _rvec.getMat(), tvec = _tvec.getMat();
bool result = PnP.compute_pose(R, tvec);
if (result)
cv
::
Rodrigues
(
R
,
rvec
);
Rodrigues(R, rvec);
return result;
}
else if (flags == SOLVEPNP_UPNP)
{
upnp PnP(cameraMatrix, opoints, ipoints);
cv
::
Mat
R
,
rvec
=
_rvec
.
getMat
(),
tvec
=
_tvec
.
getMat
();
Mat R, rvec = _rvec.getMat(), tvec = _tvec.getMat();
double f = PnP.compute_pose(R, tvec);
cv
::
Rodrigues
(
R
,
rvec
);
Rodrigues(R, rvec);
if(cameraMatrix.type() == CV_32F)
cameraMatrix.at<float>(0,0) = cameraMatrix.at<float>(1,1) = (float)f;
else
cameraMatrix.at<double>(0,0) = cameraMatrix.at<double>(1,1) = f;
return true;
}
}
*/
else
CV_Error
(
CV_StsBadArg
,
"The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, SOLVEPNP_EPNP or SOLVEPNP_DLS"
);
return
false
;
...
...
@@ -131,7 +133,7 @@ class PnPRansacCallback : public PointSetRegistrator::Callback
public
:
PnPRansacCallback
(
Mat
_cameraMatrix
=
Mat
(
3
,
3
,
CV_64F
),
Mat
_distCoeffs
=
Mat
(
4
,
1
,
CV_64F
),
int
_flags
=
cv
::
SOLVEPNP_ITERATIVE
,
PnPRansacCallback
(
Mat
_cameraMatrix
=
Mat
(
3
,
3
,
CV_64F
),
Mat
_distCoeffs
=
Mat
(
4
,
1
,
CV_64F
),
int
_flags
=
SOLVEPNP_ITERATIVE
,
bool
_useExtrinsicGuess
=
false
,
Mat
_rvec
=
Mat
(),
Mat
_tvec
=
Mat
()
)
:
cameraMatrix
(
_cameraMatrix
),
distCoeffs
(
_distCoeffs
),
flags
(
_flags
),
useExtrinsicGuess
(
_useExtrinsicGuess
),
rvec
(
_rvec
),
tvec
(
_tvec
)
{}
...
...
@@ -142,12 +144,11 @@ public:
{
Mat
opoints
=
_m1
.
getMat
(),
ipoints
=
_m2
.
getMat
();
bool
correspondence
=
cv
::
solvePnP
(
_m1
,
_m2
,
cameraMatrix
,
distCoeffs
,
bool
correspondence
=
solvePnP
(
_m1
,
_m2
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
,
useExtrinsicGuess
,
flags
);
Mat
_local_model
;
cv
::
hconcat
(
rvec
,
tvec
,
_local_model
);
hconcat
(
rvec
,
tvec
,
_local_model
);
_local_model
.
copyTo
(
_model
);
return
correspondence
;
...
...
@@ -166,7 +167,7 @@ public:
Mat
projpoints
(
count
,
2
,
CV_32FC1
);
cv
::
projectPoints
(
opoints
,
_rvec
,
_tvec
,
cameraMatrix
,
distCoeffs
,
projpoints
);
projectPoints
(
opoints
,
_rvec
,
_tvec
,
cameraMatrix
,
distCoeffs
,
projpoints
);
const
Point2f
*
ipoints_ptr
=
ipoints
.
ptr
<
Point2f
>
();
const
Point2f
*
projpoints_ptr
=
projpoints
.
ptr
<
Point2f
>
();
...
...
@@ -175,7 +176,7 @@ public:
float
*
err
=
_err
.
getMat
().
ptr
<
float
>
();
for
(
i
=
0
;
i
<
count
;
++
i
)
err
[
i
]
=
(
float
)
cv
::
norm
(
ipoints_ptr
[
i
]
-
projpoints_ptr
[
i
]
);
err
[
i
]
=
(
float
)
norm
(
ipoints_ptr
[
i
]
-
projpoints_ptr
[
i
]
);
}
...
...
@@ -188,7 +189,7 @@ public:
Mat
tvec
;
};
bool
cv
::
solvePnPRansac
(
InputArray
_opoints
,
InputArray
_ipoints
,
bool
solvePnPRansac
(
InputArray
_opoints
,
InputArray
_ipoints
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
OutputArray
_rvec
,
OutputArray
_tvec
,
bool
useExtrinsicGuess
,
int
iterationsCount
,
float
reprojectionError
,
double
confidence
,
...
...
@@ -214,23 +215,45 @@ bool cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
Mat
tvec
=
useExtrinsicGuess
?
_tvec
.
getMat
()
:
Mat
(
3
,
1
,
CV_64FC1
);
Mat
cameraMatrix
=
_cameraMatrix
.
getMat
(),
distCoeffs
=
_distCoeffs
.
getMat
();
Ptr
<
PointSetRegistrator
::
Callback
>
cb
;
// pointer to callback
cb
=
makePtr
<
PnPRansacCallback
>
(
cameraMatrix
,
distCoeffs
,
flags
,
useExtrinsicGuess
,
rvec
,
tvec
)
;
int
model_points
=
5
;
int
ransac_kernel_method
=
SOLVEPNP_EPNP
;
int
model_points
=
4
;
// minimum of number of model points
if
(
flags
==
cv
::
SOLVEPNP_ITERATIVE
)
model_points
=
6
;
else
if
(
flags
==
cv
::
SOLVEPNP_UPNP
)
model_points
=
6
;
else
if
(
flags
==
cv
::
SOLVEPNP_EPNP
)
model_points
=
5
;
if
(
npoints
==
4
)
{
model_points
=
4
;
ransac_kernel_method
=
SOLVEPNP_P3P
;
}
Ptr
<
PointSetRegistrator
::
Callback
>
cb
;
// pointer to callback
cb
=
makePtr
<
PnPRansacCallback
>
(
cameraMatrix
,
distCoeffs
,
ransac_kernel_method
,
useExtrinsicGuess
,
rvec
,
tvec
);
double
param1
=
reprojectionError
;
// reprojection error
double
param2
=
confidence
;
// confidence
int
param3
=
iterationsCount
;
// number maximum iterations
cv
::
Mat
_local_model
(
3
,
2
,
CV_64FC1
);
cv
::
Mat
_mask_local_inliers
(
1
,
opoints
.
rows
,
CV_8UC1
);
Mat
_local_model
(
3
,
2
,
CV_64FC1
);
Mat
_mask_local_inliers
(
1
,
opoints
.
rows
,
CV_8UC1
);
// call Ransac
int
result
=
createRANSACPointSetRegistrator
(
cb
,
model_points
,
param1
,
param2
,
param3
)
->
run
(
opoints
,
ipoints
,
_local_model
,
_mask_local_inliers
);
int
result
=
createRANSACPointSetRegistrator
(
cb
,
model_points
,
param1
,
param2
,
param3
)
->
run
(
opoints
,
ipoints
,
_local_model
,
_mask_local_inliers
);
if
(
result
>
0
)
{
vector
<
Point3d
>
opoints_inliers
;
vector
<
Point2d
>
ipoints_inliers
;
opoints
.
convertTo
(
opoints_inliers
,
CV_64F
);
ipoints
.
convertTo
(
ipoints_inliers
,
CV_64F
);
const
uchar
*
mask
=
_mask_local_inliers
.
ptr
<
uchar
>
();
int
npoints1
=
compressElems
(
&
opoints_inliers
[
0
],
mask
,
1
,
npoints
);
compressElems
(
&
ipoints_inliers
[
0
],
mask
,
1
,
npoints
);
opoints_inliers
.
resize
(
npoints1
);
ipoints_inliers
.
resize
(
npoints1
);
result
=
solvePnP
(
opoints_inliers
,
ipoints_inliers
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
,
false
,
flags
==
SOLVEPNP_P3P
?
SOLVEPNP_EPNP
:
flags
)
?
1
:
-
1
;
}
if
(
result
<=
0
||
_local_model
.
rows
<=
0
)
{
...
...
@@ -260,3 +283,5 @@ bool cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
}
return
true
;
}
}
This diff is collapsed.
Click to expand it.
modules/core/include/opencv2/core/cvdef.h
View file @
8a1d8c84
...
...
@@ -480,16 +480,14 @@ CV_INLINE int cvRound( double value )
fistp
t
;
}
return
t
;
#elif
defined _MSC_VER && defined _M_ARM
&& defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND
(
value
);
#elif
((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || defined __GNUC__)
&& defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND
_DBL
(
value
);
#elif defined CV_ICC || defined __GNUC__
# ifdef HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND
(
value
);
# elif CV_VFP
# if CV_VFP
ARM_ROUND_DBL
(
value
)
#
else
# else
return
(
int
)
lrint
(
value
);
#
endif
# endif
#else
double
intpart
,
fractpart
;
fractpart
=
modf
(
value
,
&
intpart
);
...
...
@@ -505,7 +503,9 @@ CV_INLINE int cvRound( double value )
/** @overload */
CV_INLINE
int
cvRound
(
float
value
)
{
#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
#if defined ANDROID && (defined CV_ICC || defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND_FLT
(
value
);
#elif CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
ARM_ROUND_FLT
(
value
)
#else
return
cvRound
((
double
)
value
);
...
...
This diff is collapsed.
Click to expand it.
modules/core/perf/perf_cvround.cpp
0 → 100644
View file @
8a1d8c84
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
template
<
typename
T
>
static
void
CvRoundMat
(
const
cv
::
Mat
&
src
,
cv
::
Mat
&
dst
)
{
for
(
int
y
=
0
;
y
<
dst
.
rows
;
++
y
)
{
const
T
*
sptr
=
src
.
ptr
<
T
>
(
y
);
int
*
dptr
=
dst
.
ptr
<
int
>
(
y
);
for
(
int
x
=
0
;
x
<
dst
.
cols
;
++
x
)
dptr
[
x
]
=
cvRound
(
sptr
[
x
]);
}
}
PERF_TEST_P
(
Size_MatType
,
CvRound_Float
,
testing
::
Combine
(
testing
::
Values
(
TYPICAL_MAT_SIZES
),
testing
::
Values
(
CV_32FC1
,
CV_64FC1
)))
{
Size
size
=
get
<
0
>
(
GetParam
());
int
type
=
get
<
1
>
(
GetParam
()),
depth
=
CV_MAT_DEPTH
(
type
);
cv
::
Mat
src
(
size
,
type
),
dst
(
size
,
CV_32SC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
depth
==
CV_32F
)
{
TEST_CYCLE
()
CvRoundMat
<
float
>
(
src
,
dst
);
}
else
if
(
depth
==
CV_64F
)
{
TEST_CYCLE
()
CvRoundMat
<
double
>
(
src
,
dst
);
}
SANITY_CHECK_NOTHING
();
}
This diff is collapsed.
Click to expand it.
modules/core/src/lapack.cpp
View file @
8a1d8c84
...
...
@@ -725,11 +725,11 @@ template<typename T1, typename T2, typename T3> static void
MatrAXPY
(
int
m
,
int
n
,
const
T1
*
x
,
int
dx
,
const
T2
*
a
,
int
inca
,
T3
*
y
,
int
dy
)
{
int
i
,
j
;
int
i
;
for
(
i
=
0
;
i
<
m
;
i
++
,
x
+=
dx
,
y
+=
dy
)
{
T2
s
=
a
[
i
*
inca
];
j
=
0
;
int
j
=
0
;
#if CV_ENABLE_UNROLLED
for
(;
j
<=
n
-
4
;
j
+=
4
)
{
...
...
This diff is collapsed.
Click to expand it.
modules/imgproc/src/hough.cpp
View file @
8a1d8c84
...
...
@@ -90,11 +90,8 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
int
width
=
img
.
cols
;
int
height
=
img
.
rows
;
if
(
max_theta
<
0
||
max_theta
>
CV_PI
)
{
CV_Error
(
CV_StsBadArg
,
"max_theta must fall between 0 and pi"
);
}
if
(
min_theta
<
0
||
min_theta
>
max_theta
)
{
CV_Error
(
CV_StsBadArg
,
"min_theta must fall between 0 and max_theta"
);
if
(
max_theta
<
min_theta
)
{
CV_Error
(
CV_StsBadArg
,
"max_theta must be greater than min_theta"
);
}
int
numangle
=
cvRound
((
max_theta
-
min_theta
)
/
theta
);
int
numrho
=
cvRound
(((
width
+
height
)
*
2
+
1
)
/
rho
);
...
...
@@ -178,7 +175,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
int
n
=
cvFloor
(
idx
*
scale
)
-
1
;
int
r
=
idx
-
(
n
+
1
)
*
(
numrho
+
2
)
-
1
;
line
.
rho
=
(
r
-
(
numrho
-
1
)
*
0.5
f
)
*
rho
;
line
.
angle
=
n
*
theta
;
line
.
angle
=
static_cast
<
float
>
(
min_theta
)
+
n
*
theta
;
lines
.
push_back
(
Vec2f
(
line
.
rho
,
line
.
angle
));
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/java/CMakeLists.txt
View file @
8a1d8c84
...
...
@@ -318,12 +318,7 @@ else(ANDROID)
COMMENT
"Generating
${
JAR_NAME
}
"
)
if
(
WIN32
)
set
(
JAR_INSTALL_DIR java
)
else
(
WIN32
)
set
(
JAR_INSTALL_DIR share/OpenCV/java
)
endif
(
WIN32
)
install
(
FILES
${
JAR_FILE
}
OPTIONAL DESTINATION
${
JAR_INSTALL_DIR
}
COMPONENT java
)
install
(
FILES
${
JAR_FILE
}
OPTIONAL DESTINATION
${
OPENCV_JAR_INSTALL_PATH
}
COMPONENT java
)
endif
(
ANDROID
)
# step 5: build native part
...
...
@@ -398,12 +393,12 @@ if(ANDROID)
else
()
if
(
NOT INSTALL_CREATE_DISTRIB
)
ocv_install_target
(
${
the_module
}
OPTIONAL EXPORT OpenCVModules
RUNTIME DESTINATION
${
JAR_INSTALL_DIR
}
COMPONENT java
LIBRARY DESTINATION
${
JAR_INSTALL_DIR
}
COMPONENT java
)
RUNTIME DESTINATION
${
OPENCV_JAR_INSTALL_PATH
}
COMPONENT java
LIBRARY DESTINATION
${
OPENCV_JAR_INSTALL_PATH
}
COMPONENT java
)
else
()
ocv_install_target
(
${
the_module
}
OPTIONAL EXPORT OpenCVModules
RUNTIME DESTINATION
${
JAR_INSTALL_DIR
}
/
${
OpenCV_ARCH
}
COMPONENT java
LIBRARY DESTINATION
${
JAR_INSTALL_DIR
}
/
${
OpenCV_ARCH
}
COMPONENT java
)
RUNTIME DESTINATION
${
OPENCV_JAR_INSTALL_PATH
}
/
${
OpenCV_ARCH
}
COMPONENT java
LIBRARY DESTINATION
${
OPENCV_JAR_INSTALL_PATH
}
/
${
OpenCV_ARCH
}
COMPONENT java
)
endif
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
modules/java/generator/gen_java.py
View file @
8a1d8c84
...
...
@@ -75,7 +75,7 @@ const_ignore_list = (
"CV_CAP_PROP_CONVERT_RGB"
,
"CV_CAP_PROP_WHITE_BALANCE_BLUE_U"
,
"CV_CAP_PROP_RECTIFICATION"
,
"CV_CAP_PROP_MONOCROME"
,
"CV_CAP_PROP_MONOC
H
ROME"
,
"CV_CAP_PROP_SHARPNESS"
,
"CV_CAP_PROP_AUTO_EXPOSURE"
,
"CV_CAP_PROP_GAMMA"
,
...
...
This diff is collapsed.
Click to expand it.
modules/objdetect/src/cascadedetect.cpp
View file @
8a1d8c84
...
...
@@ -1268,7 +1268,7 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
scales
.
push_back
((
float
)
factor
);
}
if
(
!
featureEvaluator
->
setImage
(
gray
,
scales
)
)
if
(
scales
.
size
()
==
0
||
!
featureEvaluator
->
setImage
(
gray
,
scales
)
)
return
;
// OpenCL code
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/include/opencv2/videoio.hpp
View file @
8a1d8c84
...
...
@@ -110,8 +110,7 @@ enum { CAP_PROP_POS_MSEC =0,
CAP_PROP_CONVERT_RGB
=
16
,
CAP_PROP_WHITE_BALANCE_BLUE_U
=
17
,
CAP_PROP_RECTIFICATION
=
18
,
CAP_PROP_MONOCROME
=
19
,
CAP_PROP_MONOCHROME
=
CAP_PROP_MONOCROME
,
CAP_PROP_MONOCHROME
=
19
,
CAP_PROP_SHARPNESS
=
20
,
CAP_PROP_AUTO_EXPOSURE
=
21
,
// DC1394: exposure control done by camera, user can adjust refernce level using this feature
CAP_PROP_GAMMA
=
22
,
...
...
@@ -217,7 +216,8 @@ enum { CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast ma
CAP_PROP_PVAPI_DECIMATIONHORIZONTAL
=
302
,
// Horizontal sub-sampling of the image
CAP_PROP_PVAPI_DECIMATIONVERTICAL
=
303
,
// Vertical sub-sampling of the image
CAP_PROP_PVAPI_BINNINGX
=
304
,
// Horizontal binning factor
CAP_PROP_PVAPI_BINNINGY
=
305
// Vertical binning factor
CAP_PROP_PVAPI_BINNINGY
=
305
,
// Vertical binning factor
CAP_PROP_PVAPI_PIXELFORMAT
=
306
// Pixel format
};
// PVAPI: FrameStartTriggerMode
...
...
@@ -235,6 +235,17 @@ enum { CAP_PVAPI_DECIMATION_OFF = 1, // Off
CAP_PVAPI_DECIMATION_2OUTOF16
=
8
// 2 out of 16 decimation
};
// PVAPI: PixelFormat
enum
{
CAP_PVAPI_PIXELFORMAT_MONO8
=
1
,
// Mono8
CAP_PVAPI_PIXELFORMAT_MONO16
=
2
,
// Mono16
CAP_PVAPI_PIXELFORMAT_BAYER8
=
3
,
// Bayer8
CAP_PVAPI_PIXELFORMAT_BAYER16
=
4
,
// Bayer16
CAP_PVAPI_PIXELFORMAT_RGB24
=
5
,
// Rgb24
CAP_PVAPI_PIXELFORMAT_BGR24
=
6
,
// Bgr24
CAP_PVAPI_PIXELFORMAT_RGBA32
=
7
,
// Rgba32
CAP_PVAPI_PIXELFORMAT_BGRA32
=
8
,
// Bgra32
};
// Properties of cameras available through XIMEA SDK interface
enum
{
CAP_PROP_XI_DOWNSAMPLING
=
400
,
// Change image resolution by binning or skipping.
CAP_PROP_XI_DATA_FORMAT
=
401
,
// Output data format.
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/include/opencv2/videoio/videoio_c.h
View file @
8a1d8c84
...
...
@@ -160,7 +160,6 @@ enum
CV_CAP_PROP_CONVERT_RGB
=
16
,
CV_CAP_PROP_WHITE_BALANCE_BLUE_U
=
17
,
CV_CAP_PROP_RECTIFICATION
=
18
,
CV_CAP_PROP_MONOCROME
=
19
,
CV_CAP_PROP_MONOCHROME
=
19
,
CV_CAP_PROP_SHARPNESS
=
20
,
CV_CAP_PROP_AUTO_EXPOSURE
=
21
,
// exposure control done by camera,
...
...
@@ -227,6 +226,7 @@ enum
CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL
=
303
,
// Vertical sub-sampling of the image
CV_CAP_PROP_PVAPI_BINNINGX
=
304
,
// Horizontal binning factor
CV_CAP_PROP_PVAPI_BINNINGY
=
305
,
// Vertical binning factor
CV_CAP_PROP_PVAPI_PIXELFORMAT
=
306
,
// Pixel format
// Properties of cameras available through XIMEA SDK interface
CV_CAP_PROP_XI_DOWNSAMPLING
=
400
,
// Change image resolution by binning or skipping.
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/src/cap_dshow.cpp
View file @
8a1d8c84
...
...
@@ -2257,7 +2257,7 @@ int videoInput::getVideoPropertyFromCV(int cv_property){
case
CV_CAP_PROP_GAMMA
:
return
VideoProcAmp_Gamma
;
case
CV_CAP_PROP_MONOCROME
:
case
CV_CAP_PROP_MONOC
H
ROME
:
return
VideoProcAmp_ColorEnable
;
case
CV_CAP_PROP_WHITE_BALANCE_BLUE_U
:
...
...
@@ -3170,7 +3170,7 @@ double VideoCapture_DShow::getProperty(int propIdx) const
case
CV_CAP_PROP_SATURATION
:
case
CV_CAP_PROP_SHARPNESS
:
case
CV_CAP_PROP_GAMMA
:
case
CV_CAP_PROP_MONOCROME
:
case
CV_CAP_PROP_MONOC
H
ROME
:
case
CV_CAP_PROP_WHITE_BALANCE_BLUE_U
:
case
CV_CAP_PROP_BACKLIGHT
:
case
CV_CAP_PROP_GAIN
:
...
...
@@ -3273,7 +3273,7 @@ bool VideoCapture_DShow::setProperty(int propIdx, double propVal)
case
CV_CAP_PROP_SATURATION
:
case
CV_CAP_PROP_SHARPNESS
:
case
CV_CAP_PROP_GAMMA
:
case
CV_CAP_PROP_MONOCROME
:
case
CV_CAP_PROP_MONOC
H
ROME
:
case
CV_CAP_PROP_WHITE_BALANCE_BLUE_U
:
case
CV_CAP_PROP_BACKLIGHT
:
case
CV_CAP_PROP_GAIN
:
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/src/cap_pvapi.cpp
View file @
8a1d8c84
...
...
@@ -60,6 +60,7 @@
#ifdef WIN32
# include <io.h>
#else
# include <time.h>
# include <unistd.h>
#endif
...
...
@@ -106,18 +107,14 @@ protected:
}
tCamera
;
IplImage
*
frame
;
IplImage
*
grayframe
;
tCamera
Camera
;
tPvErr
Errcode
;
bool
monocrome
;
};
CvCaptureCAM_PvAPI
::
CvCaptureCAM_PvAPI
()
{
monocrome
=
false
;
frame
=
NULL
;
grayframe
=
NULL
;
memset
(
&
this
->
Camera
,
0
,
sizeof
(
this
->
Camera
));
}
...
...
@@ -190,13 +187,6 @@ bool CvCaptureCAM_PvAPI::open( int index )
tPvUint32
frameWidth
,
frameHeight
;
unsigned
long
maxSize
;
// By Default, try to set the pixel format to Mono8. This can be changed later
// via calls to setProperty. Some colour cameras (i.e. the Manta line) have a default
// image mode of Bayer8, which is currently unsupported, so Mono8 is a safe bet for
// startup.
monocrome
=
(
PvAttrEnumSet
(
Camera
.
Handle
,
"PixelFormat"
,
"Mono8"
)
==
ePvErrSuccess
);
PvAttrUint32Get
(
Camera
.
Handle
,
"Width"
,
&
frameWidth
);
PvAttrUint32Get
(
Camera
.
Handle
,
"Height"
,
&
frameHeight
);
...
...
@@ -229,15 +219,9 @@ bool CvCaptureCAM_PvAPI::grabFrame()
IplImage
*
CvCaptureCAM_PvAPI
::
retrieveFrame
(
int
)
{
if
(
PvCaptureWaitForFrameDone
(
Camera
.
Handle
,
&
(
Camera
.
Frame
),
1000
)
==
ePvErrSuccess
)
{
if
(
!
monocrome
)
{
cvMerge
(
grayframe
,
grayframe
,
grayframe
,
NULL
,
frame
);
return
frame
;
}
return
grayframe
;
return
frame
;
}
else
return
NULL
;
}
...
...
@@ -254,11 +238,6 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) const
case
CV_CAP_PROP_FRAME_HEIGHT
:
PvAttrUint32Get
(
Camera
.
Handle
,
"Height"
,
&
nTemp
);
return
(
double
)
nTemp
;
case
CV_CAP_PROP_MONOCROME
:
if
(
monocrome
)
return
1
;
else
return
0
;
case
CV_CAP_PROP_EXPOSURE
:
PvAttrUint32Get
(
Camera
.
Handle
,
"ExposureValue"
,
&
nTemp
);
return
(
double
)
nTemp
;
...
...
@@ -312,6 +291,25 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) const
case
CV_CAP_PROP_PVAPI_BINNINGY
:
PvAttrUint32Get
(
Camera
.
Handle
,
"BinningY"
,
&
nTemp
);
return
(
double
)
nTemp
;
case
CV_CAP_PROP_PVAPI_PIXELFORMAT
:
char
pixelFormat
[
256
];
PvAttrEnumGet
(
Camera
.
Handle
,
"PixelFormat"
,
pixelFormat
,
256
,
NULL
);
if
(
strcmp
(
pixelFormat
,
"Mono8"
)
==
0
)
return
1.0
;
else
if
(
strcmp
(
pixelFormat
,
"Mono16"
)
==
0
)
return
2.0
;
else
if
(
strcmp
(
pixelFormat
,
"Bayer8"
)
==
0
)
return
3.0
;
else
if
(
strcmp
(
pixelFormat
,
"Bayer16"
)
==
0
)
return
4.0
;
else
if
(
strcmp
(
pixelFormat
,
"Rgb24"
)
==
0
)
return
5.0
;
else
if
(
strcmp
(
pixelFormat
,
"Bgr24"
)
==
0
)
return
6.0
;
else
if
(
strcmp
(
pixelFormat
,
"Rgba32"
)
==
0
)
return
7.0
;
else
if
(
strcmp
(
pixelFormat
,
"Bgra32"
)
==
0
)
return
8.0
;
}
return
-
1.0
;
}
...
...
@@ -359,21 +357,6 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value )
break
;
}
case
CV_CAP_PROP_MONOCROME
:
if
(
value
==
1
)
{
char
pixelFormat
[
256
];
PvAttrEnumGet
(
Camera
.
Handle
,
"PixelFormat"
,
pixelFormat
,
256
,
NULL
);
if
((
strcmp
(
pixelFormat
,
"Mono8"
)
==
0
)
||
strcmp
(
pixelFormat
,
"Mono16"
)
==
0
)
{
monocrome
=
true
;
}
else
return
false
;
}
else
monocrome
=
false
;
break
;
case
CV_CAP_PROP_EXPOSURE
:
if
((
PvAttrUint32Set
(
Camera
.
Handle
,
"ExposureValue"
,(
tPvUint32
)
value
)
==
ePvErrSuccess
))
break
;
...
...
@@ -449,6 +432,51 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value )
break
;
else
return
false
;
case
CV_CAP_PROP_PVAPI_PIXELFORMAT
:
{
cv
::
String
pixelFormat
;
if
(
value
==
1
)
pixelFormat
=
"Mono8"
;
else
if
(
value
==
2
)
pixelFormat
=
"Mono16"
;
else
if
(
value
==
3
)
pixelFormat
=
"Bayer8"
;
else
if
(
value
==
4
)
pixelFormat
=
"Bayer16"
;
else
if
(
value
==
5
)
pixelFormat
=
"Rgb24"
;
else
if
(
value
==
6
)
pixelFormat
=
"Bgr24"
;
else
if
(
value
==
7
)
pixelFormat
=
"Rgba32"
;
else
if
(
value
==
8
)
pixelFormat
=
"Bgra32"
;
else
return
false
;
if
((
PvAttrEnumSet
(
Camera
.
Handle
,
"PixelFormat"
,
pixelFormat
.
c_str
())
==
ePvErrSuccess
))
{
tPvUint32
currWidth
;
tPvUint32
currHeight
;
PvAttrUint32Get
(
Camera
.
Handle
,
"Width"
,
&
currWidth
);
PvAttrUint32Get
(
Camera
.
Handle
,
"Height"
,
&
currHeight
);
stopCapture
();
// Reallocate Frames
if
(
!
resizeCaptureFrame
(
currWidth
,
currHeight
))
{
startCapture
();
return
false
;
}
startCapture
();
return
true
;
}
else
return
false
;
}
default
:
return
false
;
}
...
...
@@ -495,13 +523,6 @@ bool CvCaptureCAM_PvAPI::resizeCaptureFrame (int frameWidth, int frameHeight)
tPvUint32
sensorHeight
;
tPvUint32
sensorWidth
;
if
(
grayframe
)
{
cvReleaseImage
(
&
grayframe
);
grayframe
=
NULL
;
}
if
(
frame
)
{
cvReleaseImage
(
&
frame
);
...
...
@@ -544,31 +565,34 @@ bool CvCaptureCAM_PvAPI::resizeCaptureFrame (int frameWidth, int frameHeight)
PvAttrUint32Get
(
Camera
.
Handle
,
"TotalBytesPerFrame"
,
&
frameSize
);
if
(
strcmp
(
pixelFormat
,
"Mono8"
)
==
0
)
if
(
(
strcmp
(
pixelFormat
,
"Mono8"
)
==
0
)
||
(
strcmp
(
pixelFormat
,
"Bayer8"
)
==
0
)
)
{
grayframe
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_8U
,
1
);
grayframe
->
widthStep
=
(
int
)
frameWidth
;
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_8U
,
3
);
frame
->
widthStep
=
(
int
)
frameWidth
*
3
;
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_8U
,
1
);
frame
->
widthStep
=
(
int
)
frameWidth
;
Camera
.
Frame
.
ImageBufferSize
=
frameSize
;
Camera
.
Frame
.
ImageBuffer
=
gray
frame
->
imageData
;
Camera
.
Frame
.
ImageBuffer
=
frame
->
imageData
;
}
else
if
(
strcmp
(
pixelFormat
,
"Mono16"
)
==
0
)
else
if
(
(
strcmp
(
pixelFormat
,
"Mono16"
)
==
0
)
||
(
strcmp
(
pixelFormat
,
"Bayer16"
)
==
0
)
)
{
grayframe
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_16U
,
1
);
grayframe
->
widthStep
=
(
int
)
frameWidth
;
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_16U
,
3
);
frame
->
widthStep
=
(
int
)
frameWidth
*
3
;
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_16U
,
1
);
frame
->
widthStep
=
(
int
)
frameWidth
*
2
;
Camera
.
Frame
.
ImageBufferSize
=
frameSize
;
Camera
.
Frame
.
ImageBuffer
=
gray
frame
->
imageData
;
Camera
.
Frame
.
ImageBuffer
=
frame
->
imageData
;
}
else
if
(
strcmp
(
pixelFormat
,
"Bgr24"
)
==
0
)
else
if
(
(
strcmp
(
pixelFormat
,
"Rgb24"
)
==
0
)
||
(
strcmp
(
pixelFormat
,
"Bgr24"
)
==
0
)
)
{
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_8U
,
3
);
frame
->
widthStep
=
(
int
)
frameWidth
*
3
;
Camera
.
Frame
.
ImageBufferSize
=
frameSize
;
Camera
.
Frame
.
ImageBuffer
=
frame
->
imageData
;
}
else
if
(
(
strcmp
(
pixelFormat
,
"Rgba32"
)
==
0
)
||
(
strcmp
(
pixelFormat
,
"Bgra32"
)
==
0
)
)
{
frame
=
cvCreateImage
(
cvSize
((
int
)
frameWidth
,
(
int
)
frameHeight
),
IPL_DEPTH_8U
,
4
);
frame
->
widthStep
=
(
int
)
frameWidth
*
4
;
Camera
.
Frame
.
ImageBufferSize
=
frameSize
;
Camera
.
Frame
.
ImageBuffer
=
frame
->
imageData
;
}
else
return
false
;
...
...
This diff is collapsed.
Click to expand it.
platforms/winrt/setup_winrt.ps1
View file @
8a1d8c84
<#
Copyright Microsoft Open Technologies, Inc.
All Rights Reserved
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<#
Copyright (c) Microsoft Open Technologies, Inc.
All rights reserved.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
(3-clause BSD License)
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
See the Apache 2 License for the specific language governing permissions and limitations under the License.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#>
[
CmdletBinding
()]
...
...
This diff is collapsed.
Click to expand it.
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