BrightnessBarcode ClassΒΆ

Barcode Classes

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

Bases: kalmus.barcodes.Barcode.Barcode

Brightness Barcode Class.

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_brightness(video_path_name)[source]

Collect the brightness from the input video

Parameters

video_path_name (str) -- The path to the video

multi_thread_collect_brightness(video_path_name, num_thread=4)[source]

Collect the brightness 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 brightness barcode (2 dimensional with 1 channel)

Parameters

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

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

Collect the brightness 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