Cartoonify_reality
Cartoonify_reality copied to clipboard
ModuleNotFoundError: No module named 'caartoonize'
when i try to run: python vid.py. it shows error :"ModuleNotFoundError: No module named 'caartoonize'"
when i try to run: python vid.py. it shows error :"ModuleNotFoundError: No module named 'caartoonize'"
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:
(cartoon) shideMacBook-Pro-4:Cartoonify_reality-master shi$ python vid.py Traceback (most recent call last): File "vid.py", line 3, in <module> from cartoonize import caart File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 111, in <module> output=caart(cv2.imread("original.jpg")) File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 102, in caart contours,_=cv2.findContours(edge,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: too many values to unpack (expected 2)
I seems like missing some values in either imread() or findContours() method. Have you seen this error before?
Thanks a lot, it works after I change the word.
But, when i try to run: python vid.py, it shows me an error:
(cartoon) shideMacBook-Pro-4:Cartoonify_reality-master shi$ python vid.py Traceback (most recent call last): File "vid.py", line 3, in <module> from cartoonize import caart File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 111, in <module> output=caart(cv2.imread("original.jpg")) File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 102, in caart contours,_=cv2.findContours(edge,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: too many values to unpack (expected 2)
I seems like missing some values in either imread() or findContours() method. Have you seen this error before?
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 cartoon) shideMacBook-Pro-4:Cartoonify_reality-master shi$ python vid.py Traceback (most recent call last): File "vid.py", line 14, in <module> img=caart(img) File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 102, in caart contours,_=cv2.findContours(edge,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: too many values to unpack (expected 2)
It seems like, the findContours() function return more than two items, so the error happened. Do you have any idea about this error?
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
cartoon) shideMacBook-Pro-4:Cartoonify_reality-master shi$ python vid.py Traceback (most recent call last): File "vid.py", line 14, in <module> img=caart(img) File "/Users/shi/Desktop/Cartoonify_reality-master/cartoonize.py", line 102, in caart contours,_=cv2.findContours(edge,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) ValueError: too many values to unpack (expected 2)
It seems like, the findContours() function return more than two items, so the error happened. Do you have any idea about this error?
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 [email protected] 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
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 https://github.com/Shaashwat05/Cartoonify_reality/issues/1#issuecomment-751493148, 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.
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?
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.
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.
def select_input() -> None:
file = askopenfile(title='Please select one (any) frame from your set of ima
ges.',
filetypes=[('Image Files', ['.jpeg', '.jpg', '.png', '.gi
f',
'.tiff', '.tif', '.bmp'])])
if file != None:
return(file.name)
img_path=select_input()
output=caart(cv2.imread(img_path))
Hereis how you can do this. Should probably fix the output too, just add cartoon.jpg, after the filename (without extension).
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.
How would distortion help??
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.
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?
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.
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.
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.
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