# rongalidhanush/svm-opticompress architecture

> Architecture diagram of the GitHub repository rongalidhanush/svm-opticompress, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rongalidhanush/svm-opticompress
- Repository: https://github.com/rongalidhanush/svm-opticompress

## Overview

SVM-OptiCompress is an offline MATLAB image-codec and exploration application. A user opens the app, selects an image and encoder, compresses it into a `.soc` file, and can decode that file to reconstruct the image; the app also presents a six-image comparison and quality metrics. The documented encoder path measures image blocks, selects compression classes (optionally with selective SVM review), and writes quantized DCT coefficients; the decoder reads the stored stream. The graph also preserves documented training, analysis, and comparison capabilities. Source excerpts were unavailable, so relationships are limited to those stated in the README.

Main entry points: [`src/compression/compress_image.m`](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/compress_image.m) (Image encoder), [`app/OptiCompressApp.m`](https://github.com/rongalidhanush/svm-opticompress/blob/main/app/OptiCompressApp.m) (Interactive app), [`src/svm/label_blocks.m`](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/svm/label_blocks.m) (SVM classification), [`run_project.m`](https://github.com/rongalidhanush/svm-opticompress/blob/main/run_project.m) (Project launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_project["Project launcher<br/>[run_project.m]"]
  node_gui["Interactive app<br/>[OptiCompressApp.m]"]
  node_gallery["Six-image gallery<br/>[draw_six_images.m]"]
end

subgraph group_codec["Image codec"]
  node_blocks["Block extraction<br/>[image_blocks.m]"]
  node_encoder["Image encoder<br/>[compress_image.m]"]
  node_dct["DCT and quantization<br/>[dct_basis.m]"]
  node_quantsteps["Quantization settings<br/>[quant_steps.m]"]
  node_zigzag["Zigzag scan<br/>[zig_order.m]"]
  node_soc["SOC compressed file"]
  node_decoder["Image decoder<br/>[decompress_image.m]"]
end

subgraph group_learning["Features and learning"]
  node_features["Block features<br/>[block_features.m]"]
  node_classifier["SVM classification<br/>[label_blocks.m]"]
  node_model["Trained SVM model<br/>[get_model.m]"]
  node_selective["Selective review"]
  node_training["Model training<br/>[train_svm_model.m]"]
end

subgraph group_analysis["Analysis and comparison"]
  node_clustering["Block clustering<br/>[cluster_blocks.m]"]
  node_transitions["Spatial transitions"]
  node_optimization["SVM and PCA demos"]
  node_comparison["Method comparison<br/>[compare_methods.m]"]
  node_metrics["Image quality metrics<br/>[image_metrics.m]"]
end

node_user(("Image user"))

node_user -->|"launches"| node_project
node_project -->|"opens"| node_gui
node_user -->|"selects image"| node_gui
node_gui -->|"shows comparison"| node_gallery
node_gui -->|"compresses image"| node_encoder
node_blocks -->|"measures"| node_features
node_features -->|"describes blocks"| node_classifier
node_model -->|"provides model"| node_classifier
node_classifier -->|"scores settings"| node_selective
node_selective -->|"reviews blocks"| node_encoder
node_encoder -->|"transforms blocks"| node_dct
node_encoder -->|"quantizes coefficients"| node_quantsteps
node_encoder -->|"scans coefficients"| node_zigzag
node_encoder -->|"writes stream"| node_soc
node_soc -->|"reads stream"| node_decoder
node_training -->|"replaces model"| node_model
node_user -->|"explores clusters"| node_clustering
node_clustering -->|"enables inspection"| node_transitions
node_user -->|"explores optimization"| node_optimization
node_user -->|"compares encoders"| node_comparison
node_comparison -->|"reports quality"| node_metrics

click node_project "https://github.com/rongalidhanush/svm-opticompress/blob/main/run_project.m"
click node_gui "https://github.com/rongalidhanush/svm-opticompress/blob/main/app/OptiCompressApp.m"
click node_gallery "https://github.com/rongalidhanush/svm-opticompress/blob/main/app/draw_six_images.m"
click node_blocks "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/preprocessing/image_blocks.m"
click node_features "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/block_features.m"
click node_classifier "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/svm/label_blocks.m"
click node_model "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/svm/get_model.m"
click node_selective "https://github.com/rongalidhanush/svm-opticompress/blob/main/research/selective_quantizers.m"
click node_encoder "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/compress_image.m"
click node_dct "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/dct_basis.m"
click node_quantsteps "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/quant_steps.m"
click node_zigzag "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/zig_order.m"
click node_decoder "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/decompression/decompress_image.m"
click node_training "https://github.com/rongalidhanush/svm-opticompress/blob/main/train_svm_model.m"
click node_clustering "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/cluster_blocks.m"
click node_transitions "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/spatial_transitions.m"
click node_optimization "https://github.com/rongalidhanush/svm-opticompress/tree/main/src/optimization"
click node_comparison "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/metrics/compare_methods.m"
click node_metrics "https://github.com/rongalidhanush/svm-opticompress/blob/main/src/metrics/image_metrics.m"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_project,node_gui,node_gallery,node_user toneBlue
class node_blocks,node_encoder,node_dct,node_quantsteps,node_zigzag,node_soc,node_decoder toneAmber
class node_features,node_classifier,node_model,node_selective,node_training toneMint
class node_clustering,node_transitions,node_optimization,node_comparison,node_metrics toneRose
```

## Components

### Application

- [Project launcher](https://github.com/rongalidhanush/svm-opticompress/blob/main/run_project.m): `run_project.m`
- [Interactive app](https://github.com/rongalidhanush/svm-opticompress/blob/main/app/OptiCompressApp.m): `app/OptiCompressApp.m`
- [Six-image gallery](https://github.com/rongalidhanush/svm-opticompress/blob/main/app/draw_six_images.m): `app/draw_six_images.m`

### Image codec

- [Block extraction](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/preprocessing/image_blocks.m): `src/preprocessing/image_blocks.m`
- [Image encoder](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/compress_image.m): `src/compression/compress_image.m`
- [DCT and quantization](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/dct_basis.m): `src/compression/dct_basis.m`
- [Quantization settings](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/quant_steps.m): `src/compression/quant_steps.m`
- [Zigzag scan](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/compression/zig_order.m): `src/compression/zig_order.m`
- **SOC compressed file**
- [Image decoder](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/decompression/decompress_image.m): `src/decompression/decompress_image.m`

### Features and learning

- [Block features](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/block_features.m): `src/features/block_features.m`
- [SVM classification](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/svm/label_blocks.m): `src/svm/label_blocks.m`
- [Trained SVM model](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/svm/get_model.m): `src/svm/get_model.m`
- [Selective review](https://github.com/rongalidhanush/svm-opticompress/blob/main/research/selective_quantizers.m): `research/selective_quantizers.m`
- [Model training](https://github.com/rongalidhanush/svm-opticompress/blob/main/train_svm_model.m): `train_svm_model.m`

### Analysis and comparison

- [Block clustering](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/cluster_blocks.m): `src/features/cluster_blocks.m`
- [Spatial transitions](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/features/spatial_transitions.m): `src/features/spatial_transitions.m`
- [SVM and PCA demos](https://github.com/rongalidhanush/svm-opticompress/tree/main/src/optimization): `src/optimization`
- [Method comparison](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/metrics/compare_methods.m): `src/metrics/compare_methods.m`
- [Image quality metrics](https://github.com/rongalidhanush/svm-opticompress/blob/main/src/metrics/image_metrics.m): `src/metrics/image_metrics.m`

### Other components

- **Image user**

## Connections

- Image user → Project launcher: launches (evidence: `README.md`)
- Project launcher → Interactive app: opens (evidence: `README.md`)
- Image user → Interactive app: selects image (evidence: `README.md`)
- Interactive app → Six-image gallery: shows comparison (evidence: `README.md`)
- Interactive app → Image encoder: compresses image (evidence: `README.md`)
- Block extraction → Block features: measures (evidence: `README.md`)
- Block features → SVM classification: describes blocks (evidence: `README.md`)
- Trained SVM model → SVM classification: provides model (evidence: `README.md`)
- SVM classification → Selective review: scores settings (evidence: `README.md`)
- Selective review → Image encoder: reviews blocks (evidence: `README.md`)
- Image encoder → DCT and quantization: transforms blocks (evidence: `README.md`)
- Image encoder → Quantization settings: quantizes coefficients (evidence: `README.md`)
- Image encoder → Zigzag scan: scans coefficients (evidence: `README.md`)
- Image encoder → SOC compressed file: writes stream (evidence: `README.md`)
- SOC compressed file → Image decoder: reads stream (evidence: `README.md`)
- Model training → Trained SVM model: replaces model (evidence: `README.md`)
- Image user → Block clustering: explores clusters (evidence: `README.md`)
- Block clustering → Spatial transitions: enables inspection (evidence: `README.md`)
- Image user → SVM and PCA demos: explores optimization (evidence: `README.md`)
- Image user → Method comparison: compares encoders (evidence: `README.md`)
- Method comparison → Image quality metrics: reports quality (evidence: `README.md`)
