Skip to content

A tiny python program to convert picture. gif and video to chars, picture to char picture or txt file, gif to gif, video to video, using HOG to get features.

License

Notifications You must be signed in to change notification settings

cathor01/pic2char

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pic2Char

About

A tiny Python program to convert picture to chars, get hog features from picture's areas and using char with most similiar hog feathre to represident it, finally convert a picture to a list of chars.

Requirement

  • Python 2.7
  • OpenCV 3
  • Numpy
  • Movie-py

Usage

python pic2char.py <source> <max(width, height)> <target_file> [<channels> [<to_txt_file> [<trim_txt_file>]]]
  • source: source file, can be picture, gif or video file (gif and video consume huge amount time)
  • max(width, height): max width or height of output file, choose the longer one
  • target_file: The file you want to export, you can export to any file if you set to_txt_file to 1, but you need to choose right fiel type otherwise, picture to picture, gif to gif, video to video
  • channels: the channels use to extract features, 3 or 1. * to_txt_file: ONLY WORKS IN PICTURE, 1 means output to txt file, otherwise to pictures * trim_txt_file: ONLY WORKS IN PICTURE, 1 means skip blank in line end

Example

Sample Picture (Get from pixabay): Sample

  • To 3 Channel picture: 3Channel

  • To 1 Channel picture: 1Channel

  • To TXT File: Txt (The origin file is located in txt.txt)

Addition

You can edit some params defined at the top of pic2char.py, the area's width or height, the chars to use, the gray values.

About

A tiny python program to convert picture. gif and video to chars, picture to char picture or txt file, gif to gif, video to video, using HOG to get features.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages