if ret != True: print "No valid frame." break # Resize the frame into the resolution of our Holiday array holframe = cv2.resize(frame, newsize, interpolation=cv2.INTER_CUBIC) # The colours are in the wrong format, so convert them holframe = cv2.cvtColor(holframe, cv2.COLOR_BGR2RGB) # Display the original frame, for the demo cv2.imshow('holivid monitor display', frame) # A frame is just a Numpy array of pixel values, i.e. globelists. We need to take # these values and map them onto our holiday array. render_to_hols(holframe, hols, width, height, options.orientation, options.switchback) # Wait period between keycapture (in milliseconds) # This gives us approximately the right number of frames per second wait_time = 1000/options.fps # Figure out how long the wait_time would be without the # processing time loopend = time.time() # Adjust waiting based on how long it takes us to process process_time = (loopend - loopstart) * 1000 wait_time = int(wait_time - process_time) if cv2.waitKey(wait_time) & 0xFF == ord('q'): break
#print "glist:", glist # Scroll the display offset = 0 while True: # Draw only as much of the globelists as will fit in the width render_glist = [] for hol_list in glist: new_list = hol_list[offset:width+offset] # FIXME: Ability to scroll in both directions, via a flag # wraparound if len(new_list) < width: new_list.extend(hol_list[:(width-len(new_list))]) pass render_glist.append(new_list) pass #print "renderlist:", render_glist render_to_hols(render_glist, hols, width, height, orientation=options.orientation, switchback=options.switchback) offset += 1 if offset > len(glist[0]): offset = 0 pass if not options.animate: sys.exit(0) time.sleep(options.anim_sleep)