mirror of https://github.com/opencv/opencv.git
commit
00367cfb00
485 changed files with 25166 additions and 4825 deletions
@ -0,0 +1,2 @@ |
||||
[tgit] |
||||
icon = doc/opencv.ico |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,53 @@ |
||||
if(NOT WITH_VTK OR ANDROID OR IOS) |
||||
return() |
||||
endif() |
||||
|
||||
# VTK 6.x components |
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE) |
||||
|
||||
# VTK 5.x components |
||||
if(NOT VTK_FOUND) |
||||
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE) |
||||
endif() |
||||
|
||||
if(NOT VTK_FOUND) |
||||
set(HAVE_VTK OFF) |
||||
message(STATUS "VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file") |
||||
return() |
||||
endif() |
||||
|
||||
# Don't support ealier VTKs |
||||
if(${VTK_VERSION} VERSION_LESS "5.8.0") |
||||
message(STATUS "VTK support is disabled. VTK ver. 5.8.0 is minimum required, but found VTK ver. ${VTK_VERSION}") |
||||
return() |
||||
endif() |
||||
|
||||
# Different Qt versions can't be linked together |
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_LESS "6.0.0") |
||||
if(VTK_USE_QT) |
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4") |
||||
endif() |
||||
endif() |
||||
|
||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with |
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK) |
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4") |
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake") |
||||
return() |
||||
endif() |
||||
|
||||
# Different Qt versions can't be linked together |
||||
if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "") |
||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4") |
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4") |
||||
return() |
||||
endif() |
||||
|
||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5") |
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5") |
||||
return() |
||||
endif() |
||||
endif() |
||||
|
||||
set(HAVE_VTK ON) |
||||
message(STATUS "Found VTK ver. ${VTK_VERSION} (usefile: ${VTK_USE_FILE})") |
@ -0,0 +1,110 @@ |
||||
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") |
||||
set(CPACK_set_DESTDIR "on") |
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO) |
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library") |
||||
set(CPACK_PACKAGE_DESCRIPTION |
||||
"OpenCV (Open Source Computer Vision Library) is an open source computer vision |
||||
and machine learning software library. OpenCV was built to provide a common |
||||
infrastructure for computer vision applications and to accelerate the use of |
||||
machine perception in the commercial products. Being a BSD-licensed product, |
||||
OpenCV makes it easy for businesses to utilize and modify the code.") |
||||
set(CPACK_PACKAGE_VENDOR "OpenCV Foundation") |
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") |
||||
set(CPACK_PACKAGE_CONTACT "admin@opencv.org") |
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}") |
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}") |
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}") |
||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}") |
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO) |
||||
|
||||
#arch |
||||
if(X86) |
||||
set(CPACK_DEBIAN_ARCHITECTURE "i386") |
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686") |
||||
elseif(X86_64) |
||||
set(CPACK_DEBIAN_ARCHITECTURE "amd64") |
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") |
||||
elseif(ARM) |
||||
set(CPACK_DEBIAN_ARCHITECTURE "armhf") |
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf") |
||||
else() |
||||
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) |
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) |
||||
endif() |
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB") |
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE}) |
||||
elseif(CPACK_GENERATOR STREQUAL "RPM") |
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE}) |
||||
else() |
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR}) |
||||
endif() |
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}") |
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}") |
||||
|
||||
#rpm options |
||||
set(CPACK_RPM_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) |
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION}) |
||||
set(CPACK_RPM_PACKAGE_URL "http://opencv.org") |
||||
set(CPACK_RPM_PACKAGE_LICENSE "BSD") |
||||
|
||||
#deb options |
||||
set(CPACK_DEB_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") |
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs") |
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org") |
||||
|
||||
#depencencies |
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) |
||||
set(CPACK_COMPONENT_samples_DEPENDS libs) |
||||
set(CPACK_COMPONENT_dev_DEPENDS libs) |
||||
set(CPACK_COMPONENT_docs_DEPENDS libs) |
||||
set(CPACK_COMPONENT_java_DEPENDS libs) |
||||
set(CPACK_COMPONENT_python_DEPENDS libs) |
||||
set(CPACK_COMPONENT_tests_DEPENDS libs) |
||||
|
||||
if(HAVE_CUDA) |
||||
string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION}) |
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") |
||||
set(CPACK_COMPONENT_dev_DEPENDS libs) |
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}") |
||||
endif() |
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO) |
||||
set(CPACK_COMPONENT_libs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}") |
||||
set(CPACK_COMPONENT_libs_DESCRIPTION "Open Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_python_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-python") |
||||
set(CPACK_COMPONENT_python_DESCRIPTION "Python bindings for Open Source Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_java_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-java") |
||||
set(CPACK_COMPONENT_java_DESCRIPTION "Java bindings for Open Source Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_dev_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-dev") |
||||
set(CPACK_COMPONENT_dev_DESCRIPTION "Development files for Open Source Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_docs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-docs") |
||||
set(CPACK_COMPONENT_docs_DESCRIPTION "Documentation for Open Source Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_samples_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-samples") |
||||
set(CPACK_COMPONENT_samples_DESCRIPTION "Samples for Open Source Computer Vision Library") |
||||
|
||||
set(CPACK_COMPONENT_tests_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-tests") |
||||
set(CPACK_COMPONENT_tests_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library") |
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO) |
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT) |
||||
set(CPACK_libs_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_dev_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_docs_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_python_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_java_COMPONENT_INSTALL TRUE) |
||||
set(CPACK_samples_COMPONENT_INSTALL TRUE) |
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT) |
||||
|
||||
include(CPack) |
||||
|
||||
ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") |
@ -0,0 +1,51 @@ |
||||
#!/bin/sh |
||||
|
||||
BASE_DIR=`dirname $0` |
||||
OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@ |
||||
OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/ |
||||
|
||||
if [ $# -ne 1 ]; then |
||||
echo "Device architecture is not preset in command line" |
||||
echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`" |
||||
echo "Usage: $0 <target_device_arch>" |
||||
return 1 |
||||
else |
||||
TARGET_ARCH=$1 |
||||
fi |
||||
|
||||
if [ -z `which adb` ]; then |
||||
echo "adb command was not found in PATH" |
||||
return 1 |
||||
fi |
||||
|
||||
adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata |
||||
|
||||
adb shell "mkdir -p /data/local/tmp/opencv_test" |
||||
SUMMARY_STATUS=0 |
||||
for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*; |
||||
do |
||||
test_name=`basename "$t"` |
||||
report="$test_name-`date --rfc-3339=date`.xml" |
||||
adb push $t /data/local/tmp/opencv_test/ |
||||
adb shell "export OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata && /data/local/tmp/opencv_test/$test_name --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:/data/local/tmp/opencv_test/$report" |
||||
adb pull "/data/local/tmp/opencv_test/$report" $report |
||||
TEST_STATUS=0 |
||||
if [ -e $report ]; then |
||||
if [ `grep -c "<fail" $report` -ne 0 ]; then |
||||
TEST_STATUS=2 |
||||
fi |
||||
else |
||||
TEST_STATUS=3 |
||||
fi |
||||
if [ $TEST_STATUS -ne 0 ]; then |
||||
SUMMARY_STATUS=$TEST_STATUS |
||||
fi |
||||
done |
||||
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then |
||||
echo "All OpenCV tests finished successfully" |
||||
else |
||||
echo "OpenCV tests finished with status $SUMMARY_STATUS" |
||||
fi |
||||
|
||||
return $SUMMARY_STATUS |
@ -0,0 +1,25 @@ |
||||
#!/bin/sh |
||||
|
||||
OPENCV_TEST_PATH=@CMAKE_INSTALL_PREFIX@/@OPENCV_TEST_INSTALL_PATH@ |
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata |
||||
|
||||
SUMMARY_STATUS=0 |
||||
for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*; |
||||
do |
||||
report="`basename "$t"`-`date --rfc-3339=date`.xml" |
||||
"$t" --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:"$report" |
||||
TEST_STATUS=$? |
||||
if [ $TEST_STATUS -ne 0 ]; then |
||||
SUMMARY_STATUS=$TEST_STATUS |
||||
fi |
||||
done |
||||
|
||||
rm -f /tmp/__opencv_temp.* |
||||
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then |
||||
echo "All OpenCV tests finished successfully" |
||||
else |
||||
echo "OpenCV tests finished with status $SUMMARY_STATUS" |
||||
fi |
||||
|
||||
return $SUMMARY_STATUS |
@ -0,0 +1,2 @@ |
||||
# Environment setup for OpenCV testing |
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata |
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,159 @@ |
||||
.. _creating_widgets: |
||||
|
||||
Creating Widgets |
||||
**************** |
||||
|
||||
Goal |
||||
==== |
||||
|
||||
In this tutorial you will learn how to |
||||
|
||||
.. container:: enumeratevisibleitemswithsquare |
||||
|
||||
* Create your own widgets using WidgetAccessor and VTK. |
||||
* Show your widget in the visualization window. |
||||
|
||||
Code |
||||
==== |
||||
|
||||
You can download the code from :download:`here <../../../../samples/cpp/tutorial_code/viz/creating_widgets.cpp>`. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
#include <opencv2/viz/vizcore.hpp> |
||||
#include <opencv2/viz/widget_accessor.hpp> |
||||
#include <iostream> |
||||
|
||||
#include <vtkPoints.h> |
||||
#include <vtkTriangle.h> |
||||
#include <vtkCellArray.h> |
||||
#include <vtkPolyData.h> |
||||
#include <vtkPolyDataMapper.h> |
||||
#include <vtkIdList.h> |
||||
#include <vtkActor.h> |
||||
#include <vtkProp.h> |
||||
|
||||
using namespace cv; |
||||
using namespace std; |
||||
|
||||
/** |
||||
* @class WTriangle |
||||
* @brief Defining our own 3D Triangle widget |
||||
*/ |
||||
class WTriangle : public viz::Widget3D |
||||
{ |
||||
public: |
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white()); |
||||
}; |
||||
|
||||
/** |
||||
* @function WTriangle::WTriangle |
||||
*/ |
||||
WTriangle::WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color) |
||||
{ |
||||
// Create a triangle |
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); |
||||
points->InsertNextPoint(pt1.x, pt1.y, pt1.z); |
||||
points->InsertNextPoint(pt2.x, pt2.y, pt2.z); |
||||
points->InsertNextPoint(pt3.x, pt3.y, pt3.z); |
||||
|
||||
vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New(); |
||||
triangle->GetPointIds()->SetId(0,0); |
||||
triangle->GetPointIds()->SetId(1,1); |
||||
triangle->GetPointIds()->SetId(2,2); |
||||
|
||||
vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New(); |
||||
cells->InsertNextCell(triangle); |
||||
|
||||
// Create a polydata object |
||||
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New(); |
||||
|
||||
// Add the geometry and topology to the polydata |
||||
polyData->SetPoints(points); |
||||
polyData->SetPolys(cells); |
||||
|
||||
// Create mapper and actor |
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); |
||||
#if VTK_MAJOR_VERSION <= 5 |
||||
mapper->SetInput(polyData); |
||||
#else |
||||
mapper->SetInputData(polyData); |
||||
#endif |
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); |
||||
actor->SetMapper(mapper); |
||||
|
||||
// Store this actor in the widget in order that visualizer can access it |
||||
viz::WidgetAccessor::setProp(*this, actor); |
||||
|
||||
// Set the color of the widget. This has to be called after WidgetAccessor. |
||||
setColor(color); |
||||
} |
||||
|
||||
/** |
||||
* @function main |
||||
*/ |
||||
int main() |
||||
{ |
||||
/// Create a window |
||||
viz::Viz3d myWindow("Creating Widgets"); |
||||
|
||||
/// Create a triangle widget |
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red()); |
||||
|
||||
/// Show widget in the visualizer window |
||||
myWindow.showWidget("TRIANGLE", tw); |
||||
|
||||
/// Start event loop |
||||
myWindow.spin(); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
Explanation |
||||
=========== |
||||
|
||||
Here is the general structure of the program: |
||||
|
||||
* Extend Widget3D class to create a new 3D widget. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
class WTriangle : public viz::Widget3D |
||||
{ |
||||
public: |
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white()); |
||||
}; |
||||
|
||||
* Assign a VTK actor to the widget. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
// Store this actor in the widget in order that visualizer can access it |
||||
viz::WidgetAccessor::setProp(*this, actor); |
||||
|
||||
* Set color of the widget. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
// Set the color of the widget. This has to be called after WidgetAccessor. |
||||
setColor(color); |
||||
|
||||
* Construct a triangle widget and display it in the window. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
/// Create a triangle widget |
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red()); |
||||
|
||||
/// Show widget in the visualizer window |
||||
myWindow.showWidget("TRIANGLE", tw); |
||||
|
||||
Results |
||||
======= |
||||
|
||||
Here is the result of the program. |
||||
|
||||
.. image:: images/red_triangle.png |
||||
:alt: Creating Widgets |
||||
:align: center |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 7.3 KiB |
@ -0,0 +1,118 @@ |
||||
.. _launching_viz: |
||||
|
||||
Launching Viz |
||||
************* |
||||
|
||||
Goal |
||||
==== |
||||
|
||||
In this tutorial you will learn how to |
||||
|
||||
.. container:: enumeratevisibleitemswithsquare |
||||
|
||||
* Open a visualization window. |
||||
* Access a window by its name. |
||||
* Start event loop. |
||||
* Start event loop for a given amount of time. |
||||
|
||||
Code |
||||
==== |
||||
|
||||
You can download the code from :download:`here <../../../../samples/cpp/tutorial_code/viz/launching_viz.cpp>`. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
#include <opencv2/viz/vizcore.hpp> |
||||
#include <iostream> |
||||
|
||||
using namespace cv; |
||||
using namespace std; |
||||
|
||||
/** |
||||
* @function main |
||||
*/ |
||||
int main() |
||||
{ |
||||
/// Create a window |
||||
viz::Viz3d myWindow("Viz Demo"); |
||||
|
||||
/// Start event loop |
||||
myWindow.spin(); |
||||
|
||||
/// Event loop is over when pressed q, Q, e, E |
||||
cout << "First event loop is over" << endl; |
||||
|
||||
/// Access window via its name |
||||
viz::Viz3d sameWindow = viz::getWindowByName("Viz Demo"); |
||||
|
||||
/// Start event loop |
||||
sameWindow.spin(); |
||||
|
||||
/// Event loop is over when pressed q, Q, e, E |
||||
cout << "Second event loop is over" << endl; |
||||
|
||||
/// Event loop is over when pressed q, Q, e, E |
||||
/// Start event loop once for 1 millisecond |
||||
sameWindow.spinOnce(1, true); |
||||
while(!sameWindow.wasStopped()) |
||||
{ |
||||
/// Interact with window |
||||
|
||||
/// Event loop for 1 millisecond |
||||
sameWindow.spinOnce(1, true); |
||||
} |
||||
|
||||
/// Once more event loop is stopped |
||||
cout << "Last event loop is over" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
Explanation |
||||
=========== |
||||
|
||||
Here is the general structure of the program: |
||||
|
||||
* Create a window. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
/// Create a window |
||||
viz::Viz3d myWindow("Viz Demo"); |
||||
|
||||
* Start event loop. This event loop will run until user terminates it by pressing **e**, **E**, **q**, **Q**. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
/// Start event loop |
||||
myWindow.spin(); |
||||
|
||||
* Access same window via its name. Since windows are implicitly shared, **sameWindow** is exactly the same with **myWindow**. If the name does not exist, a new window is created. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
/// Access window via its name |
||||
viz::Viz3d sameWindow = viz::get("Viz Demo"); |
||||
|
||||
* Start a controlled event loop. Once it starts, **wasStopped** is set to false. Inside the while loop, in each iteration, **spinOnce** is called to prevent event loop from completely stopping. Inside the while loop, user can execute other statements including those which interact with the window. |
||||
|
||||
.. code-block:: cpp |
||||
|
||||
/// Event loop is over when pressed q, Q, e, E |
||||
/// Start event loop once for 1 millisecond |
||||
sameWindow.spinOnce(1, true); |
||||
while(!sameWindow.wasStopped()) |
||||
{ |
||||
/// Interact with window |
||||
|
||||
/// Event loop for 1 millisecond |
||||
sameWindow.spinOnce(1, true); |
||||
} |
||||
|
||||
Results |
||||
======= |
||||
|
||||
Here is the result of the program. |
||||
|
||||
.. image:: images/window_demo.png |
||||
:alt: Launching Viz |
||||
:align: center |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,94 @@ |
||||
.. _Table-Of-Content-Viz: |
||||
|
||||
**OpenCV Viz** |
||||
----------------------------------------------------------- |
||||
|
||||
.. include:: ../../definitions/tocDefinitions.rst |
||||
|
||||
+ |
||||
.. tabularcolumns:: m{100pt} m{300pt} |
||||
.. cssclass:: toctableopencv |
||||
|
||||
================== =============================================================================== |
||||
|VizLaunchingViz| **Title:** :ref:`launching_viz` |
||||
|
||||
*Compatibility:* > OpenCV 3.0.0 |
||||
|
||||
*Author:* Ozan Tonkal |
||||
|
||||
You will learn how to launch a viz window. |
||||
|
||||
================== =============================================================================== |
||||
|
||||
.. |VizLaunchingViz| image:: ../launching_viz/images/window_demo.png |
||||
:height: 120pt |
||||
:width: 90pt |
||||
|
||||
+ |
||||
.. tabularcolumns:: m{100pt} m{300pt} |
||||
.. cssclass:: toctableopencv |
||||
|
||||
================ ============================================================================ |
||||
|WidgetPose| **Title:** :ref:`widget_pose` |
||||
|
||||
*Compatibility:* > OpenCV 3.0.0 |
||||
|
||||
*Author:* Ozan Tonkal |
||||
|
||||
You will learn how to change pose of a widget. |
||||
|
||||
================ ============================================================================ |
||||
|
||||
.. |WidgetPose| image:: ../widget_pose/images/widgetpose.png |
||||
:height: 90pt |
||||
:width: 90pt |
||||
|
||||
+ |
||||
.. tabularcolumns:: m{100pt} m{300pt} |
||||
.. cssclass:: toctableopencv |
||||
|
||||
================== ============================================================================ |
||||
|Transformations| **Title:** :ref:`transformations` |
||||
|
||||
*Compatibility:* > OpenCV 3.0.0 |
||||
|
||||
*Author:* Ozan Tonkal |
||||
|
||||
You will learn how to transform between global and camera frames. |
||||
|
||||
================== ============================================================================ |
||||
|
||||
.. |Transformations| image:: ../transformations/images/global_view_point.png |
||||
:height: 120pt |
||||
:width: 90pt |
||||
|
||||
+ |
||||
.. tabularcolumns:: m{100pt} m{300pt} |
||||
.. cssclass:: toctableopencv |
||||
|
||||
================== ============================================================================ |
||||
|CreatingWidgets| **Title:** :ref:`creating_widgets` |
||||
|
||||
*Compatibility:* > OpenCV 3.0.0 |
||||
|
||||
*Author:* Ozan Tonkal |
||||
|
||||
You will learn how to create your own widgets. |
||||
|
||||
================== ============================================================================ |
||||
|
||||
.. |CreatingWidgets| image:: ../creating_widgets/images/red_triangle.png |
||||
:height: 120pt |
||||
:width: 90pt |
||||
|
||||
.. raw:: latex |
||||
|
||||
\pagebreak |
||||
|
||||
.. toctree:: |
||||
:hidden: |
||||
|
||||
../launching_viz/launching_viz |
||||
../widget_pose/widget_pose |
||||
../transformations/transformations |
||||
../creating_widgets/creating_widgets |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue