Python Forum

Full Version: cv2.resize(...) shutting down processes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have multiple processes running, and in each, I am trying to resize and image using cv2.resize()

However, when I try, it just seems like the processes end there and then. There are no errors - not a single bit of output, it just ends.

Say I have this:
#do some image processing - image is now stored in 'img':
resized = cv2.resize(img, (10,10))
print(resize)
The output will be some resized numpy array which is correct.
However, if I now do this:
#create some processes - each process runs the piece of code below:
#do some image processing - image is now stored in 'img':
resized = cv2.resize(img, (10,10))
print(resize)
There is NO output. It just ends the process at the resize line.

I have tried debugging it with pdb, and I get no info on it - again it just ends.
I also added this at the beginning of the script:
import logging
mpl = multiprocessing.log_to_stderr()
mpl.setLevel(logging.DEBUG)
And then ran it with pdb - this is what I got:
Output:
(Pdb) b 439 Breakpoint 1 at /Users/everyone/Desktop/SubreddimagesV2/get_images_no_gif.py:439 (Pdb) c END Value missing from arguments! [LOG]: Creating gif [INFO/Process-1] child process calling self.run() [INFO/Process-2] child process calling self.run() > /Users/everyone/Desktop/SubreddimagesV2/get_images_no_gif.py(439)create_image_gif() -> resized = cv2.resize(new_img, (new_img.shape[1]//2, new_img.shape[0]//2, new_img.shape[2])) (Pdb) [INFO/Process-1] process shutting down [DEBUG/Process-1] running all "atexit" finalizers with priority >= 0 [DEBUG/Process-1] running the remaining "atexit" finalizers Process Process-1: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/Users/everyone/Desktop/SubreddimagesV2/get_images_no_gif.py", line 439, in create_image_gif resized = cv2.resize(new_img, (new_img.shape[1]//2, new_img.shape[0]//2, new_img.shape[2])) File "/Users/everyone/Desktop/SubreddimagesV2/get_images_no_gif.py", line 439, in create_image_gif resized = cv2.resize(new_img, (new_img.shape[1]//2, new_img.shape[0]//2, new_img.shape[2])) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 51, in trace_dispatch return self.dispatch_line(frame) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 70, in dispatch_line if self.quitting: raise BdbQuit bdb.BdbQuit [INFO/Process-1] process exiting with exitcode 1
Now, 'exitcode 1' means there was some kind of error - i'm not sure if this is what is causing the problem, or if it is just because it was quit through this line:
if self.quitting: raise BdbQuit
Either way, what is going on here? Why is cv2.resize not working?
Anyone got an idea?

I already have a workaround in my code but I'm still curious as to know what's going on.