Merge pull request #1318 from SpecLad:wow
This commit is contained in:
commit
43aec5ad4a
78
.gitattributes
vendored
78
.gitattributes
vendored
@ -1,42 +1,58 @@
|
||||
.git* export-ignore
|
||||
|
||||
* text=auto whitespace=trailing-space,space-before-tab,-indent-with-non-tab,tab-in-indent,tabwidth=4
|
||||
|
||||
*.py text
|
||||
*.cpp text
|
||||
*.hpp text
|
||||
*.cxx text
|
||||
*.hxx text
|
||||
*.mm text
|
||||
*.c text
|
||||
*.h text
|
||||
*.i text
|
||||
*.js text
|
||||
*.java text
|
||||
*.scala text
|
||||
*.cu text
|
||||
*.cl text
|
||||
*.css_t text
|
||||
*.qrc text
|
||||
*.qss text
|
||||
*.S text
|
||||
*.rst text
|
||||
*.tex text
|
||||
*.sty text
|
||||
.git* text export-ignore
|
||||
|
||||
*.aidl text
|
||||
*.mk text
|
||||
*.aidl text
|
||||
*.appxmanifest text
|
||||
*.bib text
|
||||
*.c text
|
||||
*.cl text
|
||||
*.conf text
|
||||
*.cpp text
|
||||
*.css_t text
|
||||
*.cu text
|
||||
*.cxx text
|
||||
*.def text
|
||||
*.filelist text
|
||||
*.h text
|
||||
*.hpp text
|
||||
*.htm text
|
||||
*.html text
|
||||
*.hxx text
|
||||
*.i text
|
||||
*.idl text
|
||||
*.java text
|
||||
*.js text
|
||||
*.mk text
|
||||
*.mm text
|
||||
*.plist text
|
||||
*.properties text
|
||||
*.py text
|
||||
*.qrc text
|
||||
*.qss text
|
||||
*.S text
|
||||
*.sbt text
|
||||
*.scala text
|
||||
*.sty text
|
||||
*.tex text
|
||||
*.txt text
|
||||
*.xaml text
|
||||
|
||||
# reST underlines/overlines can look like conflict markers
|
||||
*.rst text conflict-marker-size=80
|
||||
|
||||
*.cmake text whitespace=tabwidth=2
|
||||
*.cmakein text whitespace=tabwidth=2
|
||||
*.in text whitespace=tabwidth=2
|
||||
CMakeLists.txt text whitespace=tabwidth=2
|
||||
|
||||
*.png binary
|
||||
*.jpeg binary
|
||||
*.jpg binary
|
||||
*.avi binary
|
||||
*.bmp binary
|
||||
*.exr binary
|
||||
*.ico binary
|
||||
*.jpeg binary
|
||||
*.jpg binary
|
||||
*.png binary
|
||||
|
||||
*.a binary
|
||||
*.so binary
|
||||
@ -47,6 +63,7 @@ CMakeLists.txt text whitespace=tabwidth=2
|
||||
*.pbxproj binary
|
||||
*.vec binary
|
||||
*.doc binary
|
||||
*.dia binary
|
||||
|
||||
*.xml -text whitespace=cr-at-eol
|
||||
*.yml -text whitespace=cr-at-eol
|
||||
@ -55,9 +72,12 @@ CMakeLists.txt text whitespace=tabwidth=2
|
||||
.cproject -text whitespace=cr-at-eol merge=union
|
||||
org.eclipse.jdt.core.prefs -text whitespace=cr-at-eol merge=union
|
||||
|
||||
*.vcproj text eol=crlf merge=union
|
||||
*.bat text eol=crlf
|
||||
*.cmd text eol=crlf
|
||||
*.cmd.tmpl text eol=crlf
|
||||
*.dsp text eol=crlf -whitespace
|
||||
*.sln text eol=crlf -whitespace
|
||||
*.vcproj text eol=crlf -whitespace merge=union
|
||||
*.vcxproj text eol=crlf -whitespace merge=union
|
||||
|
||||
*.sh text eol=lf
|
1
3rdparty/.gitattributes
vendored
Normal file
1
3rdparty/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* -whitespace
|
2
3rdparty/ffmpeg/readme.txt
vendored
2
3rdparty/ffmpeg/readme.txt
vendored
@ -40,5 +40,3 @@ How to update opencv_ffmpeg.dll and opencv_ffmpeg_64.dll when a new version of F
|
||||
|
||||
8. Then, go to <opencv>\3rdparty\ffmpeg, edit make.bat
|
||||
(change paths to the actual paths to your msys32 and msys64 distributions) and then run make.bat
|
||||
|
||||
|
||||
|
1
3rdparty/libjasper/CMakeLists.txt
vendored
1
3rdparty/libjasper/CMakeLists.txt
vendored
@ -48,4 +48,3 @@ endif()
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
endif()
|
||||
|
||||
|
1
3rdparty/libtiff/tif_config.h.cmakein
vendored
1
3rdparty/libtiff/tif_config.h.cmakein
vendored
@ -168,4 +168,3 @@
|
||||
|
||||
/* Support Deflate compression */
|
||||
#define ZIP_SUPPORT 1
|
||||
|
||||
|
@ -891,4 +891,3 @@ ocv_finalize_status()
|
||||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
|
||||
endif()
|
||||
|
||||
|
@ -79,4 +79,3 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(opencv_haartraining PROPERTIES FOLDER "applications")
|
||||
set_target_properties(opencv_haartraining_engine PROPERTIES FOLDER "applications")
|
||||
endif()
|
||||
|
||||
|
@ -100,4 +100,3 @@ int icvGetIdxAt( CvMat* idx, int pos )
|
||||
void icvSave( const CvArr* ptr, const char* filename, int line );
|
||||
|
||||
#endif /* __CVCOMMON_H_ */
|
||||
|
||||
|
@ -376,4 +376,3 @@ int main( int argc, char* argv[] )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,3 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main)
|
||||
|
||||
|
@ -98,4 +98,3 @@ if(NOT BUILD_WITH_DEBUG_INFO AND NOT MSVC)
|
||||
string(REPLACE "/Zi" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
|
@ -156,4 +156,3 @@ else()
|
||||
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||
set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
|
@ -22,4 +22,3 @@ if(DEFINED OPENCV_BUILD_3RDPARTY_LIBS)
|
||||
set(BUILD_PNG ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
|
||||
unset(OPENCV_BUILD_3RDPARTY_LIBS CACHE)
|
||||
endif()
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/,
|
||||
0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/,
|
||||
NULL /*hInstance*/, NULL /*lpParam*/);
|
||||
DeleteDC(NULL);
|
||||
CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/,
|
||||
0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/,
|
||||
NULL /*hInstance*/, NULL /*lpParam*/);
|
||||
DeleteDC(NULL);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
@ -23,5 +23,3 @@ FOREACH(file ${files})
|
||||
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
ENDFOREACH(file)
|
||||
|
||||
|
||||
|
@ -163,4 +163,3 @@
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
|
1
doc/_static/insertIframe.js
vendored
1
doc/_static/insertIframe.js
vendored
@ -10,4 +10,3 @@ function insertIframe (elementId, iframeSrc)
|
||||
element.parentNode.replaceChild(iframe, element);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,5 +184,3 @@ p = RSTParser()
|
||||
for m in opencv_module_list:
|
||||
print "\n\n*************************** " + m + " *************************\n"
|
||||
p.check_module_docs(m)
|
||||
|
||||
|
||||
|
@ -39,4 +39,3 @@
|
||||
#7 & #8 & #9
|
||||
\end{bmatrix}
|
||||
}
|
||||
|
||||
|
@ -75,11 +75,11 @@
|
||||
% if using A4 paper. (This probably isn't strictly necessary.)
|
||||
% If using another size paper, use default 1cm margins.
|
||||
\ifthenelse{\lengthtest { \paperwidth = 11in}}
|
||||
{ \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
|
||||
{\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
|
||||
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
|
||||
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
|
||||
}
|
||||
{ \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
|
||||
{\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
|
||||
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
|
||||
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
|
||||
}
|
||||
|
||||
% Turn off header and footer
|
||||
% \pagestyle{empty}
|
||||
|
@ -3667,4 +3667,3 @@ class YErrorBars:
|
||||
output.append(LineAxis(x, start, x, end, start, end, bars, False, False, **self.attr).SVG(trans))
|
||||
|
||||
return output
|
||||
|
||||
|
@ -99,11 +99,11 @@ Explanation
|
||||
|
||||
/// 2.b. Creating rectangles
|
||||
rectangle( rook_image,
|
||||
Point( 0, 7*w/8.0 ),
|
||||
Point( w, w),
|
||||
Scalar( 0, 255, 255 ),
|
||||
-1,
|
||||
8 );
|
||||
Point( 0, 7*w/8.0 ),
|
||||
Point( w, w),
|
||||
Scalar( 0, 255, 255 ),
|
||||
-1,
|
||||
8 );
|
||||
|
||||
/// 2.c. Create a few lines
|
||||
MyLine( rook_image, Point( 0, 15*w/16 ), Point( w, 15*w/16 ) );
|
||||
@ -118,16 +118,16 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
void MyLine( Mat img, Point start, Point end )
|
||||
{
|
||||
int thickness = 2;
|
||||
int lineType = 8;
|
||||
line( img,
|
||||
start,
|
||||
end,
|
||||
Scalar( 0, 0, 0 ),
|
||||
thickness,
|
||||
lineType );
|
||||
}
|
||||
{
|
||||
int thickness = 2;
|
||||
int lineType = 8;
|
||||
line( img,
|
||||
start,
|
||||
end,
|
||||
Scalar( 0, 0, 0 ),
|
||||
thickness,
|
||||
lineType );
|
||||
}
|
||||
|
||||
As we can see, *MyLine* just call the function :line:`line <>`, which does the following:
|
||||
|
||||
@ -145,18 +145,18 @@ Explanation
|
||||
|
||||
void MyEllipse( Mat img, double angle )
|
||||
{
|
||||
int thickness = 2;
|
||||
int lineType = 8;
|
||||
int thickness = 2;
|
||||
int lineType = 8;
|
||||
|
||||
ellipse( img,
|
||||
Point( w/2.0, w/2.0 ),
|
||||
Size( w/4.0, w/16.0 ),
|
||||
angle,
|
||||
0,
|
||||
360,
|
||||
Scalar( 255, 0, 0 ),
|
||||
thickness,
|
||||
lineType );
|
||||
ellipse( img,
|
||||
Point( w/2.0, w/2.0 ),
|
||||
Size( w/4.0, w/16.0 ),
|
||||
angle,
|
||||
0,
|
||||
360,
|
||||
Scalar( 255, 0, 0 ),
|
||||
thickness,
|
||||
lineType );
|
||||
}
|
||||
|
||||
From the code above, we can observe that the function :ellipse:`ellipse <>` draws an ellipse such that:
|
||||
@ -176,17 +176,17 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
void MyFilledCircle( Mat img, Point center )
|
||||
{
|
||||
int thickness = -1;
|
||||
int lineType = 8;
|
||||
{
|
||||
int thickness = -1;
|
||||
int lineType = 8;
|
||||
|
||||
circle( img,
|
||||
center,
|
||||
w/32.0,
|
||||
Scalar( 0, 0, 255 ),
|
||||
thickness,
|
||||
lineType );
|
||||
}
|
||||
circle( img,
|
||||
center,
|
||||
w/32.0,
|
||||
Scalar( 0, 0, 255 ),
|
||||
thickness,
|
||||
lineType );
|
||||
}
|
||||
|
||||
Similar to the ellipse function, we can observe that *circle* receives as arguments:
|
||||
|
||||
@ -203,41 +203,41 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
void MyPolygon( Mat img )
|
||||
{
|
||||
int lineType = 8;
|
||||
{
|
||||
int lineType = 8;
|
||||
|
||||
/** Create some points */
|
||||
Point rook_points[1][20];
|
||||
rook_points[0][0] = Point( w/4.0, 7*w/8.0 );
|
||||
rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 );
|
||||
rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 );
|
||||
rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 );
|
||||
rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 );
|
||||
rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 );
|
||||
rook_points[0][6] = Point( 3*w/4.0, w/8.0 );
|
||||
rook_points[0][7] = Point( 26*w/40.0, w/8.0 );
|
||||
rook_points[0][8] = Point( 26*w/40.0, w/4.0 );
|
||||
rook_points[0][9] = Point( 22*w/40.0, w/4.0 );
|
||||
rook_points[0][10] = Point( 22*w/40.0, w/8.0 );
|
||||
rook_points[0][11] = Point( 18*w/40.0, w/8.0 );
|
||||
rook_points[0][12] = Point( 18*w/40.0, w/4.0 );
|
||||
rook_points[0][13] = Point( 14*w/40.0, w/4.0 );
|
||||
rook_points[0][14] = Point( 14*w/40.0, w/8.0 );
|
||||
rook_points[0][15] = Point( w/4.0, w/8.0 );
|
||||
rook_points[0][16] = Point( w/4.0, 3*w/8.0 );
|
||||
rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 );
|
||||
rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 );
|
||||
rook_points[0][19] = Point( w/4.0, 13*w/16.0) ;
|
||||
/** Create some points */
|
||||
Point rook_points[1][20];
|
||||
rook_points[0][0] = Point( w/4.0, 7*w/8.0 );
|
||||
rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 );
|
||||
rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 );
|
||||
rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 );
|
||||
rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 );
|
||||
rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 );
|
||||
rook_points[0][6] = Point( 3*w/4.0, w/8.0 );
|
||||
rook_points[0][7] = Point( 26*w/40.0, w/8.0 );
|
||||
rook_points[0][8] = Point( 26*w/40.0, w/4.0 );
|
||||
rook_points[0][9] = Point( 22*w/40.0, w/4.0 );
|
||||
rook_points[0][10] = Point( 22*w/40.0, w/8.0 );
|
||||
rook_points[0][11] = Point( 18*w/40.0, w/8.0 );
|
||||
rook_points[0][12] = Point( 18*w/40.0, w/4.0 );
|
||||
rook_points[0][13] = Point( 14*w/40.0, w/4.0 );
|
||||
rook_points[0][14] = Point( 14*w/40.0, w/8.0 );
|
||||
rook_points[0][15] = Point( w/4.0, w/8.0 );
|
||||
rook_points[0][16] = Point( w/4.0, 3*w/8.0 );
|
||||
rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 );
|
||||
rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 );
|
||||
rook_points[0][19] = Point( w/4.0, 13*w/16.0) ;
|
||||
|
||||
const Point* ppt[1] = { rook_points[0] };
|
||||
int npt[] = { 20 };
|
||||
const Point* ppt[1] = { rook_points[0] };
|
||||
int npt[] = { 20 };
|
||||
|
||||
fillPoly( img,
|
||||
ppt,
|
||||
npt,
|
||||
1,
|
||||
Scalar( 255, 255, 255 ),
|
||||
lineType );
|
||||
fillPoly( img,
|
||||
ppt,
|
||||
npt,
|
||||
1,
|
||||
Scalar( 255, 255, 255 ),
|
||||
lineType );
|
||||
}
|
||||
|
||||
To draw a filled polygon we use the function :fill_poly:`fillPoly <>`. We note that:
|
||||
@ -255,11 +255,11 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
rectangle( rook_image,
|
||||
Point( 0, 7*w/8.0 ),
|
||||
Point( w, w),
|
||||
Scalar( 0, 255, 255 ),
|
||||
-1,
|
||||
8 );
|
||||
Point( 0, 7*w/8.0 ),
|
||||
Point( w, w),
|
||||
Scalar( 0, 255, 255 ),
|
||||
-1,
|
||||
8 );
|
||||
|
||||
Finally we have the :rectangle:`rectangle <>` function (we did not create a special function for this guy). We note that:
|
||||
|
||||
|
@ -277,4 +277,3 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
<div align="center">
|
||||
<iframe title="File Input and Output using XML and YAML files in OpenCV" width="560" height="349" src="http://www.youtube.com/embed/A4yqVnByMMM?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
|
@ -127,6 +127,3 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
<div align="center">
|
||||
<iframe title="Interoperability with OpenCV 1" width="560" height="349" src="http://www.youtube.com/embed/qckm-zvo31w?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
@ -100,6 +100,3 @@ Result
|
||||
.. image:: images/Feature_Description_BruteForce_Result.jpg
|
||||
:align: center
|
||||
:height: 200pt
|
||||
|
||||
|
||||
|
||||
|
@ -95,4 +95,3 @@ Result
|
||||
.. image:: images/Feature_Detection_Result_b.jpg
|
||||
:align: center
|
||||
:height: 200pt
|
||||
|
||||
|
@ -146,4 +146,3 @@ Result
|
||||
.. image:: images/Feature_Homography_Result.jpg
|
||||
:align: center
|
||||
:height: 200pt
|
||||
|
||||
|
@ -201,4 +201,3 @@ Learn about how to use the feature points detectors, descriptors and matching f
|
||||
../feature_flann_matcher/feature_flann_matcher
|
||||
../feature_homography/feature_homography
|
||||
../detection_of_planar_objects/detection_of_planar_objects
|
||||
|
||||
|
@ -87,14 +87,14 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
|
||||
/// Apply corner detection
|
||||
goodFeaturesToTrack( src_gray,
|
||||
corners,
|
||||
maxCorners,
|
||||
qualityLevel,
|
||||
minDistance,
|
||||
Mat(),
|
||||
blockSize,
|
||||
useHarrisDetector,
|
||||
k );
|
||||
corners,
|
||||
maxCorners,
|
||||
qualityLevel,
|
||||
minDistance,
|
||||
Mat(),
|
||||
blockSize,
|
||||
useHarrisDetector,
|
||||
k );
|
||||
|
||||
|
||||
/// Draw corners detected
|
||||
@ -135,4 +135,3 @@ Here is the result:
|
||||
|
||||
.. image:: images/Corner_Subpixeles_Result.jpg
|
||||
:align: center
|
||||
|
||||
|
@ -37,4 +37,3 @@ Result
|
||||
|
||||
.. image:: images/My_Shi_Tomasi_corner_detector_Result.jpg
|
||||
:align: center
|
||||
|
||||
|
@ -118,5 +118,3 @@ Result
|
||||
|
||||
.. image:: images/Feature_Detection_Result_a.jpg
|
||||
:align: center
|
||||
|
||||
|
||||
|
@ -98,16 +98,16 @@ How does it work?
|
||||
u & v
|
||||
\end{bmatrix}
|
||||
\left (
|
||||
\displaystyle \sum_{x,y}
|
||||
\displaystyle \sum_{x,y}
|
||||
w(x,y)
|
||||
\begin{bmatrix}
|
||||
I_x^{2} & I_{x}I_{y} \\
|
||||
I_xI_{y} & I_{y}^{2}
|
||||
\end{bmatrix}
|
||||
\right )
|
||||
\begin{bmatrix}
|
||||
\end{bmatrix}
|
||||
\right )
|
||||
\begin{bmatrix}
|
||||
u \\
|
||||
v
|
||||
v
|
||||
\end{bmatrix}
|
||||
|
||||
* Let's denote:
|
||||
@ -115,11 +115,11 @@ How does it work?
|
||||
.. math::
|
||||
|
||||
M = \displaystyle \sum_{x,y}
|
||||
w(x,y)
|
||||
\begin{bmatrix}
|
||||
I_x^{2} & I_{x}I_{y} \\
|
||||
I_xI_{y} & I_{y}^{2}
|
||||
\end{bmatrix}
|
||||
w(x,y)
|
||||
\begin{bmatrix}
|
||||
I_x^{2} & I_{x}I_{y} \\
|
||||
I_xI_{y} & I_{y}^{2}
|
||||
\end{bmatrix}
|
||||
|
||||
* So, our equation now is:
|
||||
|
||||
@ -128,10 +128,10 @@ How does it work?
|
||||
E(u,v) \approx \begin{bmatrix}
|
||||
u & v
|
||||
\end{bmatrix}
|
||||
M
|
||||
\begin{bmatrix}
|
||||
M
|
||||
\begin{bmatrix}
|
||||
u \\
|
||||
v
|
||||
v
|
||||
\end{bmatrix}
|
||||
|
||||
|
||||
@ -243,5 +243,3 @@ The detected corners are surrounded by a small black circle
|
||||
|
||||
.. image:: images/Harris_Detector_Result.jpg
|
||||
:align: center
|
||||
|
||||
|
||||
|
@ -10,4 +10,3 @@ These tutorials are the bottom of the iceberg as they link together multiple of
|
||||
.. raw:: latex
|
||||
|
||||
\pagebreak
|
||||
|
||||
|
@ -154,8 +154,3 @@ Result
|
||||
.. image:: images/Adding_Trackbars_Tutorial_Result_1.jpg
|
||||
:alt: Adding Trackbars - Lena
|
||||
:align: center
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -112,21 +112,21 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
|
||||
/// Create Erosion Trackbar
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Erosion Demo",
|
||||
&erosion_elem, max_elem,
|
||||
Erosion );
|
||||
&erosion_elem, max_elem,
|
||||
Erosion );
|
||||
|
||||
createTrackbar( "Kernel size:\n 2n +1", "Erosion Demo",
|
||||
&erosion_size, max_kernel_size,
|
||||
Erosion );
|
||||
&erosion_size, max_kernel_size,
|
||||
Erosion );
|
||||
|
||||
/// Create Dilation Trackbar
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Dilation Demo",
|
||||
&dilation_elem, max_elem,
|
||||
Dilation );
|
||||
&dilation_elem, max_elem,
|
||||
Dilation );
|
||||
|
||||
createTrackbar( "Kernel size:\n 2n +1", "Dilation Demo",
|
||||
&dilation_size, max_kernel_size,
|
||||
Dilation );
|
||||
&dilation_size, max_kernel_size,
|
||||
Dilation );
|
||||
|
||||
/// Default start
|
||||
Erosion( 0, 0 );
|
||||
@ -145,8 +145,8 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; }
|
||||
|
||||
Mat element = getStructuringElement( erosion_type,
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
|
||||
/// Apply the erosion operation
|
||||
erode( src, erosion_dst, element );
|
||||
@ -162,8 +162,8 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; }
|
||||
|
||||
Mat element = getStructuringElement( dilation_type,
|
||||
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
|
||||
Point( dilation_size, dilation_size ) );
|
||||
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
|
||||
Point( dilation_size, dilation_size ) );
|
||||
/// Apply the dilation operation
|
||||
dilate( src, dilation_dst, element );
|
||||
imshow( "Dilation Demo", dilation_dst );
|
||||
@ -201,8 +201,8 @@ Explanation
|
||||
else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; }
|
||||
|
||||
Mat element = getStructuringElement( erosion_type,
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
/// Apply the erosion operation
|
||||
erode( src, erosion_dst, element );
|
||||
imshow( "Erosion Demo", erosion_dst );
|
||||
@ -216,17 +216,17 @@ Explanation
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
Mat element = getStructuringElement( erosion_type,
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
Mat element = getStructuringElement( erosion_type,
|
||||
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
|
||||
Point( erosion_size, erosion_size ) );
|
||||
|
||||
We can choose any of three shapes for our kernel:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
+ Rectangular box: MORPH_RECT
|
||||
+ Cross: MORPH_CROSS
|
||||
+ Ellipse: MORPH_ELLIPSE
|
||||
+ Rectangular box: MORPH_RECT
|
||||
+ Cross: MORPH_CROSS
|
||||
+ Ellipse: MORPH_ELLIPSE
|
||||
|
||||
Then, we just have to specify the size of our kernel and the *anchor point*. If not specified, it is assumed to be in the center.
|
||||
|
||||
@ -251,8 +251,8 @@ The code is below. As you can see, it is completely similar to the snippet of co
|
||||
else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; }
|
||||
|
||||
Mat element = getStructuringElement( dilation_type,
|
||||
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
|
||||
Point( dilation_size, dilation_size ) );
|
||||
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
|
||||
Point( dilation_size, dilation_size ) );
|
||||
/// Apply the dilation operation
|
||||
dilate( src, dilation_dst, element );
|
||||
imshow( "Dilation Demo", dilation_dst );
|
||||
|
@ -94,7 +94,7 @@ Code
|
||||
* Loads an image
|
||||
* Convert the original to HSV format and separate only *Hue* channel to be used for the Histogram (using the OpenCV function :mix_channels:`mixChannels <>`)
|
||||
* Let the user to enter the number of bins to be used in the calculation of the histogram.
|
||||
* Calculate the histogram (and update it if the bins change) and the backprojection of the same image.
|
||||
* Calculate the histogram (and update it if the bins change) and the backprojection of the same image.
|
||||
* Display the backprojection and the histogram in windows.
|
||||
|
||||
* **Downloadable code**:
|
||||
|
@ -329,4 +329,3 @@ Result
|
||||
|
||||
.. image:: images/Histogram_Calculation_Result.jpg
|
||||
:align: center
|
||||
|
||||
|
@ -369,4 +369,3 @@ Results
|
||||
|
||||
.. image:: images/Template_Matching_Image_Result.jpg
|
||||
:align: center
|
||||
|
||||
|
@ -282,6 +282,3 @@ Result
|
||||
:align: center
|
||||
|
||||
* Notice how the image is superposed to the black background on the edge regions.
|
||||
|
||||
|
||||
|
||||
|
@ -290,4 +290,3 @@ We get the following result by using the Probabilistic Hough Line Transform:
|
||||
:align: center
|
||||
|
||||
You may observe that the number of lines detected vary while you change the *threshold*. The explanation is sort of evident: If you establish a higher threshold, fewer lines will be detected (since you will need more points to declare a line detected).
|
||||
|
||||
|
@ -124,34 +124,34 @@ Code
|
||||
|
||||
for( int j = 0; j < src.rows; j++ )
|
||||
{ for( int i = 0; i < src.cols; i++ )
|
||||
{
|
||||
{
|
||||
switch( ind )
|
||||
{
|
||||
case 0:
|
||||
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
|
||||
{
|
||||
case 0:
|
||||
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
|
||||
{
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
|
||||
}
|
||||
else
|
||||
{ map_x.at<float>(j,i) = 0 ;
|
||||
map_y.at<float>(j,i) = 0 ;
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
|
||||
}
|
||||
else
|
||||
{ map_x.at<float>(j,i) = 0 ;
|
||||
map_y.at<float>(j,i) = 0 ;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
map_x.at<float>(j,i) = i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
case 1:
|
||||
map_x.at<float>(j,i) = i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
case 2:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = j ;
|
||||
break;
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = j ;
|
||||
break;
|
||||
case 3:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
} // end of switch
|
||||
}
|
||||
}
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
@ -241,34 +241,34 @@ Explanation
|
||||
|
||||
for( int j = 0; j < src.rows; j++ )
|
||||
{ for( int i = 0; i < src.cols; i++ )
|
||||
{
|
||||
{
|
||||
switch( ind )
|
||||
{
|
||||
case 0:
|
||||
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
|
||||
{
|
||||
case 0:
|
||||
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
|
||||
{
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
|
||||
}
|
||||
else
|
||||
{ map_x.at<float>(j,i) = 0 ;
|
||||
map_y.at<float>(j,i) = 0 ;
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
|
||||
}
|
||||
else
|
||||
{ map_x.at<float>(j,i) = 0 ;
|
||||
map_y.at<float>(j,i) = 0 ;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
map_x.at<float>(j,i) = i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
case 1:
|
||||
map_x.at<float>(j,i) = i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
case 2:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = j ;
|
||||
break;
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = j ;
|
||||
break;
|
||||
case 3:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
break;
|
||||
} // end of switch
|
||||
}
|
||||
}
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
@ -311,4 +311,3 @@ Result
|
||||
:alt: Result 0 for remapping
|
||||
:width: 250pt
|
||||
:align: center
|
||||
|
||||
|
@ -306,4 +306,3 @@ Result
|
||||
:alt: Original image
|
||||
:width: 250pt
|
||||
:align: center
|
||||
|
||||
|
@ -154,13 +154,13 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
|
||||
/// Create Trackbar to select kernel type
|
||||
createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name,
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
|
||||
/// Create Trackbar to choose kernel size
|
||||
createTrackbar( "Kernel size:\n 2n +1", window_name,
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
|
||||
/// Default start
|
||||
Morphology_Operations( 0, 0 );
|
||||
@ -211,16 +211,16 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name,
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
|
||||
* The final trackbar **"Kernel Size"** returns the size of the kernel to be used (**morph_size**)
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
createTrackbar( "Kernel size:\n 2n +1", window_name,
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
|
||||
|
||||
* Every time we move any slider, the user's function **Morphology_Operations** will be called to effectuate a new morphology operation and it will update the output image based on the current trackbar values.
|
||||
@ -279,4 +279,3 @@ Results
|
||||
.. image:: images/Morphology_2_Tutorial_Cover.jpg
|
||||
:alt: Morphology 2: Result sample
|
||||
:align: center
|
||||
|
||||
|
@ -259,5 +259,3 @@ Results
|
||||
.. image:: images/Pyramids_Tutorial_PyrUp_Result.jpg
|
||||
:alt: Pyramids: PyrUp Result
|
||||
:align: center
|
||||
|
||||
|
||||
|
@ -121,4 +121,3 @@ Result
|
||||
|
||||
.. |BRC_1| image:: images/Bounding_Rects_Circles_Result.jpg
|
||||
:align: middle
|
||||
|
||||
|
@ -123,4 +123,3 @@ Result
|
||||
|
||||
.. |BRE_1| image:: images/Bounding_Rotated_Ellipses_Result.jpg
|
||||
:align: middle
|
||||
|
||||
|
@ -104,4 +104,3 @@ Result
|
||||
|
||||
.. |contour_1| image:: images/Find_Contours_Result.jpg
|
||||
:align: middle
|
||||
|
||||
|
@ -113,4 +113,3 @@ Result
|
||||
|
||||
.. |Hull_1| image:: images/Hull_Result.jpg
|
||||
:align: middle
|
||||
|
||||
|
@ -133,4 +133,3 @@ Result
|
||||
.. |MU_2| image:: images/Moments_Result2.jpg
|
||||
:width: 250pt
|
||||
:align: middle
|
||||
|
||||
|
@ -114,4 +114,3 @@ Result
|
||||
|
||||
.. |PPT_1| image:: images/Point_Polygon_Test_Result.jpg
|
||||
:align: middle
|
||||
|
||||
|
@ -539,6 +539,3 @@ In this section you will learn about the image processing (manipulation) functio
|
||||
../shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses
|
||||
../shapedescriptors/moments/moments
|
||||
../shapedescriptors/point_polygon_test/point_polygon_test
|
||||
|
||||
|
||||
|
||||
|
@ -174,12 +174,12 @@ The tutorial code's is shown lines below. You can also download it from `here <h
|
||||
|
||||
/// Create Trackbar to choose type of Threshold
|
||||
createTrackbar( trackbar_type,
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
|
||||
createTrackbar( trackbar_value,
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
|
||||
/// Call the function to initialize
|
||||
Threshold_Demo( 0, 0 );
|
||||
@ -190,7 +190,7 @@ The tutorial code's is shown lines below. You can also download it from `here <h
|
||||
int c;
|
||||
c = waitKey( 20 );
|
||||
if( (char)c == 27 )
|
||||
{ break; }
|
||||
{ break; }
|
||||
}
|
||||
|
||||
}
|
||||
@ -245,12 +245,12 @@ Explanation
|
||||
.. code-block:: cpp
|
||||
|
||||
createTrackbar( trackbar_type,
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
|
||||
createTrackbar( trackbar_value,
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
|
||||
* Wait until the user enters the threshold value, the type of thresholding (or until the program exits)
|
||||
|
||||
|
@ -253,6 +253,3 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
|
||||
a. You can also optionally modify the ``Build command:`` from ``make`` to something like ``make VERBOSE=1 -j4`` which tells the compiler to produce detailed symbol files for debugging and also to compile in 4 parallel threads.
|
||||
|
||||
#. Done!
|
||||
|
||||
|
||||
|
||||
|
@ -80,4 +80,3 @@ Building OpenCV from Source Using CMake, Using the Command Line
|
||||
.. note::
|
||||
|
||||
If the size of the created library is a critical issue (like in case of an Android build) you can use the ``install/strip`` command to get the smallest size as possible. The *stripped* version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.
|
||||
|
||||
|
@ -97,14 +97,14 @@ Now you can inspect the state of you program. For example, you can bring up the
|
||||
Note that the built-in *Locals* window will display text only. This is where the Image Watch plug-in comes in. Image Watch is like another *Locals* window, but with an image viewer built into it. To bring up Image Watch, select :menuselection:`View --> Other Windows --> Image Watch`. Like Visual Studio's *Locals* window, Image Watch can dock to the Visual Studio IDE. Also, Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions. This means you only have to do this once--the next time you start debugging, Image Watch will be back where you left it. Here's what the docked Image Watch window looks like at our breakpoint:
|
||||
|
||||
.. image:: images/toolwindow.jpg
|
||||
:height: 320pt
|
||||
:height: 320pt
|
||||
|
||||
The radio button at the top left (*Locals/Watch*) selects what is shown in the *Image List* below: *Locals* lists all OpenCV image objects in the current scope (this list is automatically populated). *Watch* shows image expressions that have been pinned for continuous inspection (not described here, see `Image Watch documentation <http://go.microsoft.com/fwlink/?LinkId=285461>`_ for details). The image list shows basic information such as width, height, number of channels, and, if available, a thumbnail. In our example, the image list contains our two local image variables, *input* and *edges*.
|
||||
|
||||
If an image has a thumbnail, left-clicking on that image will select it for detailed viewing in the *Image Viewer* on the right. The viewer lets you pan (drag mouse) and zoom (mouse wheel). It also displays the pixel coordinate and value at the current mouse position.
|
||||
|
||||
.. image:: images/viewer.jpg
|
||||
:height: 160pt
|
||||
:height: 160pt
|
||||
|
||||
Note that the second image in the list, *edges*, is shown as "invalid". This indicates that some data members of this image object have corrupt or invalid values (for example, a negative image width). This is expected at this point in the program, since the C++ constructor for *edges* has not run yet, and so its members have undefined values (in debug mode they are usually filled with "0xCD" bytes).
|
||||
|
||||
@ -113,17 +113,17 @@ From here you can single-step through your code (:menuselection:`Debug->Step Ove
|
||||
Now assume you want to do a visual sanity check of the *cv::Canny()* implementation. Bring the *edges* image into the viewer by selecting it in the *Image List* and zoom into a region with a clearly defined edge:
|
||||
|
||||
.. image:: images/edges_zoom.png
|
||||
:height: 160pt
|
||||
:height: 160pt
|
||||
|
||||
Right-click on the *Image Viewer* to bring up the view context menu and enable :menuselection:`Link Views` (a check box next to the menu item indicates whether the option is enabled).
|
||||
|
||||
.. image:: images/viewer_context_menu.png
|
||||
:height: 120pt
|
||||
:height: 120pt
|
||||
|
||||
The :menuselection:`Link Views` feature keeps the view region fixed when flipping between images of the same size. To see how this works, select the input image from the image list--you should now see the corresponding zoomed-in region in the input image:
|
||||
|
||||
.. image:: images/input_zoom.png
|
||||
:height: 160pt
|
||||
:height: 160pt
|
||||
|
||||
You may also switch back and forth between viewing input and edges with your up/down cursor keys. That way you can easily verify that the detected edges line up nicely with the data in the input image.
|
||||
|
||||
@ -141,4 +141,4 @@ Image watch has a number of more advanced features, such as
|
||||
Please refer to the online `Image Watch Documentation <http://go.microsoft.com/fwlink/?LinkId=285461>`_ for details--you also can get to the documentation page by clicking on the *Help* link in the Image Watch window:
|
||||
|
||||
.. image:: images/help_button.jpg
|
||||
:height: 80pt
|
||||
:height: 80pt
|
||||
|
@ -43,9 +43,9 @@ Now we will learn how to write a simple Hello World Application in Xcode using O
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import <opencv2/opencv.hpp>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#import <opencv2/opencv.hpp>
|
||||
#endif
|
||||
|
||||
.. image:: images/header_directive.png
|
||||
:alt: header
|
||||
@ -73,4 +73,3 @@ Now we will learn how to write a simple Hello World Application in Xcode using O
|
||||
.. image:: images/output.png
|
||||
:alt: output
|
||||
:align: center
|
||||
|
||||
|
@ -17,32 +17,32 @@ Including OpenCV library in your iOS project
|
||||
|
||||
The OpenCV library comes as a so-called framework, which you can directly drag-and-drop into your XCode project. Download the latest binary from <http://sourceforge.net/projects/opencvlibrary/files/opencv-ios/>. Alternatively follow this guide :ref:`iOS-Installation` to compile the framework manually. Once you have the framework, just drag-and-drop into XCode:
|
||||
|
||||
.. image:: images/xcode_hello_ios_framework_drag_and_drop.png
|
||||
.. image:: images/xcode_hello_ios_framework_drag_and_drop.png
|
||||
|
||||
|
||||
Also you have to locate the prefix header that is used for all header files in the project. The file is typically located at "ProjectName/Supporting Files/ProjectName-Prefix.pch". There, you have add an include statement to import the opencv library. However, make sure you include opencv before you include UIKit and Foundation, because else you will get some weird compile errors that some macros like min and max are defined multiple times. For example the prefix header could look like the following:
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
//
|
||||
// Prefix header for all source files of the 'VideoFilters' target in the 'VideoFilters' project
|
||||
//
|
||||
//
|
||||
// Prefix header for all source files of the 'VideoFilters' target in the 'VideoFilters' project
|
||||
//
|
||||
|
||||
#import <Availability.h>
|
||||
#import <Availability.h>
|
||||
|
||||
#ifndef __IPHONE_4_0
|
||||
#warning "This project uses features only available in iOS SDK 4.0 and later."
|
||||
#endif
|
||||
#ifndef __IPHONE_4_0
|
||||
#warning "This project uses features only available in iOS SDK 4.0 and later."
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import <opencv2/opencv.hpp>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#import <opencv2/opencv.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -53,23 +53,23 @@ User Interface
|
||||
|
||||
First, we create a simple iOS project, for example Single View Application. Then, we create and add an UIImageView and UIButton to start the camera and display the video frames. The storyboard could look like that:
|
||||
|
||||
.. image:: images/xcode_hello_ios_viewcontroller_layout.png
|
||||
.. image:: images/xcode_hello_ios_viewcontroller_layout.png
|
||||
|
||||
|
||||
Make sure to add and connect the IBOutlets and IBActions to the corresponding ViewController:
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
{
|
||||
IBOutlet UIImageView* imageView;
|
||||
IBOutlet UIButton* button;
|
||||
}
|
||||
@interface ViewController : UIViewController
|
||||
{
|
||||
IBOutlet UIImageView* imageView;
|
||||
IBOutlet UIButton* button;
|
||||
}
|
||||
|
||||
- (IBAction)actionStart:(id)sender;
|
||||
- (IBAction)actionStart:(id)sender;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
|
||||
Adding the Camera
|
||||
@ -78,37 +78,37 @@ Adding the Camera
|
||||
We add a camera controller to the view controller and initialize it when the view has loaded:
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
#import <opencv2/highgui/cap_ios.h>
|
||||
using namespace cv;
|
||||
#import <opencv2/highgui/cap_ios.h>
|
||||
using namespace cv;
|
||||
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
{
|
||||
...
|
||||
CvVideoCamera* videoCamera;
|
||||
}
|
||||
...
|
||||
@property (nonatomic, retain) CvVideoCamera* videoCamera;
|
||||
@interface ViewController : UIViewController
|
||||
{
|
||||
...
|
||||
CvVideoCamera* videoCamera;
|
||||
}
|
||||
...
|
||||
@property (nonatomic, retain) CvVideoCamera* videoCamera;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
|
||||
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
|
||||
self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront;
|
||||
self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;
|
||||
self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
|
||||
self.videoCamera.defaultFPS = 30;
|
||||
self.videoCamera.grayscale = NO;
|
||||
}
|
||||
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
|
||||
self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront;
|
||||
self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;
|
||||
self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
|
||||
self.videoCamera.defaultFPS = 30;
|
||||
self.videoCamera.grayscale = NO;
|
||||
}
|
||||
|
||||
In this case, we initialize the camera and provide the imageView as a target for rendering each frame. CvVideoCamera is basically a wrapper around AVFoundation, so we provie as properties some of the AVFoundation camera options. For example we want to use the front camera, set the video size to 352x288 and a video orientation (the video camera normally outputs in landscape mode, which results in transposed data when you design a portrait application).
|
||||
|
||||
@ -143,7 +143,7 @@ Additionally, we have to manually add framework dependencies of the opencv frame
|
||||
* Foundation
|
||||
|
||||
|
||||
.. image:: images/xcode_hello_ios_frameworks_add_dependencies.png
|
||||
.. image:: images/xcode_hello_ios_frameworks_add_dependencies.png
|
||||
|
||||
|
||||
Processing frames
|
||||
@ -152,35 +152,35 @@ Processing frames
|
||||
We follow the delegation pattern, which is very common in iOS, to provide access to each camera frame. Basically, the View Controller has to implement the CvVideoCameraDelegate protocol and has to be set as delegate to the video camera:
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
@interface ViewController : UIViewController<CvVideoCameraDelegate>
|
||||
@interface ViewController : UIViewController<CvVideoCameraDelegate>
|
||||
|
||||
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
...
|
||||
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
|
||||
self.videoCamera.delegate = self;
|
||||
...
|
||||
}
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
...
|
||||
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
|
||||
self.videoCamera.delegate = self;
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
#pragma mark - Protocol CvVideoCameraDelegate
|
||||
#pragma mark - Protocol CvVideoCameraDelegate
|
||||
|
||||
#ifdef __cplusplus
|
||||
- (void)processImage:(Mat&)image;
|
||||
{
|
||||
// Do some OpenCV stuff with the image
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
- (void)processImage:(Mat&)image;
|
||||
{
|
||||
// Do some OpenCV stuff with the image
|
||||
}
|
||||
#endif
|
||||
|
||||
Note that we are using C++ here (cv::Mat).
|
||||
Important: You have to rename the view controller's extension .m into .mm, so that the compiler compiles it under the assumption of Objective-C++ (Objective-C and C++ mixed). Then, __cplusplus is defined when the compiler is processing the file for C++ code. Therefore, we put our code within a block where __cplusplus is defined.
|
||||
@ -193,18 +193,18 @@ From here you can start processing video frames. For example the following snipp
|
||||
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
- (void)processImage:(Mat&)image;
|
||||
{
|
||||
// Do some OpenCV stuff with the image
|
||||
Mat image_copy;
|
||||
cvtColor(image, image_copy, CV_BGRA2BGR);
|
||||
- (void)processImage:(Mat&)image;
|
||||
{
|
||||
// Do some OpenCV stuff with the image
|
||||
Mat image_copy;
|
||||
cvtColor(image, image_copy, CV_BGRA2BGR);
|
||||
|
||||
// invert image
|
||||
bitwise_not(image_copy, image_copy);
|
||||
cvtColor(image_copy, image, CV_BGR2BGRA);
|
||||
}
|
||||
// invert image
|
||||
bitwise_not(image_copy, image_copy);
|
||||
cvtColor(image_copy, image, CV_BGR2BGRA);
|
||||
}
|
||||
|
||||
|
||||
Start!
|
||||
@ -213,14 +213,14 @@ Start!
|
||||
Finally, we have to tell the camera to actually start/stop working. The following code will start the camera when you press the button, assuming you connected the UI properly:
|
||||
|
||||
.. code-block:: objc
|
||||
:linenos:
|
||||
:linenos:
|
||||
|
||||
#pragma mark - UI Actions
|
||||
#pragma mark - UI Actions
|
||||
|
||||
- (IBAction)actionStart:(id)sender;
|
||||
{
|
||||
[self.videoCamera start];
|
||||
}
|
||||
- (IBAction)actionStart:(id)sender;
|
||||
{
|
||||
[self.videoCamera start];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -185,4 +185,3 @@ Results
|
||||
.. image:: images/result.png
|
||||
:alt: The seperated planes
|
||||
:align: center
|
||||
|
||||
|
@ -131,4 +131,3 @@ Result
|
||||
.. image:: images/Cascade_Classifier_Tutorial_Result_LBP.jpg
|
||||
:align: center
|
||||
:height: 300pt
|
||||
|
||||
|
@ -5,5 +5,3 @@ install(FILES ${old_hdrs}
|
||||
install(FILES "opencv2/opencv.hpp"
|
||||
DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2
|
||||
COMPONENT main)
|
||||
|
||||
|
||||
|
@ -80,4 +80,3 @@
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // __OPENCV_OLD_CV_H_
|
||||
|
||||
|
@ -46,4 +46,3 @@
|
||||
#include "opencv2/core/eigen.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,4 +14,3 @@ double getCameraPropertyC(void* camera, int propIdx);
|
||||
void setCameraPropertyC(void* camera, int propIdx, double value);
|
||||
void applyCameraPropertiesC(void** camera);
|
||||
}
|
||||
|
||||
|
@ -6,4 +6,3 @@ calib3d. Camera Calibration and 3D Reconstruction
|
||||
:maxdepth: 2
|
||||
|
||||
camera_calibration_and_3d_reconstruction
|
||||
|
||||
|
@ -78,4 +78,3 @@ protected:
|
||||
};
|
||||
|
||||
#endif // _CV_MODEL_EST_H_
|
||||
|
||||
|
@ -622,4 +622,3 @@ void epnp::qr_solve(CvMat * A, CvMat * b, CvMat * X)
|
||||
pX[i] = (pb[i] - sum) / A2[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,4 +413,3 @@ bool p3p::jacobi_4x4(double * A, double * D, double * U)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,4 +59,3 @@ class p3p
|
||||
};
|
||||
|
||||
#endif // P3P_H
|
||||
|
||||
|
@ -346,4 +346,3 @@ void cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -193,4 +193,3 @@ void CV_Affine3D_EstTest::run( int /* start_from */)
|
||||
}
|
||||
|
||||
TEST(Calib3d_EstimateAffineTransform, accuracy) { CV_Affine3D_EstTest test; test.safe_run(); }
|
||||
|
||||
|
@ -734,5 +734,3 @@ protected:
|
||||
TEST(Calib3d_CalibrateCamera_C, badarg) { CV_CameraCalibrationBadArgTest test; test.safe_run(); }
|
||||
TEST(Calib3d_Rodrigues_C, badarg) { CV_Rodrigues2BadArgTest test; test.safe_run(); }
|
||||
TEST(Calib3d_ProjectPoints_C, badarg) { CV_ProjectPoints2BadArgTest test; test.safe_run(); }
|
||||
|
||||
|
||||
|
@ -329,4 +329,3 @@ Mat cv::ChessBoardGenerator::operator ()(const Mat& bg, const Mat& camMat, const
|
||||
return generateChessBoard(bg, camMat, distCoeffs, zero, pb1, pb2,
|
||||
squareSize.width, squareSize.height, pts3d, corners);
|
||||
}
|
||||
|
||||
|
@ -212,4 +212,3 @@ protected:
|
||||
};
|
||||
|
||||
TEST(Calib3d_ComposeRT, accuracy) { CV_composeRT_Test test; test.safe_run(); }
|
||||
|
||||
|
@ -22,4 +22,3 @@ namespace cvtest
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -172,4 +172,3 @@ protected:
|
||||
};
|
||||
|
||||
TEST(Calib3d_ReprojectImageTo3D, accuracy) { CV_ReprojectImageTo3DTest test; test.safe_run(); }
|
||||
|
||||
|
@ -626,5 +626,3 @@ CSV for the AT&T Facedatabase
|
||||
.. literalinclude:: etc/at.txt
|
||||
:language: none
|
||||
:linenos:
|
||||
|
||||
|
||||
|
@ -30,4 +30,3 @@ Indices and tables
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
||||
|
@ -23,4 +23,3 @@ target_link_libraries(facerec_fisherfaces opencv_contrib opencv_core opencv_imgp
|
||||
|
||||
add_executable(facerec_lbph facerec_lbph.cpp)
|
||||
target_link_libraries(facerec_lbph opencv_contrib opencv_core opencv_imgproc opencv_highgui)
|
||||
|
||||
|
@ -231,5 +231,3 @@ Here are some examples:
|
||||
+---------------------------------+----------------------------------------------------------------------------+
|
||||
| 0.2 (20%), 0.2 (20%), (70,70) | .. image:: ../img/tutorial/gender_classification/arnie_20_20_70_70.jpg |
|
||||
+---------------------------------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
@ -44,4 +44,3 @@ And here is the Reconstruction, which is the same as the original:
|
||||
|
||||
.. image:: ../img/eigenface_reconstruction_opencv.png
|
||||
:align: center
|
||||
|
||||
|
@ -205,5 +205,3 @@ Here are some examples:
|
||||
+---------------------------------+----------------------------------------------------------------------------+
|
||||
| 0.2 (20%), 0.2 (20%), (70,70) | .. image:: ../img/tutorial/gender_classification/arnie_20_20_70_70.jpg |
|
||||
+---------------------------------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
@ -113,5 +113,3 @@ The method executes the variational algorithm on a rectified stereo pair. See ``
|
||||
**Note**:
|
||||
|
||||
The method is not constant, so you should not use the same ``StereoVar`` instance from different threads simultaneously.
|
||||
|
||||
|
||||
|
@ -983,4 +983,3 @@ namespace cv
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -353,4 +353,3 @@ protected:
|
||||
|
||||
}
|
||||
#endif /* __OPENCV_CONTRIB_RETINA_HPP__ */
|
||||
|
||||
|
@ -284,5 +284,3 @@ void CvAdaptiveSkinDetector::Histogram::mergeWith(CvAdaptiveSkinDetector::Histog
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -653,5 +653,3 @@ namespace cv
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -136,4 +136,3 @@ Mat BOWMSCTrainer::cluster(const Mat& _descriptors) const {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -287,4 +287,3 @@ bool ChowLiuTree::reduceEdgesToMinSpan(std::list<info>& edges) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -133,5 +133,3 @@ Point2f CvMeanShiftTracker::getTrackingCenter()
|
||||
{
|
||||
return prev_center;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,4 +41,3 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
|
@ -853,4 +853,3 @@ const DetectionBasedTracker::Parameters& DetectionBasedTracker::getParameters()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -221,4 +221,3 @@ Point2f CvFeatureTracker::getTrackingCenter()
|
||||
center.y = (float)(prev_center.y + prev_trackwindow.height/2.0);
|
||||
return center;
|
||||
}
|
||||
|
||||
|
@ -720,4 +720,3 @@ void CvFuzzyMeanShiftTracker::track(IplImage *maskImage, IplImage *depthMap, int
|
||||
searchMode = tsTracking;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -234,4 +234,3 @@ void CvHybridTracker::updateTrackerWithLowPassFilter(Mat) {
|
||||
Rect CvHybridTracker::getTrackingWindow() {
|
||||
return prev_window;
|
||||
}
|
||||
|
||||
|
@ -1111,4 +1111,3 @@ Mat LDA::reconstruct(InputArray src) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -649,4 +649,3 @@ LogPolar_Adjacent::~LogPolar_Adjacent()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -207,5 +207,3 @@ const std::valarray<float> &MagnoRetinaFilter::runFilter(const std::valarray<flo
|
||||
return (*_magnoYOutput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,5 +241,3 @@ namespace cv
|
||||
}
|
||||
|
||||
#endif /*MagnoRetinaFilter_H_*/
|
||||
|
||||
|
||||
|
@ -228,4 +228,3 @@ void ParvoRetinaFilter::_OPL_OnOffWaysComputing() // WARNING : this method requi
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user