1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
set(the_description "High-level GUI and Media I/O")
ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera)
# ----------------------------------------------------------------------------
# CMake file for highgui. See root CMakeLists.txt
# Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
# Jose Luis Blanco, 2008
# ----------------------------------------------------------------------------
set(GRFMT_LIBS "")
if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR)
ocv_include_directories(${ZLIB_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARIES})
endif()
if(WITH_JPEG)
add_definitions(-DHAVE_JPEG)
ocv_include_directories(${JPEG_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${JPEG_LIBRARIES})
endif()
if(WITH_PNG)
add_definitions(-DHAVE_PNG)
add_definitions(${PNG_DEFINITIONS})
ocv_include_directories(${PNG_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${PNG_LIBRARIES})
endif()
if(WITH_TIFF)
add_definitions(-DHAVE_TIFF)
ocv_include_directories(${TIFF_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${TIFF_LIBRARIES})
endif()
if(WITH_JASPER)
add_definitions(-DHAVE_JASPER)
ocv_include_directories(${JASPER_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${JASPER_LIBRARIES})
endif()
if(WITH_OPENEXR AND OPENEXR_FOUND)
add_definitions(-DHAVE_OPENEXR)
ocv_include_directories(${OPENEXR_INCLUDE_PATHS})
set(GRFMT_LIBS ${GRFMT_LIBS} ${OPENEXR_LIBRARIES})
endif()
file(GLOB grfmt_hdrs src/grfmt*.hpp)
file(GLOB grfmt_srcs src/grfmt*.cpp)
set(grfmt_hdrs src/bitstrm.hpp ${grfmt_hdrs})
set(grfmt_srcs src/bitstrm.cpp ${grfmt_srcs})
source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
set(highgui_hdrs src/precomp.hpp src/utils.hpp)
if(NEW_FFMPEG)
set(highgui_srcs
src/cap.cpp
src/cap_images.cpp
src/cap_ffmpeg_v2.cpp
src/loadsave.cpp
src/precomp.cpp
src/utils.cpp
src/window.cpp
)
else()
set(highgui_srcs
src/cap.cpp
src/cap_images.cpp
src/cap_ffmpeg.cpp
src/loadsave.cpp
src/precomp.cpp
src/utils.cpp
src/window.cpp
)
endif()
file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
#YV
if (HAVE_QT)
if (HAVE_QT_OPENGL)
set(QT_USE_QTOPENGL TRUE)
endif()
INCLUDE(${QT_USE_FILE})
SET(_RCCS_FILES src/window_QT.qrc)
QT4_ADD_RESOURCES(_RCC_OUTFILES ${_RCCS_FILES})
SET(_MOC_HEADERS src/window_QT.h )
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
endif()
if(WIN32)
if(NOT HAVE_QT)
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
endif()
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp)
if(HAVE_MIL)
set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
endif()
endif()
if(UNIX)
if(NOT HAVE_QT)
if(HAVE_GTK)
set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
endif()
endif()
if(HAVE_XINE)
set(highgui_srcs ${highgui_srcs} src/cap_xine.cpp)
endif()
if(HAVE_DC1394_2)
set(highgui_srcs ${highgui_srcs} src/cap_dc1394_v2.cpp)
endif()
if(HAVE_DC1394)
set(highgui_srcs ${highgui_srcs} src/cap_dc1394.cpp)
endif()
if(HAVE_FFMPEG)
if(BZIP2_LIBRARIES)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${BZIP2_LIBRARIES})
endif()
endif()
if(HAVE_PVAPI)
add_definitions(-DHAVE_PVAPI)
set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} PvAPI)
endif()
if(HAVE_GSTREAMER)
set(highgui_srcs ${highgui_srcs} src/cap_gstreamer.cpp)
endif()
if(HAVE_UNICAP)
set(highgui_srcs ${highgui_srcs} src/cap_unicap.cpp)
endif()
if(HAVE_LIBV4L)
set(highgui_srcs ${highgui_srcs} src/cap_libv4l.cpp)
else()
if(HAVE_CAMV4L OR HAVE_CAMV4L2)
set(highgui_srcs ${highgui_srcs} src/cap_v4l.cpp)
endif()
endif()
foreach(P ${HIGHGUI_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()
foreach(P ${HIGHGUI_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()
#OpenNI
if(WITH_OPENNI AND HAVE_OPENNI)
set(highgui_srcs ${highgui_srcs} src/cap_openni.cpp)
ocv_include_directories(${OPENNI_INCLUDE_DIR})
endif()
#YV
if(APPLE)
if (NOT IOS)
add_definitions(-DHAVE_QUICKTIME=1)
endif()
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
add_definitions(-DHAVE_IMAGEIO=1)
endif()
if (NOT HAVE_QT)
if(WITH_CARBON)
add_definitions(-DHAVE_CARBON=1)
set(highgui_srcs ${highgui_srcs} src/window_carbon.cpp)
else()
add_definitions(-DHAVE_COCOA=1)
set(highgui_srcs ${highgui_srcs} src/window_cocoa.mm)
endif()
endif()
if(WITH_QUICKTIME)
set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
else()
if (WITH_AVFOUNDATION)
add_definitions(-DHAVE_AVFOUNDATION=1)
set(highgui_srcs ${highgui_srcs} src/cap_avfoundation.mm)
else()
set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm)
endif()
endif()
endif(APPLE)
if(HAVE_opencv_androidcamera)
set(highgui_srcs ${highgui_srcs} src/cap_android.cpp)
add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)#TODO: remove this line
endif()
if(HAVE_XIMEA AND XIMEA_FOUND)
set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp)
ocv_include_directories(${XIMEA_PATH})
link_directories(${XIMEA_LIBRARY_DIR})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} m3api)
set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp)
endif()
if(OPENNI_LIBRARY)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${OPENNI_LIBRARY})
endif()
if(APPLE AND NOT IOS)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework Cocoa" "-framework QuartzCore")
if(WITH_CARBON)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework Carbon")
endif()
if(NOT WITH_QUICKTIME)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework QTKit")
endif()
if(WITH_CARBON OR WITH_QUICKTIME)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "-framework QuickTime" "-framework CoreFoundation")
endif()
endif()
if(IOS)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} bz2 "-framework QuartzCore" "-framework CoreFoundation" "-framework ImageIO" "-framework CoreGraphics" "-framework AVFoundation")
endif()
if(WIN32)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib")
include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include") #for directshow
endif()
source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
source_group("Include" FILES ${highgui_ext_hdrs})
ocv_set_module_sources(HEADERS ${highgui_ext_hdrs} SOURCES ${highgui_srcs} ${highgui_hdrs} ${grfmt_srcs} ${grfmt_hdrs})
ocv_module_include_directories()
ocv_create_module(${GRFMT_LIBS} ${HIGHGUI_LIBRARIES})
if(BUILD_SHARED_LIBS)
add_definitions(-DHIGHGUI_EXPORTS)
endif()
if(MSVC)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
endif()
#stop automatic dependencies propagation for this module
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
ocv_add_precompiled_headers(${the_module})
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
if(WIN32)
#copy ffmpeg dll to the output folder
if(MSVC64 OR MINGW64)
set(FFMPEG_SUFFIX _64)
endif()
set(ffmpeg_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
set(ffmpeg_path "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/${ffmpeg_bare_name}")
if(CMAKE_VERSION VERSION_GREATER "2.8.2")
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/$<CONFIGURATION>/${ffmpeg_bare_name}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
elseif(MSVC_IDE)
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name}"
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
elseif(MSVC)
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
else()
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
endif()
install(FILES "${ffmpeg_path}" DESTINATION bin COMPONENT main)
endif()
ocv_add_accuracy_tests()
ocv_add_perf_tests()