lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.02k stars 187 forks source link

An error occurs when running CMake_OpenCV of examples_for_PC. #504

Closed dtorannpu closed 2 months ago

dtorannpu commented 4 months ago

Environment ( 実行環境 )

Problem Description ( 問題の内容 )

cv::Exception occurs

Expected Behavior ( 期待される動作 )

A screen like the one below will appear. https://github.com/lovyan03/LovyanGFX/tree/master/examples_for_PC 「デバッグ中の様子(サンプルコード)」

Actual Behavior ( 実際の動作 )

cv::Exception occurs image image

Steps to reproduce ( 再現のための前提条件 )

  1. https://github.com/lovyan03/LovyanGFX/tree/master/examples_for_PC Follow the steps to run the OpenCV sample

Code to reproduce this issue ( 再現させるためのコード )

Please submit complete source code that can reproduce your problem. あなたの問題を再現できる完全なソースコードを提示してください。

cmake_minimum_required (VERSION 3.8)
project(LGFXOpenCV)

add_definitions(-DLGFX_OPENCV)

add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")

# ビルド対象にするファイルを指定する;
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS 
    *.cpp
    ../../../LovyanGFX/src/lgfx/Fonts/efont/*.c
    ../../../LovyanGFX/src/lgfx/Fonts/IPA/*.c
    ../../../LovyanGFX/src/lgfx/utility/*.c
    ../../../LovyanGFX/src/lgfx/v1/*.cpp
    ../../../LovyanGFX/src/lgfx/v1/misc/*.cpp
    ../../../LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
    ../../../LovyanGFX/src/lgfx/v1/platforms/opencv/*.cpp
    )
add_executable (LGFXOpenCV ${Target_Files})

# includeするファイルのパスを指定する;
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
target_include_directories(LGFXOpenCV PUBLIC "../../../LovyanGFX/src")

# OpenCVを配置したパス内のincludeのパスを指定する;
target_include_directories(LGFXOpenCV PUBLIC "C:/opencv/build/include")

# OpenCVを配置したパス内の.libファイルのパスを指定する;
target_link_libraries(LGFXOpenCV PUBLIC "C:/opencv/build/x64/vc16/lib/opencv_world490d.lib" )

target_compile_features(LGFXOpenCV PUBLIC cxx_std_17)

Remarks

It seems that cv::getWindowProperty has been changed since OpenCV4.5.3 to throw an exception if called while no window is open. https://github.com/opencv/opencv/blob/ad6e82942b37be8ee2c71c1d9bc7fe79cd16f7ab/modules/highgui/src/window.cpp#L277 https://github.com/opencv/opencv/blob/ad6e82942b37be8ee2c71c1d9bc7fe79cd16f7ab/modules/highgui/src/window_w32.cpp#L842

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 months ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.