일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- cv2
- keras
- img
- loss
- itksnap
- TensorFlow
- Perceptron
- 세계대전
- terminal
- Training
- Inference
- deeplearning
- TFRecord
- qtdesigner
- 유로화
- numpy
- 세계사
- dtype
- 유가 급등
- 블록체인
- error
- 딥러닝
- pyqt
- 퍼셉트론
- TF
- opencv
- 브렉시트
- DataSet
- Python
- 비트코인
Archives
- Today
- Total
활연개랑
[OpenCV] findcontours 오류 [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl' 본문
Python
[OpenCV] findcontours 오류 [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'
승해tmdhey 2022. 4. 11. 13:28반응형
_, bi_binary = cv2.threshold(roi_1, 0, 255, cv2.THRESH_BINARY)
contours, hierarchy = cv2.findContours(bi_binary, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
findcontours를 하기 위해 위 코드를 실행하는 과정에서 다음과 같은 오류가 발생하였습니다.
cv2.error: OpenCV(4.5.5) /io/opencv/modules/imgproc/src/contours.cpp:195: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'
이 오류가 나는 이유는 여러가지가 있지만, 구글링에서 잘 나오지 않는 오류 이유는 dtype이 unit8이어야 한다는 점입니다.
findcontour를 할 때 array의 dtype이 unit8이어야 코드가 돌아가므로 일단 unit8로 맞춰두신 후에도 오류가 난다면 또 다른 구글링을 해보시기 바랍니다..