/video2lcd

A software to convert video to lcd format and its source code.

Primary LanguagePythonMIT LicenseMIT

Video2Lcd

English|简体中文

This is a software to convert video to lcd format and its source code based on Python 3. You can use the python script videoToBin.py to simply get the image bin file.

demo

Structure

video2lcd/
    ├─images/                     // test input images
    ├─output/                     // output bin files
    ├─Proteus/                    // MCU simulation folder
    │  ├─program/                 // source program based on Keil
    │  └─simulation/              // simulation files based on Proteus
    ├─source/                     // source code folder
    │  ├─outputImg/               // some test images
    ├─tools/                      // two transcoding tools
    │  ├─binHEBING合并bin文件/     // merge bin files
    │  └─Image2Lcd/               // convert images to lcd format
    └─videos/                     // test input videos

Simple use

  1. After cloning this repo you should have a python environment not less than 3.7.4.

  2. Then inatall opencv-python.

    pip install opencv-python
  3. If you want to plot results, you should also install matplotlib.

    pip install matplotlib
  4. Use binarization.py to verify the effectiveness of different algorithms.

    simpleBinary adaptiveBinary12864-1 otsuBinary12864

  5. Use imgToBin.py to test the transform method on one image.

  6. Use videoToBin.py to simply get the image bin file.

    We offer two kinds of binarization method: Global & Local, the conversion effect is as shown above.

    We provide parameters to suit different conversion needs:

    freq=3,                      # extract frame interval
    transMode='Global'/'Local',  # transform mode
    reverse=False,               # whether the color is reversed
    reOrder=False,               # whether the bytes are in reverse order
    UDFlip=False,                # whether to scan from bottom to top
    RLFlip=False,                # whether to scan from right to left
    scanMode=0(0,1,2,3)          # scanning mode: 
    # 0 horizontal scan; 1 vertical scan; 2 data horizontal, byte vertical; 3 data vertical, byte horizontal

    When you get the .bin file under /output/, you can rename it into .mmc. Then copy it into /Proteus/simulation, add it into the sd card at sd.pdsprj.

Installation

Go to source code folder

cd source

Create a virtual environment using venv

python -m venv env

Source the virtual environment

Windows:

cd env/bin
activate

Linux:

source env/bin/activate

Use the package manager pip to install requirements.

pip install -r requirements.txt

p.s. The graphics window software is under development, the Qt Designer file is source/simpleUI.ui.


Todo List:

  • Develop the corresponding graphics window software.
  • Support color video generation.

coming soon~