{"id":30705062,"url":"https://github.com/mradovic38/image-processing-octave","last_synced_at":"2025-09-02T18:07:02.036Z","repository":{"id":307999219,"uuid":"1031316659","full_name":"mradovic38/image-processing-octave","owner":"mradovic38","description":"Various image processing techniques implemented in GNU Octave.","archived":false,"fork":false,"pushed_at":"2025-08-03T15:03:25.000Z","size":703,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T15:28:38.157Z","etag":null,"topics":["computer-vision","convolution","edge-detection","gaussian-pyramid","gnu-octave","haar-wavelets","hybrid-image","image-processing","image-reconstruction","laplacian-pyramid","marr-hildreth","matlab","multiresolution-image-blending","octave","wavelet-transform"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mradovic38.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-03T13:41:56.000Z","updated_at":"2025-08-03T15:03:29.000Z","dependencies_parsed_at":"2025-08-03T15:28:40.226Z","dependency_job_id":"77a5900a-e5bb-4b68-9bed-d4fd1ed18bf6","html_url":"https://github.com/mradovic38/image-processing-octave","commit_stats":null,"previous_names":["mradovic38/image-processing-octave"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mradovic38/image-processing-octave","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mradovic38%2Fimage-processing-octave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mradovic38%2Fimage-processing-octave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mradovic38%2Fimage-processing-octave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mradovic38%2Fimage-processing-octave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mradovic38","download_url":"https://codeload.github.com/mradovic38/image-processing-octave/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mradovic38%2Fimage-processing-octave/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273325744,"owners_count":25085600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","convolution","edge-detection","gaussian-pyramid","gnu-octave","haar-wavelets","hybrid-image","image-processing","image-reconstruction","laplacian-pyramid","marr-hildreth","matlab","multiresolution-image-blending","octave","wavelet-transform"],"created_at":"2025-09-02T18:07:00.509Z","updated_at":"2025-09-02T18:07:02.022Z","avatar_url":"https://github.com/mradovic38.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Processing with Octave\nThis repository demonstrates various image processing techniques implemented using [GNU Octave](https://www.gnu.org/software/octave/). The aim is to showcase foundational methods in image filtering, enhancement, and analysis, ideal for learning and experimentation.\n\n\n## 🚀 Getting Started\n\n### Requirements\n\n- GNU Octave (version ≥ 6.0 recommended)\n- Image package:  \n  Open Octave and run:\n  ```octave\n  pkg install -forge image\n  pkg load image\n  ```\n### Running the Scripts\nClone the repository and run any `.m` file (except `helper_functions.m`):\n```bash\ngit clone https://github.com/yourusername/image-processing-octave.git\ncd image-processing-octave\noctave technique1.m\n```\n\n## 🧪 Techniques Implemented\n\n### 1. Linear Gaussian Filtering (Manual vs Built-in)\nThis script demonstrates linear spatial filtering using a Gaussian kernel to achieve image blurring. Gaussian blur is a fundamental technique in image processing used for noise reduction and smoothing. The method works by convolving the image with a kernel derived from the Gaussian function, which applies a weighted average over each pixel’s neighborhood.\n\nIn this implementation, we manually perform convolution using a custom function `f_linFilt`:\n- The kernel is flipped as per convolution requirements.\n- The image is padded using replicated edge values to avoid boundary artifacts.\n- Each pixel is processed by multiplying its local neighborhood with the kernel and summing the result.\n\nTo validate our implementation, we compare its results with Octave's built-in `imfilter` function using the same kernel. The script calculates and prints the difference between the two outputs to verify correctness.\n\nMultiple sigma values (`σ = 1, 3, 7`) are used to observe how the degree of blurring increases with larger Gaussian kernels. A visual comparison is provided using subplots showing the original image and the outputs for different sigmas.\n\nThis exercise reinforces understanding of convolution, kernel design, image padding, and Gaussian filtering fundamentals.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/384fc8c4-ecad-4d95-b992-5974fe7ad0ed\" width=\"50%\"\u003e\n\n### 2. Marr-Hildreth Edge Detection\nThis script implements the Marr-Hildreth edge detection technique, which is based on the Laplacian of Gaussian (LoG) operator. The method identifies edges by locating zero-crossings in the second derivative of the image intensity.\n\n**Steps involved:**\n1. **Smoothing with Gaussian Filter**: The input image is first smoothed using a Gaussian filter to reduce noise and irrelevant details. A custom convolution is used for this step, similar to the linear filtering in Technique 1.\n2. **Applying Laplacian Operator**: The Laplacian kernel is convolved with the smoothed image to highlight regions of rapid intensity change.\n3. **Zero-Crossing Detection**: Edges are identified where the Laplacian response changes sign (i.e., from positive to negative or vice versa), provided the change is significant enough, determined by a threshold set as a fraction of the maximum absolute Laplacian value.\n\nThis implementation explores vertical, horizontal, and both diagonal directions when detecting zero-crossings, ensuring robustness to different edge orientations.\n\nThe result is a binary edge map showing where significant transitions occur. This approach is inspired by early visual processing models in the human visual system, making it both biologically plausible and computationally effective.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/8ade17d2-aadf-476f-a5a7-799e32cb6e37\" width=\"50%\"\u003e\n\n### 3. Hybrid Image Generation (Low + High Frequencies)\nThis script creates a hybrid image by combining two source images: one filtered with a low-pass filter and the other with a high-pass filter. The resulting image exhibits an interesting optical illusion, from a close distance, high-frequency details dominate (e.g., the cat), while from afar, low-frequency information becomes prominent (e.g., the dog).\n\n**How it works:**\n1. **Low-Pass Filtering**: A Gaussian blur is applied to the first image (e.g., a dog), removing high-frequency components and leaving only coarse structures.\n2. **High-Pass Filtering**: The second image (e.g., a cat) is also Gaussian blurred, and this blurred version is subtracted from the original to isolate its high-frequency content.\n3. **Image Fusion**: The low-pass result and the high-pass result are added together to form a single image, the hybrid.\n\nBy adjusting the sigma values for each filter (e.g., σₗ = 10, σₕ = 2), we control the level of blurring or sharpness in the frequency components. The final image appears different depending on viewing distance due to the way human vision perceives spatial frequencies.\n\nThis technique is inspired by visual cognition studies and popularized by work from Oliva, Torralba, and others in the hybrid images field.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/5f6ada7d-2560-454c-8696-f7c583be359a\" width=\"35%\"\u003e\n\n### 4. Multi-Resolution Blending using Laplacian Pyramids\n\nThis script demonstrates a powerful image processing technique called **multi-resolution blending**, which combines two images seamlessly using Gaussian and Laplacian pyramids. It's especially useful for blending images with soft transitions, such as in panorama stitching or object compositing. A vertical mask is used to blend the left half of the apple with the right half of the orange. The result is a smooth composite where no harsh seams are visible, even though the original inputs are visually distinct.\n\nThe method is inspired by Burt and Adelson’s pyramid-based approach to image fusion.\n\n**Key Concepts:**\n\n* **Gaussian Pyramid**: A sequence of images obtained by iteratively applying a Gaussian filter and downsampling. Each level represents a progressively more blurred and lower-resolution version of the original.\n* **Laplacian Pyramid**: Formed by subtracting consecutive levels of the Gaussian pyramid, this highlights detail (i.e., high-frequency information) at each scale.\n* **Blending Mask Pyramid**: A spatial mask, typically binary (left vs. right), defines which parts of the two images to blend. This mask is also downsampled to match each pyramid level, ensuring a gradual transition.\n\n**Steps in the Script:**\n\n1. **Generate 1D Gaussian filters** for both downsampling (decimation) and upsampling (interpolation), where the standard deviation σ is based on 1% of the image size.\n2. **Build Laplacian pyramids** for both images to be blended. This includes Gaussian pyramid construction and subtractive generation of detail layers.\n3. **Build a Gaussian pyramid for the blending mask** (e.g., left half white, right half black), ensuring smooth transitions across scales.\n4. **Blend the images at each pyramid level** using the corresponding mask. This ensures that blending respects spatial frequency characteristics at every resolution.\n5. **Reconstruct the final image** from the blended Laplacian pyramid via successive upsampling and addition.\n\n**Visualization:**\nOptional pyramid visualizations are included to inspect each level of the Laplacian and mask pyramids. These help understand how fine details are blended at different resolutions.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/00d65271-1c68-4da4-8951-cc1cfac06b2a\" width=\"50%\"\u003e\n\n\n### 5. Wavelet Decomposition via Lifting Scheme\n\nThis script demonstrates an efficient and fully reversible method for decomposing an image using **wavelet transforms**, specifically employing the **lifting scheme**. Unlike traditional convolution-based wavelets, the lifting scheme is computationally lightweight, integer-friendly, and suitable for scalable image analysis and compression.\n\n#### Overview of the Lifting Scheme\n\nWavelet decomposition breaks down an image into approximations and details at multiple scales. The lifting scheme performs this using a sequence of predict and update steps:\n\n1. **Split**: The image is separated into even and odd pixel indices, first across rows, then across columns.\n2. **Predict**: Differences (details) are computed between the odd and even indexed pixels. These represent high-frequency (edge) information.\n3. **Update**: The even pixels are updated using a weighted sum of the details to better represent low-frequency (smooth) components.\n4. **Repeat**: This process is recursively applied to the low-frequency component (approximation) to create a multi-level decomposition.\n\nThe decomposition stores:\n\n* Three **detail subbands** (horizontal, vertical, diagonal edges),\n* One **approximation subband**.\n\nThese are stored in a structured pyramid (`pyr`) along with shape metadata (`pind`) for later reconstruction.\n\n#### Reconstruction\n\nThe reverse process uses the stored pyramid to rebuild the image. It performs:\n\n* Reverse update and predict steps,\n* Interleaving of odd and even pixel locations,\n* Upsampling to restore original dimensions.\n\nA difference check (`min/max`) is performed to verify lossless reconstruction, confirming the accuracy of the implementation.\n\n#### Visualization\n\nTwo outputs are shown:\n\n1. **Reconstructed image**: Demonstrates the exact recovery from the wavelet coefficients.\n2. **Isolated Edges**: By zeroing out the final approximation layer and reconstructing only from details, we visualize high-frequency content (i.e., edges).\n\nThis implementation gives insight into scalable transforms, foundational to applications in image compression (e.g., JPEG 2000), denoising, and feature extraction.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/9b1dc0be-7dfe-43ef-8bc9-cec3da3ba2ae\" width=\"45%\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/009fd922-eb9d-4bbc-ba33-e8b12ec421cf\" width=\"45%\"\u003e\n\n\n## 📄 License\nThis project is open-source under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## 📖 Resources\n1. [Theory of Edge Detection - D. C. Marr, Ellen C Hildreth](https://www.researchgate.net/publication/17083076_Theory_of_Edge_Detection)\n2. [Hybrid images - Aude Oliva, Antonio Torralba, Philippe G Schyns](https://www.researchgate.net/publication/220184425_Hybrid_images)\n3. [A Multiresolution Spline With Application to Image Mosaics - Peter J. Burt and Edward H. Adelson](https://persci.mit.edu/pub_pdfs/spline83.pdf)\n4. [The Lifting Scheme:A Construction of Second Generation Wavelets - Wim Sweldens](https://cm-bell-labs.github.io/who/wim/papers/lift2.pdf)\n---\n\nFeel free to star ⭐ the repo if you find it useful!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmradovic38%2Fimage-processing-octave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmradovic38%2Fimage-processing-octave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmradovic38%2Fimage-processing-octave/lists"}