Пример #1
0
            current_index = frame_index[i]
            #check if the current index is greater than the number of frames for particular camera video 
            if current_index >= len(timestamps[i]):
                video_done[i] = True
                break # End of the video
            #set vidoe timestamp equal to camera fetched time
            video_ts = timestamps[i][current_index]
            if current_ts < video_ts:
                break # The frame is in future, stop
            # The frame is in the past or present
            print(" camera %d: frame %d" % (i+1, frame_index[i]))
            image[i] = image[i]
	    frame_index[i] += 1

    #get the final stitched image from all cameras
    finalStitchedImage = getStitchedImage(image[0],image[1],image[2],image[3],image[4],image[5],image[6],image[7])  
    #write the fetched stitched image to the output object 
    output.write(finalStitchedImage)
    
    if video_done[CAMERA_1] or video_done[CAMERA_2] or video_done[CAMERA_3] or video_done[CAMERA_4] or video_done[CAMERA_5] or video_done[CAMERA_6] or video_done[CAMERA_7] or video_done[CAMERA_8]:
        break

#close everything after the work is done
capture_CAM1.release()
capture_CAM2.release()
capture_CAM3.release()
capture_CAM4.release()
capture_CAM5.release()
capture_CAM6.release()
capture_CAM7.release()
capture_CAM8.release()
Пример #2
0
    ret, camera5_frame = capture_CAM5.read()
    ret, camera6_frame = capture_CAM6.read()
    ret, camera7_frame = capture_CAM7.read()
    ret, camera8_frame = capture_CAM8.read()

    #if any of the frame is None i.e. the video has reached its end, stop the recording
    if (camera1_frame is None) or (camera2_frame is None) or (
            camera3_frame is None) or (camera4_frame is None) or (
                camera5_frame is None) or (camera6_frame is None) or (
                    camera7_frame is None) or (camera8_frame is None):
        print "end of video!"
        break

    #get the final stitched image from all cameras
    finalStitchedImage = getStitchedImage(camera1_frame, camera2_frame,
                                          camera3_frame, camera4_frame,
                                          camera5_frame, camera6_frame,
                                          camera7_frame, camera8_frame)
    #write the fetched stitched image to the output object
    output.write(finalStitchedImage)

#close everything after the work is done
capture_CAM1.release()
capture_CAM2.release()
capture_CAM3.release()
capture_CAM4.release()
capture_CAM5.release()
capture_CAM6.release()
capture_CAM7.release()
capture_CAM8.release()
output.release()
cv2.destroyAllWindows()
    ret, camera1_frame = capture_CAM1.read()
    ret, camera2_frame = capture_CAM2.read()
    ret, camera3_frame = capture_CAM3.read()
    ret, camera4_frame = capture_CAM4.read()
    ret, camera5_frame = capture_CAM5.read()
    ret, camera6_frame = capture_CAM6.read()
    ret, camera7_frame = capture_CAM7.read()
    ret, camera8_frame = capture_CAM8.read()  

    #if any of the frame is None i.e. the video has reached its end, stop the recording 
    if (camera1_frame is None) or (camera2_frame is None) or (camera3_frame is None) or (camera4_frame is None) or (camera5_frame is None) or (camera6_frame is None) or (camera7_frame is None) or (camera8_frame is None):
        print "end of video!"
        break
  
    #get the final stitched image from all cameras
    finalStitchedImage = getStitchedImage(camera1_frame, camera2_frame, camera3_frame, camera4_frame, camera5_frame, camera6_frame, camera7_frame, camera8_frame)  
    #write the fetched stitched image to the output object 
    output.write(finalStitchedImage)

#close everything after the work is done
capture_CAM1.release()
capture_CAM2.release()
capture_CAM3.release()
capture_CAM4.release()
capture_CAM5.release()
capture_CAM6.release()
capture_CAM7.release()
capture_CAM8.release()
output.release()
cv2.destroyAllWindows()