# Image compressor

[![Contributors](https://img.shields.io/github/contributors/polfarres/Projecte-Compressi-.svg?style=for-the-badge)](https://github.com/polfarres/Projecte-Compressi-/graphs/contributors) [![Forks](https://img.shields.io/github/forks/polfarres/Projecte-Compressi-.svg?style=for-the-badge)](https://github.com/polfarres/Projecte-Compressi-/network/members) [![Stargazers](https://img.shields.io/github/stars/polfarres/Projecte-Compressi-.svg?style=for-the-badge)](https://github.com/polfarres/Projecte-Compressi-/stargazers) [![Issues](https://img.shields.io/github/issues/polfarres/Projecte-Compressi-.svg?style=for-the-badge)](https://github.com/polfarres/Projecte-Compressi-/issues) [![project\_license](https://img.shields.io/github/license/polfarres/Projecte-Compressi-.svg?style=for-the-badge)](https://github.com/polfarres/Projecte-Compressi-/blob/master/LICENSE.txt) [![LinkedIn](https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\&logo=linkedin\&colorB=555)](https://linkedin.com/in/linkedin_username)

<h4 align="center">Projecte-Compressió</h4>

<p align="center">Image compression project developed in Java.<br><a href="https://github.com/polfarres/Projecte-Compressi-"><strong>Explore the docs »</strong></a><br><br><a href="https://github.com/polfarres/Projecte-Compressi-">View Demo</a> · <a href="https://github.com/polfarres/Projecte-Compressi-/issues/new?labels=bug&#x26;template=bug-report---.md">Report Bug</a> · <a href="https://github.com/polfarres/Projecte-Compressi-/issues/new?labels=enhancement&#x26;template=feature-request---.md">Request Feature</a></p>

***

### About The Project

This project implements a basic **image compression system** in Java.\
The goal is to analyze and apply **entropy coding**, **quantization**, and **prediction** — the first three main stages of an image compression pipeline.

This project has been developed as part of academic exercises on image compression and processing by both **Mikel Garzón Gomes** and **Pol Farres Ribatadalla**.

> **Note:** Entropy-related modules are still in progress.

***

#### Built With

* [![Java](https://img.shields.io/badge/Java-007396?style=for-the-badge\&logo=openjdk\&logoColor=white)](https://www.java.com/)

***

### Getting Started

You only need **Git** and **Java** — there are no external dependencies.

#### Installation

{% stepper %}
{% step %}
Clone the repository

```sh
git clone https://github.com/polfarres/Projecte-Compressi-.git
```

{% endstep %}

{% step %}
Compile and run with Java

```sh
javac Main.java
java Main
```

{% endstep %}
{% endstepper %}

***

### Usage

The program runs in the console and displays a menu like the following:

```java
System.out.println("Introdueix una opció (1-9 o 's'): ");
System.out.println("1.- Read Images");
System.out.println("2.- Calculate Total Entropy of Images (Order 0)");
System.out.println("3.- Conditional Entropy (Pixel Correlation)");
System.out.println("4.- Conditional Entropy of 4 Neighbor Pixels (Order 1)");
System.out.println("5.- Image Quantization");
System.out.println("6.- Image Dequantization");
System.out.println("7.- Image Prediction (after prior quantization)");
System.out.println("8.- Image Deprediction (Reconstruction)");
System.out.println("9.- Calculate Distortion Metrics (MSE and PAE) of Quantized Images");
System.out.println("-----------------------------------------------------------------------");
System.out.println("s.- Exit the Application");
```

***

### Roadmap

## Projecte-Compressió

Image Compression Project

* [x] Read and write images
* [x] Entropy calculation
  * [x] Entropy of order 0
  * [x] Entropies of order 1
* [x] Quantization
* [x] Dequantization
* [x] Entropy of the quantized image
* [x] Entropy of the dequantized (lossy) image
* [x] Prediction
* [x] Pipeline
* [x] Coder and decoder done
* [x] User interface improoved
* [x] Code refactored
* [x] Distortion metrics (MSE and PAE)

**Competition**

***

In this part of the project we are going to compare the different methods implemented in the previous sections. To acomplish a better results than our classmates. The improvements will be focused on the following points:

**Pol Farres**

* [ ] Dead Zone quantization augmented
* [ ] Adaptative Quantization
* [ ] Aritmetic Encoding Entropy
  * [ ] First degree
  * [ ] Second degree

**Mikel Garzón**

* [x] Lineal function DPCM
* [x] Median Edge Detector Predictor
* [x] LOCO-I predictor
* [x] GAP predictor
  * [x] Improved MED (original)
* [x] Smoothing Kernel implemented
* [ ] Adaptative Prediction --> knn

***

We are currently focusing on the first **three stages** of image compression: **Entropy Encoding**, **Quantization**, and **Prediction**.

See the [open issues](https://github.com/polfarres/Projecte-Compressi-/issues) for a full list of proposed features (and known issues).

***

### Contributing

Contributions are what make the open source community amazing. Any suggestions or improvements are **greatly appreciated**.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

#### Top contributors:

[![contrib.rocks image](https://contrib.rocks/image?repo=polfarres/Projecte-Compressi-)](https://github.com/polfarres/Projecte-Compressi-/graphs/contributors)

***

### License

Distributed under the project\_license. See `LICENSE.txt` for more information.

***

### Contact

Pol Farres — [GitHub Profile](https://github.com/polfarres)

Mikel Garzón — [Github Profile](https://github.com/MkProgramer33)

Project Link: <https://github.com/MkProgramer33/Image-Compressor>

***
