-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot work in opencv 3 #4
Comments
is this solved? |
@satyarepala, @apollos I'm using OpenCV version: My _create_derivative function looks like this: @classmethod
def _create_derivative(cls, filepath):
img = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE)
edges = cv2.Canny(img, 175, 320, apertureSize=3)
# Create gradient map using Sobel
sobelx64f = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=-1)
sobely64f = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=-1)
theta = np.arctan2(sobely64f, sobelx64f)
if diagnostics:
cv2.imwrite('edges.jpg', edges)
cv2.imwrite('sobelx64f.jpg', np.absolute(sobelx64f))
cv2.imwrite('sobely64f.jpg', np.absolute(sobely64f))
# amplify theta for visual inspection
theta_visible = (theta + np.pi)*255/(2*np.pi)
cv2.imwrite('theta.jpg', theta_visible)
return (edges, sobelx64f, sobely64f, theta) goodluck! |
I get the exact same error in both situations. "0 vs cv2.IMREAD_GRAYSCALE" |
Run the swt.py but get the followed error:
root@mydev:~/workspace/StrokeWidthTransform# python swt.py
OpenCV Error: Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /root/workspace/opencv/modules/core/src/matrix.cpp, line 981
finally
Traceback (most recent call last):
File "swt.py", line 366, in
final_mask = SWTScrubber.scrub(local_filename)
File "swt.py", line 28, in scrub
canny, sobelx, sobely, theta = cls._create_derivative(filepath)
File "swt.py", line 44, in _create_derivative
sobelx64f = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=-1)
cv2.error: /root/workspace/opencv/modules/core/src/matrix.cpp:981: error: (-215) dims <= 2 && step[0] > 0 in function locateROI
print cv2.version
3.3.0
The text was updated successfully, but these errors were encountered: