src/wai_data_tools/movie_to_images.py
def split_video_files_to_frame_files(src_video_dir: Path,
                                     excel_path: Path,
                                     dst_frame_dir: Path,
                                     label_config: Dict[str, Union[int, bool, str]]) -> None:
    """
    Copies frames in all .mjpg video files in a source directory into a new directory as .jpg files.
    :param src_video_dir: Path to directory where video files is stored
    :param excel_path: Path to excel file where file information is stored
    :param dst_frame_dir: Path to directory to store new data
    :param label_config: Label configuration
    """

    logging.info("Reading and formatting excel dataframe")
    excel_df_dict = read_excel.read_excel_to_dataframe(excel_file_path=excel_path)
    excel_df = read_excel.stack_rows_from_dataframe_dictionary(dataframe_dict=excel_df_dict)
    label_name = label_config["name"]

    logging.info("Reading video files and saving frames to destination for label %s", label_name)
    video_filepaths = src_video_dir.glob("*.mjpg")
    for video_filepath in tqdm.tqdm(list(video_filepaths)):
        frames_dict = split_video_file_to_frame_files(video_filepath=video_filepath,
                                                      excel_dataframe=excel_df,
                                                      label_config=label_config)

        save_frames(frames_dict=frames_dict,
                    src_video_filestem=video_filepath.stem,
                    label_name=label_name,
                    dst_frame_dir=dst_frame_dir)

    Copies frames in all .mjpg video files in a source directory into a new directory as .jpg files.
    :param src_video_dir: Path to directory where video files is stored
    :param excel_path: Path to excel file where file information is stored
    :param dst_frame_dir: Path to directory to store new data
    :param label_config: Label configuration
    
Copies frames in all .mjpg video files in a source directory into a new directory as .jpg files.
Copies frames in all . mjpg video files in a source directory into a new directory as . jpg files .
def split_video_files_to_frame_files(src_video_dir: Path,
                                     excel_path: Path,
                                     dst_frame_dir: Path,
                                     label_config: Dict[str, Union[int, bool, str]]) -> None:
    logging.info("Reading and formatting excel dataframe")
    excel_df_dict = read_excel.read_excel_to_dataframe(excel_file_path=excel_path)
    excel_df = read_excel.stack_rows_from_dataframe_dictionary(dataframe_dict=excel_df_dict)
    label_name = label_config["name"]
    logging.info("Reading video files and saving frames to destination for label %s", label_name)
    video_filepaths = src_video_dir.glob("*.mjpg")
    for video_filepath in tqdm.tqdm(list(video_filepaths)):
        frames_dict = split_video_file_to_frame_files(video_filepath=video_filepath,
                                                      excel_dataframe=excel_df,
                                                      label_config=label_config)
        save_frames(frames_dict=frames_dict,
                    src_video_filestem=video_filepath.stem,
                    label_name=label_name,
                    dst_frame_dir=dst_frame_dir)
def split_video_files_to_frame_files ( src_video_dir : Path , excel_path : Path , dst_frame_dir : Path , label_config : Dict [ str , Union [ int , bool , str ] ] ) -> None : logging . info ( "Reading and formatting excel dataframe" ) excel_df_dict = read_excel . read_excel_to_dataframe ( excel_file_path = excel_path ) excel_df = read_excel . stack_rows_from_dataframe_dictionary ( dataframe_dict = excel_df_dict ) label_name = label_config [ "name" ] logging . info ( "Reading video files and saving frames to destination for label %s" , label_name ) video_filepaths = src_video_dir . glob ( "*.mjpg" ) for video_filepath in tqdm . tqdm ( list ( video_filepaths ) ) : frames_dict = split_video_file_to_frame_files ( video_filepath = video_filepath , excel_dataframe = excel_df , label_config = label_config ) save_frames ( frames_dict = frames_dict , src_video_filestem = video_filepath . stem , label_name = label_name , dst_frame_dir = dst_frame_dir )
Copies frames in all .mjpg video files in a source directory into a new directory as .jpg files.
Copies frames in all . mjpg video files in a source directory into a new directory as . jpg files .
"""
    Copies frames in all .mjpg video files in a source directory into a new directory as .jpg files.
    :param src_video_dir: Path to directory where video files is stored
    :param excel_path: Path to excel file where file information is stored
    :param dst_frame_dir: Path to directory to store new data
    :param label_config: Label configuration
    """
src_video_dir
Path
Path to directory where video files is stored
Path to directory where video files is stored
excel_path
Path
Path to excel file where file information is stored
Path to excel file where file information is stored
dst_frame_dir
Path
Path to directory to store new data
Path to directory to store new data
label_config
Dict[str, Union[int, bool, str]]
None