Supposing I have to run this code for 500.000.000 pixels.
import cv2
path_of_the_picture = "photo.jpg"
picture = cv2.imread(path_of_the_picture, cv2.IMREAD_UNCHANGED)
number_of_rows,number_of_cols = picture.shape
for x in range(number_of_rows):
for y in range(number_of_cols):
picture[x,y] = picture[x,y] + 10
It takes around 30min to complete! Ok, maybe it needs some editing to run, but you get the idea. How can I accelerate the above code with multithreaded code in python? Moreover, can I use some GPU-CUDA power? After searching I found this suggestion: How to Multi-thread an Operation Within a Loop in Python but it does not work for my situation...