활연개랑

[OpenCV] error: OpenCV(4.1.2) /io/opencv/modules/core/src/arithm.cpp:229: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op arr.. 본문

딥러닝

[OpenCV] error: OpenCV(4.1.2) /io/opencv/modules/core/src/arithm.cpp:229: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op arr..

승해tmdhey 2021. 10. 28. 20:55
반응형

openCV에서 다음과 같은 오류는

bitwise_and 연산을 수행할 때 img와 mask의 

데이터 타입이나 채널 수가 맞지 않아 생기는 오류입니다.

 

문제 해결 방법:

1. 이 오류의 경우 이미지가 잘못 들어갔을 가능성이 가장 큽니다. 

이미지 불러오기를 확인해봅시다. 

 

2. 

img와 mask의 shape을 확인하시면

이와 같은 결과가 나올 수 있습니다.

이 결과값의 의미는

img shape이 (1404,736,3)이고,

mask shape이 (1404,736) 이라는 의미이니,

위에 함수에서 binary가 안되어 있을 것입니다.

그부분 확인해주시면되겠습니다.