mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
samples: repair viz tutorial
This commit is contained in:
@@ -31,7 +31,8 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function -Wno-missing-declarations")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function -Wno-missing-declarations")
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------
|
||||
@@ -57,8 +58,10 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
ocv_target_link_libraries(${the_target} opencv_cudaarithm opencv_cudafilters)
|
||||
endif()
|
||||
|
||||
if(HAVE_opencv_ocl)
|
||||
ocv_target_link_libraries(${the_target} opencv_ocl)
|
||||
if("${srcs}" MATCHES "viz/" AND VTK_USE_FILE)
|
||||
include(${VTK_USE_FILE})
|
||||
ocv_target_link_libraries(${the_target} ${VTK_LIBRARIES})
|
||||
add_definitions(-DUSE_VTK)
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
@@ -88,7 +91,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
ocv_list_filterout(cpp_samples "/gpu/")
|
||||
endif()
|
||||
|
||||
ocv_list_filterout(cpp_samples "viz")
|
||||
if(NOT TARGET opencv_viz)
|
||||
ocv_list_filterout(cpp_samples "/viz/")
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_IPP_A)
|
||||
ocv_list_filterout(cpp_samples "/ippasync/")
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
* @author Ozan Cagri Tonkal
|
||||
*/
|
||||
|
||||
#ifndef USE_VTK
|
||||
#include <iostream>
|
||||
int main()
|
||||
{
|
||||
std::cout << "This sample requires direct compilation with VTK. Stop" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#include <opencv2/viz.hpp>
|
||||
#include <opencv2/viz/widget_accessor.hpp>
|
||||
#include <iostream>
|
||||
@@ -111,3 +119,4 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ int main()
|
||||
cout << "First event loop is over" << endl;
|
||||
|
||||
/// Access window via its name
|
||||
viz::Viz3d sameWindow = viz::get("Viz Demo");
|
||||
viz::Viz3d sameWindow = viz::getWindowByName("Viz Demo");
|
||||
|
||||
/// Start event loop
|
||||
sameWindow.spin();
|
||||
|
||||
Reference in New Issue
Block a user