Applying concurrency to image processing
First, head to the current folder for this chapter's code. Inside the input
folder, there is a subfolder called large_input
, which contains 400 images that we will be using for this example. These pictures are of different regions in our original ship image, and they have been cropped from it using the array-indexing and -slicing options that NumPy provides for slicing OpenCV image objects. If you are curious as to how these images were generated, check out the generate_input.py
file.
Our goal in this section is to implement a program that can concurrently process these images using thresholding. To do this, let's look at the example5.py
file:
from multiprocessing import Pool import cv2 import sys from timeit import default_timer as timer THRESH_METHOD = cv2.ADAPTIVE_THRESH_GAUSSIAN_C INPUT_PATH = 'input/large_input/' OUTPUT_PATH = 'output...