opencv出現不能執行release版本的問題

2021-09-30 13:52:09 字數 3939 閱讀 4744

針對opencv的配置網上有一大堆資料介紹,而介紹的內容也大致相同,按照網上的方法就可以配置成功opencv的debug版本的,但是當我們想要使用release版本的時候就會出現問題的,就會出現編譯通過但是執行崩潰的問題

解決方案:這個問題的原因是release版本的配置問題。針對此,我提供了一下的解決方案,就是對release版本進行配置。

具體步驟:

1. 在我們配置debug版本時,在「配置屬性管理器」中配置了附加依賴庫,就是如下的內容:

opencv_objdetect249d.lib

opencv_ts249d.lib

opencv_video249d.lib

opencv_nonfree249d.lib

opencv_ocl249d.lib

opencv_photo249d.lib

opencv_stitching249d.lib

opencv_superres249d.lib

opencv_videostab249d.lib

opencv_calib3d249d.lib

opencv_contrib249d.lib

opencv_core249d.lib

opencv_features2d249d.lib

opencv_flann249d.lib

opencv_gpu249d.lib

opencv_highgui249d.lib

opencv_imgproc249d.lib

opencv_legacy249d.lib

opencv_ml249d.lib

opencv_objdetect249.lib

opencv_ts249.lib

opencv_video249.lib

opencv_nonfree249.lib

opencv_ocl249.lib

opencv_photo249.lib

opencv_stitching249.lib

opencv_superres249.lib

opencv_videostab249.lib

opencv_calib3d249.lib

opencv_contrib249.lib

opencv_core249.lib

opencv_features2d249.lib

opencv_flann249.lib

opencv_gpu249.lib

opencv_highgui249.lib

opencv_imgproc249.lib

opencv_legacy249.lib

opencv_ml249.lib

這個動態庫共分為兩個部分,一部分是末尾加d的,比如opencv_objdetect249d.lib。一部分是末尾不加d的opencv_objdetect249.lib。

加d的表示debug版本,不加d的表示release版本!

到這裡問題就清楚了。

2.  我們只需要把debug模式的動態庫和release模式的動態庫進行交換即可。

debug模式下的動態庫配置如下:

opencv_objdetect249d.lib

opencv_ts249d.lib

opencv_video249d.lib

opencv_nonfree249d.lib

opencv_ocl249d.lib

opencv_photo249d.lib

opencv_stitching249d.lib

opencv_superres249d.lib

opencv_videostab249d.lib

opencv_calib3d249d.lib

opencv_contrib249d.lib

opencv_core249d.lib

opencv_features2d249d.lib

opencv_flann249d.lib

opencv_gpu249d.lib

opencv_highgui249d.lib

opencv_imgproc249d.lib

opencv_legacy249d.lib

opencv_ml249d.lib

opencv_objdetect249.lib

opencv_ts249.lib

opencv_video249.lib

opencv_nonfree249.lib

opencv_ocl249.lib

opencv_photo249.lib

opencv_stitching249.lib

opencv_superres249.lib

opencv_videostab249.lib

opencv_calib3d249.lib

opencv_contrib249.lib

opencv_core249.lib

opencv_features2d249.lib

opencv_flann249.lib

opencv_gpu249.lib

opencv_highgui249.lib

opencv_imgproc249.lib

opencv_legacy249.lib

opencv_ml249.lib

release模式下的動態庫配置如下:

opencv_objdetect249.lib

opencv_ts249.lib

opencv_video249.lib

opencv_nonfree249.lib

opencv_ocl249.lib

opencv_photo249.lib

opencv_stitching249.lib

opencv_superres249.lib

opencv_videostab249.lib

opencv_calib3d249.lib

opencv_contrib249.lib

opencv_core249.lib

opencv_features2d249.lib

opencv_flann249.lib

opencv_gpu249.lib

opencv_highgui249.lib

opencv_imgproc249.lib

opencv_legacy249.lib

opencv_ml249.lib

opencv_objdetect249d.lib

opencv_ts249d.lib

opencv_video249d.lib

opencv_nonfree249d.lib

opencv_ocl249d.lib

opencv_photo249d.lib

opencv_stitching249d.lib

opencv_superres249d.lib

opencv_videostab249d.lib

opencv_calib3d249d.lib

opencv_contrib249d.lib

opencv_core249d.lib

opencv_features2d249d.lib

opencv_flann249d.lib

opencv_gpu249d.lib

opencv_highgui249d.lib

opencv_imgproc249d.lib

opencv_legacy249d.lib

opencv_ml249d.lib

仔細觀察就會發現,

debug模式下,後面有d的所有動態庫都在不加d的動態庫上面。

release模式下,後面有d的所有動態庫都在不加d的動態庫下面。

重點:需要編譯什麼版本就把對應所有動態庫放到另一種模式的動態庫上面就可以了。

32位和64位處理方式同理。

linux 不能執行ifconfig

最近在用虛擬機器安裝linux 版本 root localhost network scripts lsb release a lsb version core 3.1 ia32 core 3.1 noarch graphics 3.1 ia32 graphics 3.1 noarch distri...

dbms job不能自動執行

定義了dbms job,但是一直沒執行。解決方法 alter system set job queue processes 10 原來的值是0。引數說明 檢視初始化引數job queue processes sql show parameter job queue processes 如果值為0 也...

安裝OpenCv時出現大量紅字

今天在安裝python下的opencv時,總會出現一大片紅色字。錯誤如圖 在這裡插入描述 明明是按照步驟來的,後來發現是網速限制,需要乙個映象源就可以解決。pip install opencv python 在這個後面加上 i trusted host pypi.douban.com 就可以了 合起...