Skip to content

mmikri/cv-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cv-tools

Overview

This script performs preprocessing on image and video data based on specified configurations.

Prerequisites

  • Python 3.8 ~ 3.12

Usage

Installation

Clone the repository:

git clone https://github.com/mmikri/cv-preprocessing.git
cd cv-preprocessing

Install dependencies:

pip install -r requirements.txt

Command Line Arguments

Element:

python main.py [-h] [-t {image,i,video,v}] [-p PATH] [-c CONFIG] [-o OUTPUT]
  • -t, --type: Specify the data type: 'image(i)' or 'video(v)' (default: 'image')
  • -p, --path: Path to images or video files (default: './assets')
  • -c, --config: Path to the configuration file (default: './config.yaml')
  • -o, --output: Path to the output directory (default: './result')

Examples:

# Example 1: Process images
python main.py -t i -p ./path/to/images -c config.yaml -o ./output_directory

# Example 2: Process videos
python main.py -t v -p ./path/to/videos -c config.yaml -o ./output_directory

Configuration File

The configuration file (config.yaml) contains settings for image and video preprocessing. Customize this file based on your requirements.

# Example Image Settings
image_settings:
  cropped:
    enabled: true
    coordinates: [10, 20, 200, 180]
  resize:
    enabled: true
    output_size: [300, 200]
  brightness:
    enabled: true
    factor: 1.5
  saturation:
    enabled: true
    factor: 0.8
  rotate:
    enabled: true
    angle: 1
  flip:
    enabled: true
    options: horizontally

# Example Video Settings
video_settings:
  cropped:
    enabled: true
    coordinates: [10, 20, 200, 180]
  resize:
    enabled: true
    output_size: [640, 480]
  brightness:
    enabled: true
    factor: 1.2
  saturation:
    enabled: true
    factor: 0.9
  rotate:
    enabled: true
    angle: 2
  flip:
    enabled: true
    options: vertically
  preview: true
  save_video: true
  save_image: true

Run Unit Tests

To run unit tests, use the following command:

python -m unittest discover -s test -p 'UT*.py'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages