- added post-build deploy for OpenCV and Qt-DLLs (on windows)

- checked OpenCV-examples and improved OpenCV-copy-tool (now copies as an image column, as appropriate!)
This commit is contained in:
jkriege2 2019-11-10 15:35:07 +01:00
parent 92c1851c8c
commit 528f6fe537
53 changed files with 181 additions and 50 deletions

View File

@ -25,9 +25,6 @@ endif()
if(NOT DEFINED BUILD_EXAMPLES) if(NOT DEFINED BUILD_EXAMPLES)
option(BUILD_EXAMPLES "Build examples" ON) option(BUILD_EXAMPLES "Build examples" ON)
endif() endif()
if(NOT DEFINED BUILD_HAS_OPENCV)
option(BUILD_HAS_OPENCV "OpenCV available? If yes, OpenCV examples are built when BUILD_EXAMPLES=ON" OFF)
endif()
if(NOT DEFINED LIB_INSTALL) if(NOT DEFINED LIB_INSTALL)
option(LIB_INSTALL "Install library" ON) option(LIB_INSTALL "Install library" ON)
endif() endif()
@ -37,10 +34,10 @@ if(NOT DEFINED CMAKE_INSTALL_PREFIX)
endif() endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(jkqtplotter_deployqt)
include(jkqtplotter_deployopencv)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
if (NOT WIN32) if (NOT WIN32)
include(GNUInstallDirs) include(GNUInstallDirs)

View File

@ -0,0 +1,12 @@
function(jkqtplotter_deployopencv TARGET_NAME)
#use windeploy
if(OpenCV_FOUND)
if(WIN32)
add_custom_command(TARGET ${EXENAME} POST_BUILD # Adds a post-build event the TARGET
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_OpenCV_LIB_PATH}"
$<TARGET_FILE_DIR:${EXENAME}>
)
endif(WIN32)
endif(OpenCV_Found)
endfunction(jkqtplotter_deployopencv)

View File

@ -0,0 +1,30 @@
function(jkqtplotter_deployqt TARGET_NAME)
#use windeploy
if (WIN32)
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
set(WINDEPLOYQTOPTION "--release")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(WINDEPLOYQTOPTION "--debug")
endif()
# install system runtime lib
include( InstallRequiredSystemLibraries )
if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT System )
endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
get_filename_component(CMAKE_CXX_COMPILER_BINPATH ${CMAKE_CXX_COMPILER} DIRECTORY )
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E
env PATH="${CMAKE_CXX_COMPILER_BINPATH}\;${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}"
--compiler-runtime
${WINDEPLOYQTOPTION}
\"$<TARGET_FILE:${TARGET_NAME}>\"
COMMENT "Running windeployqt ... "
)
endif(WIN32)
endfunction(jkqtplotter_deployqt)

View File

@ -24,3 +24,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -1,34 +1,37 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
if (BUILD_HAS_OPENCV) find_package( OpenCV )
find_package( OpenCV ) if(OpenCV_FOUND)
if(OpenCV_FOUND)
set(EXAMPLE_NAME imageplot_opencv) set(EXAMPLE_NAME imageplot_opencv)
set(EXENAME jkqtptest_${EXAMPLE_NAME}) set(EXENAME jkqtptest_${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" ) message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
# Set up source files # Set up source files
set(SOURCES ${EXAMPLE_NAME}.cpp) set(SOURCES ${EXAMPLE_NAME}.cpp)
set(HEADERS ) set(HEADERS )
set(RESOURCES ) set(RESOURCES )
set(UIS ) set(UIS )
add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS}) add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
target_include_directories(${EXENAME} PRIVATE ../../lib) target_include_directories(${EXENAME} PRIVATE ../../lib)
if(BUILD_STATIC_LIBS) if(BUILD_STATIC_LIBS)
target_link_libraries(${EXENAME} JKQTPlotterLib) target_link_libraries(${EXENAME} JKQTPlotterLib)
elseif(BUILD_SHARED_LIBS) elseif(BUILD_SHARED_LIBS)
target_link_libraries(${EXENAME} JKQTPlotterSharedLib) target_link_libraries(${EXENAME} JKQTPlotterSharedLib)
endif() endif()
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories(${EXENAME} ${OpenCV_INCLUDE_DIRS} )
target_link_libraries(${EXENAME} ${OpenCV_LIBS} ) target_link_libraries(${EXENAME} ${OpenCV_LIBS} )
# Installation
if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})
#Installation of OpenCV DLLs on Windows
jkqtplotter_deployopencv(${EXENAME})
endif(OpenCV_FOUND)
# Installation
if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL)
endif(OpenCV_FOUND)
endif()

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -29,3 +29,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -28,3 +28,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -29,3 +29,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -36,3 +36,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
if (BUILD_HAS_OPENCV) find_package( OpenCV )
find_package( OpenCV ) if (OpenCV_FOUND)
if(OpenCV_FOUND)
set(EXAMPLE_NAME rgbimageplot_opencv) set(EXAMPLE_NAME rgbimageplot_opencv)
set(EXENAME jkqtptest_${EXAMPLE_NAME}) set(EXENAME jkqtptest_${EXAMPLE_NAME})
@ -21,7 +20,7 @@ if (BUILD_HAS_OPENCV)
elseif(BUILD_SHARED_LIBS) elseif(BUILD_SHARED_LIBS)
target_link_libraries(${EXENAME} JKQTPlotterSharedLib) target_link_libraries(${EXENAME} JKQTPlotterSharedLib)
endif() endif()
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories(${EXENAME} ${OpenCV_INCLUDE_DIRS} )
target_link_libraries(${EXENAME} ${OpenCV_LIBS} ) target_link_libraries(${EXENAME} ${OpenCV_LIBS} )
@ -29,5 +28,12 @@ if (BUILD_HAS_OPENCV)
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
endif(OpenCV_FOUND) #Installation of Qt DLLs on Windows
endif(BUILD_HAS_OPENCV) jkqtplotter_deployqt(${EXENAME})
#Installation of OpenCV DLLs on Windows
jkqtplotter_deployopencv(${EXENAME})
add_custom_command(TARGET ${EXENAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/rgbimageplot_opencv_example.bmp" $<TARGET_FILE_DIR:${EXENAME}>
)
endif(OpenCV_FOUND)

View File

@ -46,9 +46,6 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data // 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot); JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot);
graph->setTitle(""); graph->setTitle("");
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
graph->setNx(picture.cols);
graph->setNy(picture.rows);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner) // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->setX(0); graph->setX(0);
graph->setY(0); graph->setY(0);
@ -56,6 +53,7 @@ int main(int argc, char* argv[])
graph->setWidth(picture.cols); graph->setWidth(picture.cols);
graph->setHeight(picture.rows); graph->setHeight(picture.rows);
// image column with the data // image column with the data
// Note: this also sets the matrix sized Nx and Ny!!!
graph->setImageRColumn(cPictureR); graph->setImageRColumn(cPictureR);
graph->setImageGColumn(cPictureG); graph->setImageGColumn(cPictureG);
graph->setImageBColumn(cPictureB); graph->setImageBColumn(cPictureB);

View File

@ -30,7 +30,7 @@ int main(int argc, char* argv[])
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat // 2. now we open a BMP-file and load it into an OpenCV cv::Mat
cv::Mat picture = cv::imread("example.bmp"); cv::Mat picture = cv::imread("rgbimageplot_opencv_example.bmp");
qDebug()<<picture.rows<<"x"<<picture.cols<<"x"<<picture.channels(); qDebug()<<picture.rows<<"x"<<picture.cols<<"x"<<picture.channels();
@ -46,9 +46,6 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data // 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot); JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot);
graph->setTitle(""); graph->setTitle("");
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
graph->setNx(picture.cols);
graph->setNy(picture.rows);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner) // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->setX(0); graph->setX(0);
graph->setY(0); graph->setY(0);
@ -56,9 +53,9 @@ int main(int argc, char* argv[])
graph->setWidth(picture.cols); graph->setWidth(picture.cols);
graph->setHeight(picture.rows); graph->setHeight(picture.rows);
// image column with the data // image column with the data
graph->setImageRColumn(cPictureR); graph->setImageRColumn(static_cast<int>(cPictureR));
graph->setImageGColumn(cPictureG); graph->setImageGColumn(static_cast<int>(cPictureG));
graph->setImageBColumn(cPictureB); graph->setImageBColumn(static_cast<int>(cPictureB));
// determine min/max of each channel manually // determine min/max of each channel manually
graph->setImageMinR(0); graph->setImageMinR(0);
graph->setImageMaxR(255); graph->setImageMaxR(255);

View File

Before

Width:  |  Height:  |  Size: 412 KiB

After

Width:  |  Height:  |  Size: 412 KiB

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -26,3 +26,5 @@ endif()
if(LIB_INSTALL) if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL) endif(LIB_INSTALL)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})

View File

@ -77,7 +77,7 @@ inline size_t JKQTPCopyCvMatToColumn(JKQTPDatastore* datastore, const cv::Mat& m
else if (CV_MAT_DEPTH(mat.type())==CV_8U) JKQTPDatastore_Helper::copyDataFromMat<uint8_t>(d, mat, channel); else if (CV_MAT_DEPTH(mat.type())==CV_8U) JKQTPDatastore_Helper::copyDataFromMat<uint8_t>(d, mat, channel);
else throw std::runtime_error("datatype of cv::Mat not supported by JKQTPDatastore::copyImageToColumn()"); else throw std::runtime_error("datatype of cv::Mat not supported by JKQTPDatastore::copyImageToColumn()");
return datastore->addInternalColumn(d, N, name); return datastore->addInternalImageColumn(d, mat.cols, mat.rows, name);
} }