img = cv2.resize(img, (scaled_width, max_res))
      curr_frame = img[:, width_crop: width_crop + max_res]
    else:
      curr_frame = img[height_crop : height_crop + max_res, 
                       width_crop: width_crop + max_res]

    curr_frame = curr_frame.astype(numpy.int16)
    old_ref[:] = ref_frame
    
    spikes, ref_frame, abs_diff = generate_spikes(curr_frame=curr_frame, ref_frame=ref_frame, 
                                                  #~ threshold=threshold, 
                                                  min_threshold=min_threshold, 
                                                  max_threshold=max_threshold, 
                                                  threshold_matrix=threshold_matrix,
                                                  down_threshold_change=threshold_delta_down, 
                                                  up_threshold_change=threshold_delta_up,
                                                  width=max_res, height=max_res,
                                                  inh_width=inh_width, 
                                                  polarity=polarity,
                                                  max_time_ms=max_time_ms,
                                                  inh_coords=inh_coords,
                                                  inhibition=inhibit)

    neg_spikes, pos_spikes, global_max = split_spikes(spikes, abs_diff, polarity)
    
    lists = make_spike_lists_rate(pos_spikes, neg_spikes,
                                  global_max,
                                  up_down_shift, data_shift, data_mask,
                                  max_time_ms)

    spikes_frame = render_frame(spikes=spikes, curr_frame=curr_frame, 
예제 #2
0
                                   width_crop: width_crop + max_res]

              curr_frame = curr_frame.astype(numpy.int16)
              old_ref[:] = out_ref
              print("first pixels of ref = %s"%(old_ref[0, :10]))
              spikes, ref_frame, abs_diff, \
              out_ref, threshold_matrix = generate_spikes(curr_frame=curr_frame, 
                                                          ref_frame=ref_frame, 
                                                          out_ref=out_ref,
                                                          threshold=threshold, 
                                                          min_threshold=min_threshold, 
                                                          max_threshold=max_threshold, 
                                                          threshold_matrix=threshold_matrix,
                                                          down_threshold_change=threshold_delta_down, 
                                                          up_threshold_change=threshold_delta_up,
                                                          width=max_res, height=max_res,
                                                          inh_width=inh_width, 
                                                          polarity=polarity,
                                                          max_time_ms=max_time_ms,
                                                          inh_coords=inh_coords,
                                                          num_bits=bits_idx,
                                                          noise_probability=noise_prob,
                                                          update_weight=update_weight,
                                                          log2_table=log2_table[bits_idx-1],
                                                          inhibition=inhibit)


                
              neg_spikes, pos_spikes, global_max = split_spikes(spikes, abs_diff, polarity)
              
              lists = make_spike_lists_rate(pos_spikes, neg_spikes,