ColorBarcode ClassΒΆ

Barcode Classes

class kalmus.barcodes.Barcode.ColorBarcode(color_metric, frame_type, sampled_frame_rate=1, skip_over=0, total_frames=10, barcode_type='Color')[source]

Bases: kalmus.barcodes.Barcode.Barcode

Color barcode

Parameters
  • color_metric (str) -- The metric for computing the color of the frame

  • frame_type (str) -- The type of frame sampling

  • sampled_frame_rate (int) -- Frame sample rate: the frame sampled from every sampled_frame_rate.

  • skip_over (int) -- The number of frames to skip with at the beginning of the video

  • total_frames (int) -- The total number of frames (computed) included in the barcode

  • barcode_type (str) -- The type of the barcode

collect_colors(video_path_name)[source]

Collect the colors of frames from the video

Parameters

video_path_name (str) -- The path to the video file

multi_thread_collect_colors(video_path_name, num_thread=4)[source]

Collect the color of the input video using Multi-thread method

Parameters
  • video_path_name (str) -- The path to the input video

  • num_thread (int) -- Number of threads to collect the brightness

reshape_barcode(frames_per_column=160)[source]

Reshape the barcode (2 dimensional with 3 channels)

Parameters

frames_per_column (int) -- Number of frames per column in the reshaped barcode

thread_collect_color_start_to_end(video, start_point, num_frames, results, tid, frame_saved=None)[source]

Collect the colors from the video using the multi-threads

Parameters
  • video (class:cv2.VideoCapture) -- The video object

  • start_point (int) -- Start point for collecting the colors

  • num_frames (int) -- The number of frames to collect

  • results (list) -- The placeholder for saving the results

  • tid (int) -- The id of the thread

  • frame_saved (list) -- The placeholder for the saved frames