Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

122 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tucil2_13523027_13523090 - Quadtree Compresser

This repository contains an image compression application that leverages a Quadtree data structure, built in C++ using OpenCV and ImageMagick that implements various Divide and Conquer and Decrease and Conquer algorithms. This program also incorporates multiple error measurement methodsβ€”including variance, mean absolute deviation (MAD), maximum pixel difference, entropy, and Structural Similarity Index (SSIM)β€”to decide when to subdivide image regions. Additionally, it can generate Graphics Interchange Format (GIF) files to visualize the compression process, providing an intuitive demonstration of how the quadtree structure evolves during compression.

Lock-in

////////// Project Black Lock πŸ” //////////

SIN Name GitHub
13523027 Fajar Kurniawan @Fajar2k5
13523090 Nayaka Ghana Subrata @Nayekah

////////// Tech Stacks and Languages //////////

C++ OpenCV ImageMagick


πŸ“¦ Installation & Setup

βœ… Requirements

  • Git
  • Any IDE (recommended: VSCode)
  • Chocolatey (for Windows)
  • CMake
  • OpenCV
  • ImageMagick
  • FFmpeg
  • C++ Compiler



⬇️ Installing Dependencies

πŸͺŸ Windows

  1. Git
    https://git-scm.com/download/win
  2. VSCode
    winget install microsoft.visualstudiocode
  3. Mingw (C++ Compiler)
    # Install and setup for Windows (see the docs below)
    
    https://www.mingw-w64.org/downloads/
  4. Chocolatey (Package installer for Windows)
    # Install and setup (see the docs below)
    
    https://chocolatey.org/install
  5. Dependecies
    # Run it in administrator mode (cmd/powershell)
    
    choco install cmake -y
    choco install opencv -y
    choco install imagemagick -y


🐧 Linux

  1. Git
    sudo apt-get install git
  2. VSCode
    sudo apt install software-properties-common apt-transport-https wget
    wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
    sudo apt update
    sudo apt install code
  3. Mingw (C++ Compiler)
    # Install and setup for your Linux distro (see the docs below)
    
    https://www.mingw-w64.org/downloads/
  4. Dependecies
    sudo apt update
    sudo apt install cmake
    sudo apt install libopencv-dev
    sudo apt install imagemagick
    sudo apt install ffmpeg

πŸ”§ How To Setup

πŸͺŸ Windows

πŸ› οΈ Build (If you want to build it from the beginning)

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd .\Tucil2_13523027_13523090
  4. Install the dependencies first (if not already installed)
  5. Do:
    build.bat
    
    # or
    
    .\build.bat

🧹 Clean

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd .\Tucil2_13523027_13523090
  4. Do:
    clean.bat
    
    # or
    
    .\clean.bat



🐧 Linux

πŸ› οΈ Build (If you want to build it from the beginning)

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd Tucil2_13523027_13523090/
  4. Install the dependencies first (if not already installed)
  5. Do:
    ./build.sh

🧹 Clean

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd Tucil2_13523027_13523090/
  4. Do:
    ./clean.sh

✨ How to Run

🐧 Linux

πŸ“° Default Mode

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd Tucil2_13523027_13523090/
  4. Install the dependencies first (if not already installed)
  5. Do:
    ./run.sh basic

πŸ“Ÿ Paging Mode

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd Tucil2_13523027_13523090/
  4. Install the dependencies first (if not already installed)
  5. Do:
    ./run.sh page

πŸͺŸ Windows

πŸ“° Default Mode

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd .\Tucil2_13523027_13523090
  4. Install the dependencies first (if not already installed)
  5. Do:
    run.bat basic
    
    or
    
    .\run.bat basic

πŸ“Ÿ Paging Mode

  1. Open a terminal
  2. Clone the repository (if not already cloned)
    git clone https://github.com/Nayekah/Tucil2_13523027_13523090.git
  3. Make Tucil2_13523027_13523090 as root directory:
    cd .\Tucil2_13523027_13523090
  4. Install the dependencies first (if not already installed)
  5. Do:
    run.bat page
    
    or
    
    .\run.bat page

‼️ Troubleshooting

if you encounter error when running in windows (or the binary can't be run), go to the run.bat:

# Set OpenCV path based on your device's path (change this line in run.bat)
if exist "C:\tools\opencv\build"

# Set ImageMagick path based on your device's path (change this line in run.bat)
if exist "C:\Program Files\ImageMagick*"
```

πŸ“± Repository Structure

πŸ“‚ Tucil2_13523027_13523090/
β”œβ”€β”€ πŸ“‚ bin/
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ quadtree_compression
β”‚   └── quadtree_compression.exe
β”‚
β”œβ”€β”€ πŸ“‚ doc/
β”‚   β”œβ”€β”€ .gitkeep
β”‚   └── Tucil2_13523027_13523090.pdf
β”‚
β”œβ”€β”€ πŸ“‚ src/
β”‚   β”œβ”€β”€ πŸ“‚ comps/
β”‚   β”‚   β”œβ”€β”€ BasicInputManager.cpp
β”‚   β”‚   β”œβ”€β”€ CompressionAnalyzer.cpp
β”‚   β”‚   β”œβ”€β”€ ErrorCalculation.cpp
β”‚   β”‚   β”œβ”€β”€ GifGenerator.cpp
β”‚   β”‚   β”œβ”€β”€ ImageProcessor.cpp
β”‚   β”‚   β”œβ”€β”€ InputManager.cpp
β”‚   β”‚   β”œβ”€β”€ QuadTree.cpp
β”‚   β”‚   └── main.cpp
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ header/
β”‚   β”‚   β”œβ”€β”€ BasicInputManager.hpp
β”‚   β”‚   β”œβ”€β”€ CompressionAnalyzer.hpp
β”‚   β”‚   β”œβ”€β”€ CompressionParams.hpp
β”‚   β”‚   β”œβ”€β”€ ErrorCalculator.hpp
β”‚   β”‚   β”œβ”€β”€ GifGenerator.hpp
β”‚   β”‚   β”œβ”€β”€ ImageProcessor.hpp
β”‚   β”‚   β”œβ”€β”€ InputManager.hpp
β”‚   β”‚   β”œβ”€β”€ Pixel.hpp
β”‚   β”‚   └── QuadTree.hpp
β”‚   β”‚
β”‚   └── .gitkeep
β”‚
β”œβ”€β”€ πŸ“‚ test/
β”‚   β”œβ”€β”€ πŸ“‚ input/
β”‚   β”‚   β”œβ”€β”€ W.jpg
β”‚   β”‚   β”œβ”€β”€ bocchi.jpg
β”‚   β”‚   β”œβ”€β”€ coffee.jpg
β”‚   β”‚   β”œβ”€β”€ flower.jpg
β”‚   β”‚   β”œβ”€β”€ isagi.jpg
β”‚   β”‚   β”œβ”€β”€ kaneki.jpeg
β”‚   β”‚   β”œβ”€β”€ kosong.png
β”‚   β”‚   β”œβ”€β”€ lappland.jpg
β”‚   β”‚   β”œβ”€β”€ misteri.jpg
β”‚   β”‚   β”œβ”€β”€ sample1.jpg
β”‚   β”‚   β”œβ”€β”€ texas.jpg
β”‚   β”‚   └── tragedy.png
β”‚   β”‚
β”‚   └── πŸ“‚ output/
β”‚   β”‚   β”œβ”€β”€ W256.jpg
β”‚   β”‚   β”œβ”€β”€ W256gif.gif
β”‚   β”‚   β”œβ”€β”€ W64.jpg
β”‚   β”‚   β”œβ”€β”€ W64gif.gif
β”‚   β”‚   β”œβ”€β”€ Wlow.jpg
β”‚   β”‚   β”œβ”€β”€ Wlowgif.gif
β”‚   β”‚   β”œβ”€β”€ bocchlow.jpg
β”‚   β”‚   β”œβ”€β”€ bocchlowgif.gif
β”‚   β”‚   β”œβ”€β”€ flower.gif
β”‚   β”‚   β”œβ”€β”€ lappgif.gif
β”‚   β”‚   β”œβ”€β”€ lapplow.jpg
β”‚   β”‚   β”œβ”€β”€ mygoat.jpg
β”‚   β”‚   β”œβ”€β”€ mygoat2.jpg
β”‚   β”‚   β”œβ”€β”€ rcoffee.jpg
β”‚   β”‚   β”œβ”€β”€ rkaneki.jpeg
β”‚   β”‚   β”œβ”€β”€ rtragedy.png
β”‚   β”‚   β”œβ”€β”€ sample1a.jpg
β”‚   β”‚   └── texlow2.jpg
β”œβ”€β”€ CMakeLists.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ build.bat
β”œβ”€β”€ build.sh
β”œβ”€β”€ clean.bat
β”œβ”€β”€ clean.sh
β”œβ”€β”€ run.bat
└── run.sh


πŸ“ƒ Miscellaneous

No Points Yes No
1 The program compiles successfully without errors. βœ”οΈ
2 The Program successfully executed. βœ”οΈ
3 The program successfully compresses the image according to the specified parameters. βœ”οΈ
4 Implement all mandatory error calculation methods. βœ”οΈ
5 [Bonus] Implementation of compression percentage as an additional parameter. βœ”οΈ
6 [Bonus] Implementation of Structural Similarity Index (SSIM) as an error measurement method. βœ”οΈ
7 [Bonus] Output as GIF Visualizing the Process of Quadtree formation in Image Compression. βœ”οΈ
8 Program and report made by ourself βœ”οΈ




Project Black Lock β€’ Β© 2025 β€’ 13523027-13523090

About

Tugas Kecil 2 IF2211 Strategi Algoritma

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages