Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.1 KiB

set(the_description "Image I/O")
ocv_add_module(imgcodecs opencv_imgproc WRAP java objc python)
# ----------------------------------------------------------------------------
# CMake file for imgcodecs. See root CMakeLists.txt
# Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
# Jose Luis Blanco, 2008
# ----------------------------------------------------------------------------
ocv_clear_vars(GRFMT_LIBS)
if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
if(HAVE_PNG OR HAVE_TIFF OR HAVE_OPENEXR)
ocv_include_directories(${ZLIB_INCLUDE_DIRS})
list(APPEND GRFMT_LIBS ${ZLIB_LIBRARIES})
endif()
if(HAVE_JPEG)
ocv_include_directories(${JPEG_INCLUDE_DIR} ${${JPEG_LIBRARY}_BINARY_DIR})
list(APPEND GRFMT_LIBS ${JPEG_LIBRARIES})
endif()
if(HAVE_WEBP)
add_definitions(-DHAVE_WEBP)
ocv_include_directories(${WEBP_INCLUDE_DIR})
list(APPEND GRFMT_LIBS ${WEBP_LIBRARIES})
endif()
if(HAVE_PNG)
add_definitions(${PNG_DEFINITIONS})
ocv_include_directories(${PNG_INCLUDE_DIR})
list(APPEND GRFMT_LIBS ${PNG_LIBRARIES})
endif()
if(HAVE_GDCM)
ocv_include_directories(${GDCM_INCLUDE_DIRS})
list(APPEND GRFMT_LIBS ${GDCM_LIBRARIES})
endif()
if(HAVE_TIFF)
ocv_include_directories(${TIFF_INCLUDE_DIR})
list(APPEND GRFMT_LIBS ${TIFF_LIBRARIES})
endif()
Merge pull request #16494 from StefanBruens:jpeg2000_openjpeg_port Jpeg2000 OpenJPEG port * OpenJPEG based JPEG2000 decoder implementation Currently, the following input color spaces and depth conversions are supported: - 8 bit -> 8 bit - 16 bit -> 16 bit (IMREAD_UNCHANGED, IMREAD_ANYDEPTH) - RGB(a) -> BGR - RGBA -> BGRA (IMREAD_UNCHANGED) - Y(a) -> Y(a) (IMREAD_ANYCOLOR, IMREAD_GRAY, IMREAD_UNCHANGED)) - YCC -> Y (IMREAD_GRAY) * Check for OpenJPEG availability This enables OpenJPEG based JPEG2000 imread support by default, which can be disabled by -DWITH_OPENJPEG=OFF. In case OpenJPEG is enabled and found, any checks for Jasper are skipped. * Implement precision downscaling for precision > 8 without IMREAD_UNCHANGED With IMREAD_UNCHANGED, values are kept from the input image, without it components are downscaled to CV_8U range. * Enable Jpeg2K tests when OpenJPEG is available * Add support for some more color conversions Support IMREAD_GRAY when input color space is RGB or unspecified. Support YUV input color space for BGR output. * fix: problems with unmanaged memory * fix: CMake warning - HAVE_OPENJPEG is undefined Removed trailing whitespaces * fix: CMake find_package OpenJPEG add minimal version * Basic JPEG2K encoder Images with depth CV_8U and CV_16U are supported, with 1 to 4 channels. * feature: Improved code for OpenJPEG2000 encoder/decoder - Removed code duplication - Added error handlers - Extracted functions * feature: Update conversion openjpeg array from/to Mat * feature: Extend ChannelsIterator to fulfill RandomAccessIterator named requirements - Removed channels split in copyFromMatImpl. With ChannelsIterator no allocations are performed. - Split whole loop into 2 parts in copyToMat -> where std::copy and std::transforms are called. * fix: Applied review comments. - Changed `nullptr` in CV_LOG* functions to `NULL` - Added `falls through` comment in decoder color space `switch` - Added warning about unsupported parameters for the encoder * feature: Added decode from in-memory buffers. Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
5 years ago
if(HAVE_OPENJPEG)
ocv_include_directories(${OPENJPEG_INCLUDE_DIRS})
list(APPEND GRFMT_LIBS ${OPENJPEG_LIBRARIES})
endif()
if(HAVE_JASPER)
ocv_include_directories(${JASPER_INCLUDE_DIR})
list(APPEND GRFMT_LIBS ${JASPER_LIBRARIES})
if(OPENCV_IO_FORCE_JASPER)
add_definitions(-DOPENCV_IMGCODECS_FORCE_JASPER=1)
endif()
endif()
if(HAVE_OPENEXR)
include_directories(SYSTEM ${OPENEXR_INCLUDE_PATHS})
list(APPEND GRFMT_LIBS ${OPENEXR_LIBRARIES})
endif()
if(HAVE_GDAL)
include_directories(SYSTEM ${GDAL_INCLUDE_DIR})
list(APPEND GRFMT_LIBS ${GDAL_LIBRARY})
endif()
if(HAVE_IMGCODEC_HDR)
add_definitions(-DHAVE_IMGCODEC_HDR)
endif()
if(HAVE_IMGCODEC_SUNRASTER)
add_definitions(-DHAVE_IMGCODEC_SUNRASTER)
endif()
if(HAVE_IMGCODEC_PXM)
add_definitions(-DHAVE_IMGCODEC_PXM)
endif()
if (HAVE_IMGCODEC_PFM)
add_definitions(-DHAVE_IMGCODEC_PFM)
endif()
10 years ago
file(GLOB grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/grfmt*.hpp)
file(GLOB grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/grfmt*.cpp)
10 years ago
list(APPEND grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/bitstrm.hpp)
list(APPEND grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/bitstrm.cpp)
list(APPEND grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/rgbe.hpp)
list(APPEND grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/rgbe.cpp)
list(APPEND grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/exif.hpp)
list(APPEND grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/exif.cpp)
source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
set(imgcodecs_hdrs
10 years ago
${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
${CMAKE_CURRENT_LIST_DIR}/src/utils.hpp
)
set(imgcodecs_srcs
10 years ago
${CMAKE_CURRENT_LIST_DIR}/src/loadsave.cpp
${CMAKE_CURRENT_LIST_DIR}/src/utils.cpp
)
10 years ago
file(GLOB imgcodecs_ext_hdrs
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/legacy/*.h"
10 years ago
)
if(APPLE)
list(APPEND imgcodecs_srcs ${CMAKE_CURRENT_LIST_DIR}/src/apple_conversions.h)
list(APPEND imgcodecs_srcs ${CMAKE_CURRENT_LIST_DIR}/src/apple_conversions.mm)
endif()
if(IOS)
10 years ago
list(APPEND imgcodecs_srcs ${CMAKE_CURRENT_LIST_DIR}/src/ios_conversions.mm)
list(APPEND IMGCODECS_LIBRARIES "-framework UIKit" "-framework AssetsLibrary")
endif()
if(APPLE AND (NOT IOS))
list(APPEND imgcodecs_srcs ${CMAKE_CURRENT_LIST_DIR}/src/macosx_conversions.mm)
list(APPEND IMGCODECS_LIBRARIES "-framework AppKit")
endif()
if(APPLE_FRAMEWORK)
list(APPEND IMGCODECS_LIBRARIES "-framework Accelerate" "-framework CoreGraphics" "-framework QuartzCore")
endif()
if(TRUE)
# these variables are set by 'ocv_append_build_options(IMGCODECS ...)'
foreach(P ${IMGCODECS_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()
foreach(P ${IMGCODECS_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()
source_group("Src" FILES ${imgcodecs_srcs} ${imgcodecs_hdrs})
source_group("Include" FILES ${imgcodecs_ext_hdrs})
ocv_set_module_sources(HEADERS ${imgcodecs_ext_hdrs} SOURCES ${imgcodecs_srcs} ${imgcodecs_hdrs} ${grfmt_srcs} ${grfmt_hdrs})
ocv_module_include_directories()
ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
10 years ago
macro(ocv_imgcodecs_configure_target)
if(APPLE)
add_apple_compiler_options(the_module)
endif()
if(MSVC)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
10 years ago
endmacro()
if(NOT BUILD_opencv_world)
ocv_imgcodecs_configure_target()
endif()
ocv_add_accuracy_tests()
if(TARGET opencv_test_imgcodecs AND HAVE_JASPER AND "$ENV{OPENCV_IO_ENABLE_JASPER}")
ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_ENABLE_JASPER_TESTS=1)
endif()
ocv_add_perf_tests()