Skip to content

Lykaos/LHE-Codec-Image

Repository files navigation

LHE-Codec

This is a python image coder-decoder using the LHE algorithm. It will codify chrominance and/or luminance hops, and will use Huffman coding to represent them as symbols.

C project

You can check a more detailed project in C here: https://github.com/magonzalezc/LHE

More info

You can learn more about LHE in this article: http://oa.upm.es/37459/1/INVE_MEM_2014_200038.pdf

This codec works with the YUV color model, and can use 3 alternatives of it: yuv420, yuv422 and, less frequent, yuv444. From now on, we'll call that choice the chrominance mode. A more detailed description of what YUV is and what are the differences between alternatives can be found in the html file (description.html) with the general description of the program.

Also, you can learn more about those alternatives here: https://en.wikipedia.org/wiki/Chroma_subsampling

How to install (Windows)

  1. Install Python 2.7 and the IDLE Editor if you dont have them in your computer.

  2. Now we need to install two modules: numpy and pillow. Pillow is an improved version of the module PIL (contained in it), which works with images (opening, loading, getting RGB values, etc). Open a command prompt (cmd), go to the path you installed Python and type:

pip install numpy
pip install pillow
  1. Open the IDLE editor with example.py and execute it with the F5 key or the Run menu.

How to install (Linux)

  1. Install Python 2.7 if you dont have it in your computer.

  2. Open a new terminal and type:

sudo apt-get install python-pip
sudo pip install numpy
sudo pip install pillow
  1. Go to the path where example.py is and execute it with the command:
python example.py

How to use

The example program ("example.py") will ask you what do you want to do. Type enc for encoding or dec for decoding. You can also type exit to close the program.

Encoding

Once you selected encoding, the program will ask you the chrominance mode you want and the image you want to work with. This codec only works with images which are saved in the input_img folder, be sure to save and select one from there. You will know when the program succesfully finishes the encoding.

Decoding

The program wont ask you anything if you select decoding. You must have a .lhe file in the output_lhe folder (generated by the encoder) and it will create the image in the output_img folder. If you want to decode an external .lhe file, be sure to rename it to lhe_file.lhe and save it in the output_lhe folder. You will know when the program succesfully finishes the decoding.

Note: Please, dont try to decode without encoding first, since it will close the program ^.^

About

Image codec using the LHE algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages