XcodeのDisable Library Validationにチェックすると、解消します。
エラー
dyld: Library not loaded: /usr/local/opt/opencv/lib/libopencv_features2d.4.4.dylib
Referenced from: /Users/oosuyuuki/Library/Developer/Xcode/DerivedData/RectangleDetection-akoxhwvgxqqsyydewscmnhcsbdzy/Build/Products/Debug/RectangleDetection
Reason: no suitable image found. Did find:
/usr/local/opt/opencv/lib/libopencv_features2d.4.4.dylib: code signature in (/usr/local/opt/opencv/lib/libopencv_features2d.4.4.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/lib/libopencv_features2d.4.4.dylib: code signature in (/usr/local/lib/libopencv_features2d.4.4.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/Cellar/opencv/4.4.0_1/lib/libopencv_features2d.4.4.0.dylib: code signature in (/usr/local/Cellar/opencv/4.4.0_1/lib/libopencv_features2d.4.4.0.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
(lldb)
原因
GatekeeperとSoftware notarizedによる制限のようです。下記の記事が参考になります。
https://qiita.com/Arime/items/e1df2a8c3d4c2ce75069
参考
XcodeでOpenCVを使う手順については、下記の記事が参考になります。
https://qiita.com/KakeruMasuda/items/49d369ab49fac5ea3eab