meiqua / shape_based_matching

try to implement halcon shape based matching, refer to machine vision algorithms and applications, page 317 3.11.5, written by halcon engineers
BSD 2-Clause "Simplified" License
1.23k stars 480 forks source link

Cmake + OpenCV3.0無法通過 #31

Open DennisLiu-elogic opened 5 years ago

DennisLiu-elogic commented 5 years ago

您好,我使用Cmake-gui嘗試建置專案。 我的OpenCV安裝路徑 : C:/OpenCV3.0

CMakeLists.txt中 :

...

opencv

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} C:/OpenCV3.0/opencv/build) find_package(OpenCV 3 REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) ...

Configure第一次結果 :

OpenCV ARCH: x86 OpenCV RUNTIME: OpenCV STATIC: ON CMake Warning at C:/OpenCV3.0/opencv/build/OpenCVConfig.cmake:166 (message): Found OpenCV Windows Pack but it has no binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first): CMakeLists.txt:32 (find_package)

CMake Error at CMakeLists.txt:32 (find_package): Found package configuration file:

C:/OpenCV3.0/opencv/build/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.

能否給點建議?感謝

meiqua commented 5 years ago

可以试试绕过cmake,新建个vs工程,手动把opencv配置下,然后把MIPP加到include path里。

DennisLiu-elogic commented 5 years ago

你好,照了你的建議建置VS工程,專案可以使用了 但是執行速度極慢 (如圖) image

這樣是正常的嗎?

DennisLiu-elogic commented 5 years ago

--old-- image 我的電腦使用checkHardwareSupport查看優化狀態為如此 還是我需要自己define SSE AVX (如mipp.h中的內容)...?

---06:08--

設定O2、OpenMP後速度明顯快很多 ( < 1s) 但MIPP_test ()訊息依然是 Instr. type: NO Instr. full type: NO_INTRINSICS Instr. version: 1 Instr. size: 0 bits Instr. lanes: 1 64-bit support: no Byte/word support: yes in this SIMD, int8 max is not inplemented by MIPP in this SIMD, int8 shuff is not inplemented by MIPP

是否有東西我沒注意到? 感謝回復!

meiqua commented 5 years ago

VS里也需要设置下SIMD

DennisLiu-elogic commented 5 years ago

你好 : 避免多開一issue,直接在這發問

image 這張圖是我拿其他專案來測試的,模板與來源都為二值化的後的影像 但這次結果似乎是匹配到梯度為0的地方,有什麼想法嗎?謝謝

meiqua commented 5 years ago

粗匹配的结果差一两个像素正常。如果需要完全对准,可以后面加icp,参考其他branch。

DennisLiu-elogic commented 5 years ago

你好,我下載了cuda_icp資料夾,放到MIPP同層 專案多設定一個include目錄(cuda_icp) (不使用CMake) 編譯時會找不到Eigen相關的目錄,這個是要額外下載的嗎?

--16:10-- 將cuda_icp的.h .cpp全部加入專案內,include Eigen資料夾 編譯後的錯誤訊息都跟OpenMP相關

  1. 'declare': 需要 OpenMP 指示詞名稱
  2. 'reducer': 'reduction' 子句中的變數必須有純量算術類型
  3. 'pcd_iter': OpenMP 'for' 陳述式中的索引變數必須具有帶正負號的整數類資料類型
meiqua commented 5 years ago

是的

meiqua commented 5 years ago

可以把openmp这几行注释掉,影响不大

DennisLiu-elogic commented 5 years ago

@meiqua 感謝大神快速回復!

另外有些想法想與你討論,昨天我看了工廠的機台用Cognex的形狀匹配,發現Cognex訓練模板時會將整個輪廓畫出來,與使用Canny時非常相似 (我猜選用的特徵點也幾乎遍布畫出來的輪廓,數量多),是否在選定特徵點的時候參考Canny的算法比較好? 我知道雙閥值已經有Canny的味道,但是現在這個專案就算把feature number調高也沒辦法找到那麼多特徵點

meiqua commented 5 years ago

画出来的不一定都会选。设置成固定数量主要是这么多已经够了,点选特别多反而拖慢速度。当然想全选也可以。

huynhbaobk commented 4 years ago

--old-- image 我的電腦使用checkHardwareSupport查看優化狀態為如此 還是我需要自己define SSE AVX (如mipp.h中的內容)...?

---06:08--

設定O2、OpenMP後速度明顯快很多 ( < 1s) 但MIPP_test ()訊息依然是 Instr. type: NO Instr. full type: NO_INTRINSICS Instr. version: 1 Instr. size: 0 bits Instr. lanes: 1 64-bit support: no Byte/word support: yes in this SIMD, int8 max is not inplemented by MIPP in this SIMD, int8 shuff is not inplemented by MIPP

是否有東西我沒注意到? 感謝回復!

Hi @DennisLiu-elogic , could you explain to me more details "設定O2、OpenMP後速度明顯快很多"? how to do this?

DennisLiu-elogic commented 4 years ago

@huynhbaobk image set O2 here

image set OpenMP here

DennisLiu1993 commented 2 years ago

@huynhbaobk 可以參考我的github,shape matching的替代方案 https://github.com/DennisLiu1993/Fastest_Image_Pattern_Matching

huynhbaobk commented 2 years ago

可以參考我的github,shape matching的替代方案

Great work!

cheny00 commented 2 years ago

您好,我留意过您的github,想了解一下你这里用ncc方式是如何实现亚像素的效果呢

DennisLiu1993 commented 2 years ago

這裡