I have a python function that takes in an image path and outputs true or false depending whether the image is black or not. I want to process several images on the same machine and stop the process if even one of them is not black. I read a lot of multiprocessing in python, celery etc here, but I am not sure where to start.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
I would suggest looking at Pools to easily create processes on the fly. If you need to have some shared state, in this case a boolean indicating a non-black image has been found, look at Managers.
Update: Here is an example of what I mean.
Finally this works nicely for me. Copied it from an example here. For illustration purpose I have replaced my _isImgNonBlack function and the image sequence as a list of 0's and 1's, where 0 being a black image and 1 non-black image.