rastercarve icon indicating copy to clipboard operation
rastercarve copied to clipboard

error in cvtColor() call

Open mjcastillo opened this issue 4 years ago • 3 comments

I am getting an error running this locally with an image that work when I run it on the hosted live version, so pretty sure the image is good, Here is the error. Any ideas on why this assertion is failing? Something likely wrong in my environment (windows 10, python3)?

Traceback (most recent call last): File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\rastercarve-script.py", line 33, in sys.exit(load_entry_point('rastercarve==1.0.8', 'console_scripts', 'rastercarve')()) File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\rastercarve_main_.py", line 458, in main doEngrave() File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\rastercarve_main_.py", line 315, in doEngrave img = ~cv2.cvtColor(cv2.imread(glob_args.filename), cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

PS C:\Users\Mikej\Downloads\rastercarve-master\rastercarve-master> rastercarve --width 5 -d .05 -s 100 --metric --no-line-numbers examples/105-0521_IMG.JPG > out.nc Traceback (most recent call last): File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\rastercarve-script.py", line 33, in sys.exit(load_entry_point('rastercarve==1.0.8', 'console_scripts', 'rastercarve')()) File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\rastercarve_main_.py", line 458, in main doEngrave() File "C:\Users\Mikej\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\rastercarve_main_.py", line 315, in doEngrave img = ~cv2.cvtColor(cv2.imread(glob_args.filename), cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

mjcastillo avatar Aug 27 '21 16:08 mjcastillo

something with the image because it works for many other images I have. The weird thing is the hosted version (live) of rastercarve handle the print just fine. Maybe a different version on the hosted site? Any ideas on how to work around this (e.g. try and older version of the code)? Thanks

mjcastillo avatar Aug 27 '21 17:08 mjcastillo

Hi,

Thanks for reporting this issue. I'm guessing the cause is a failed call to opencv's imread(), probably because something is weird about your image. Could you post the image here so we can investigate further?

The hosted site is running in a Docker container with opencv-python 4.2.0.32 on Debian Buster, if that's of any help to you.

built1n avatar Aug 30 '21 01:08 built1n

There are actually a few that fail. One thing in common though is I edited them with the standard Microsoft (Windows 10) photo editor and added a ‘Vanilla’ filter to it (to make it look black and white) and that might have made the photo include something that the openCV stuff doesn’t like. Photo attached that should give the error (although, like I said the hosted site processes it fine). Thanks!    From: Franklin WeiSent: Sunday, August 29, 2021 7:05 PMTo: built1n/rastercarveCc: mjcastillo; AuthorSubject: Re: [built1n/rastercarve] error in cvtColor() call (#5) Hi,Thanks for reporting this issue. I'm guessing the cause is a failed call to opencv's imread(), probably because something is weird about your image. Could you post the image here so we can investigate further?The hosted site is running in a Docker container with opencv-python 4.2.0.32 on Debian Buster, if that's of any help to you.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.  

mjcastillo avatar Aug 30 '21 03:08 mjcastillo