a = np.array([[[255,0,0]]*100]*100)
a = cv2.cvtColor(a, cv2.COLOR_RGB2BGR)
plt.imshow(a)
J'ai eu cette erreur.
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)
Par défaut, np.array a un dtype de int64. Cependant, les arguments de cv2.cvtColor () doivent être uint8 et uint16.
https://stackoverflow.com/questions/50319617/opencv-error-cv2-cvtcolor https://postd.cc/image-processing-101/
Recommended Posts