Beispiel #1
0
def lv2_HDR_proc(lv2_in_queue, lv3_in_queue):
    calc1 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    calc2 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    calc3 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    out_frame = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    info('lv2')
    while True:
        try:
            v = lv2_in_queue.get()  #get
            if v is None:
                break
            if v[1] == 1:
                out_frame[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], calc1[:, :,
                                                                         0])
                out_frame[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], calc1[:, :,
                                                                         1])
                out_frame[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], calc1[:, :,
                                                                         2])
                lv3_in_queue.put((out_frame, 0))  # calc2 + calc1 --> calc4
                calc2 = v[0]
            elif v[1] == 2:
                out_frame[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], calc2[:, :,
                                                                         0])
                out_frame[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], calc2[:, :,
                                                                         1])
                out_frame[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], calc2[:, :,
                                                                         2])
                lv3_in_queue.put((out_frame, 1))  # calc3 + calc2 --> calc5
                calc3 = v[0]
            elif v[1] == 0:
                calc1 = v[0]
        except queue.Empty:
            continue
        except Exception as e:
            raise e
Beispiel #2
0
def lv1_HDR_proc(lv1_in_queue, lv2_in_queue):
    frame1 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    frame2 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    frame3 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    frame4 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    out_frame = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    info('lv1')
    while True:
        try:
            v = lv1_in_queue.get()  #get
            if v is None:
                break
            if v[1] == 1:  #v[1] == f2q
                out_frame[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], frame1[:, :,
                                                                          0])
                out_frame[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], frame1[:, :,
                                                                          1])
                out_frame[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], frame1[:, :,
                                                                          2])
                lv2_in_queue.put((out_frame, 0))  # frame1 + frame2 --> calc1
                frame2 = v[0]
            elif v[1] == 2:  #v[1] == f4q
                out_frame[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], frame2[:, :,
                                                                          0])
                out_frame[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], frame2[:, :,
                                                                          1])
                out_frame[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], frame2[:, :,
                                                                          2])
                lv2_in_queue.put((out_frame, 1))  # frame2 + frame3 --> calc2
                #calc4 = parallel_CCRF(calc2[0],calc1[0])     # calc1 + calc2 --> calc4
                frame3 = v[0]
            elif v[1] == 3:  #v[1] == f8q
                out_frame[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], frame3[:, :,
                                                                          0])
                out_frame[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], frame3[:, :,
                                                                          1])
                out_frame[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], frame3[:, :,
                                                                          2])
                lv2_in_queue.put((out_frame, 2))  # frame3 + frame4 --> calc3
                #calc5 = parallel_CCRF(calc3[0],calc2[0])     # calc2 + calc3 --> calc5
                #result_HDR = parallel_CCRF(calc5,calc4)
                #lv1_out_queue.put(result_HDR) #put
                frame4 = v[0]
            elif v[1] == 0:  #v[1] ==fq
                frame1 = v[0]
            #print(result)
            #process v
        except queue.Empty:
            continue
        except Exception as e:
            raise e
Beispiel #3
0
def lv3_HDR_proc(lv3_in_queue, lv3_out_queue):
    calc4 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    calc5 = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    #result_HDR =np.zeros((FRAME_HEIGHT,FRAME_WIDTH),np.uint8)
    HDR_FRAME = np.zeros((FRAME_HEIGHT, FRAME_WIDTH, 3), np.uint8)
    #cv2.namedWindow("HDR", cv2.WND_PROP_FULLSCREEN)
    #cv2.setWindowProperty("HDR",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
    init_time = time.time()
    info('lv3')
    while True:
        lv3_out_queue.put(HDR_FRAME)
        try:
            v = lv3_in_queue.get()  #get
            if v is None:
                break
            if v[1] == 1:
                #lv3_out_queue.put(parallel_CCRF(v[0],calc4)) #calc5 + calc4 -->HDR_frame
                HDR_FRAME[:, :, 0] = parallel_HDR_B(v[0][:, :, 0], calc4[:, :,
                                                                         0])
                HDR_FRAME[:, :, 1] = parallel_HDR_G(v[0][:, :, 1], calc4[:, :,
                                                                         1])
                HDR_FRAME[:, :, 2] = parallel_HDR_R(v[0][:, :, 2], calc4[:, :,
                                                                         2])
                print("Time taken to spit one HDR frame = ",
                      time.time() - init_time)
                init_time = time.time()
                calc5 = v[0]
            elif v[1] == 0:  # got calc4 frame
                calc4 = v[0]
        except queue.Empty:
            continue
        except Exception as e:
            raise e
Beispiel #4
0
def CCRF_Lookup(f2q, fq):
    result_HDR = np.zeros(f2q.shape, np.uint8)
    result_HDR[:, :, 0] = parallel_HDR_B(f2q[:, :, 0], fq[:, :, 0])
    result_HDR[:, :, 1] = parallel_HDR_G(f2q[:, :, 1], fq[:, :, 1])
    result_HDR[:, :, 2] = parallel_HDR_R(f2q[:, :, 2], fq[:, :, 2])
    return result_HDR