a = np.array([[[255,0,0]]*100]*100)
a = cv2.cvtColor(a, cv2.COLOR_RGB2BGR)
plt.imshow(a)
Ich habe diesen Fehler bekommen.
error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.simd_helpers.hpp:94: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<3, 4>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = (cv::impl::<unnamed>::SizePolicy)2u; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
a = np.array([[[255,0,0]]*100]*100,np.uint8)
a = cv2.cvtColor(a, cv2.COLOR_RGB2BGR)
plt.imshow(a)
Standardmäßig hat np.array den dtype int64. Die Argumente von cv2.cvtColor () müssen jedoch uint8 und uint16 sein.
https://stackoverflow.com/questions/50319617/opencv-error-cv2-cvtcolor https://postd.cc/image-processing-101/
Recommended Posts