-
Notifications
You must be signed in to change notification settings - Fork 38
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
ModuleNotFoundError: No module named 'caartoonize' #1
Comments
There is a spelling mistake there. Change the import from caartoonize to cartoonize, it will work. |
Thanks a lot, it works after I change the word. But, when i try to run: python vid.py, it shows me an error:
I seems like missing some values in either imread() or findContours() method. |
In cartoonize.py, comment out the lines outside the caart function(lines 111 and so) since they are used for images to call the function. These lines may be interfering with the actual function for videos. Also, I tried running the same code and there seem to be no other errors. |
Thanks for your patience, when i comment out line 111 and line 112 in cartoonize.py, the first error solved. however, there is still a error It seems like, the findContours() function return more than two items, so the error happened. |
Its no problem, thank you for the doubts. So I checked the OpenCV documentation and there seem to be 3 values that the findContours() function returns. The issue is that I ran the same code today and there was no error. Maybe it is because of version changes. Try using 3 values as input to the function, with the middle value as contours. This should solve the problem |
Since the error says that the output values unpacked were 0, the image is
not loaded correctly. It mostly means that your path to the image may be
incorrect
…On Sun, Dec 27, 2020 at 10:47 PM maitra ***@***.***> wrote:
I have a different, perhaps related error:
Traceback (most recent call last):
File "/home/personal/cartoons/Cartoonify_reality-master/cartoonize.py", line 111, in <module>
output=caart(cv2.imread("original.jpg"))
File "/home/personal/cartoons/Cartoonify_reality-master/cartoonize.py", line 72, in caart
x,y,c=output.shape
ValueError: not enough values to unpack (expected 3, got 0)
How do I get around this error? Thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALDK6QZ3E5HKNJFMHWP2733SW5T2JANCNFSM4SMTXN7Q>
.
|
yes, you may consider fixing the line that is supposed to be uncommented. By default, the filename should be original2.jpg. But thanks for the code. |
Happy to help |
Btw, the k-means clustering: does it cluster by individual channel? What is K here? |
It clusters the channels individually. So normally, an image is 8-bit right. In this, we try to cluster the 8-bits into 4-5 bits to reduce the number of colors. K is the number of bits. |
I see, thanks! I wonder if we can distort the cartoon. Perhaps adding random noise to the contours might do it. Btw, separately, askopenfile from tkinter can stop the hardcoding of the input. |
Hereis how you can do this. Should probably fix the output too, just add cartoon.jpg, after the filename (without extension). |
How would distortion help?? |
Distortion would make the image into a true cartoon. Right now, it really makes outlines of the images and that is pretty much it. Right? |
As of now, it reduces the bit size of the image and utilizes other OpenCV filters for contours and edges. I haven't thought of it by using distortion, but you can try and see for yourself. |
Yes, indeed. It will require more work than available routines. There are at least two ways of going about it. Perhaps reduce the widths of the contours randomly, and create an optical illusion. Another, more correct approach spatially distort the contours. |
That is a nice idea indeed |
when i try to run: python vid.py. it shows error :"ModuleNotFoundError: No module named 'caartoonize'"
The text was updated successfully, but these errors were encountered: