#Each pic's size is 1280x720
import time
from multiprocessing import Process,JoinableQueue,Queue,Value
**def create_row(M, q_row,y_val):** #creating lines. len:720 len of each
line_len=720
col_len=1280
for i in range(line_len):
q_row.put(M[(i*col_len):((i+1)*col_len)])
**def create_col(M, q_col,x_val):** #creating cols
col_len=1280
line_len=720
for i in range(col_len):
l = list()
for j in range(line_len):
l.append(M[j*line_len + i])
q_col.put(l)
**def main():**
#creating row and col Queue
q_row=JoinableQueue()
q_col=JoinableQueue()
x_val=Value('i',-1)
y_val=Value('i',-1)
p1=Process(target=create_row,args=(M,q_row,y_val))
p2=Process(target=create_col,args=(M,q_col,x_val))
q_row.join()
q_col.join()
p1.start()
p2.start()
p1.join()
p2.join()
Now to the problem:
M is a list in size of 1280*720, which represent a picture.
We want to divide the list into rows and cols, so we can go through the picture faster.
We tried few things:
Without joining the processes: in that scenario only one of the functions will work (We will get either the row_q only or the col_q)
With joining the process:: The program will freeze.
What should I do?