I have a problem with the cv2.phase()
function. I coded the following:
img = cv2.imread("1.jpg", 0)
cv2.imshow("image", img)
img_dx = cv2.Sobel(img, cv2.CV_8U, 1, 0)
img_dy = cv2.Sobel(img, cv2.CV_8U, 0, 1)
angles = cv2.phase(img_dy, img_dx)
and it returns an assertion error when calling cv2.phase()
. Both input images to the phase function are generated by a call of the cv2.sobel()
function using the same input image. So the dtype of both input images is uint8
and they have the same size. So i dont understand why i get an assertion error.
The full error message i get is:
OpenCV Error: Assertion failed (src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F)) in cv::phase, file ..\..\..\modules\core\src\mathfuncs.cpp, line 209