{"id":29748765,"url":"https://github.com/achrefbenammar404/featurebasedimagemetamorphosis","last_synced_at":"2025-07-26T10:42:34.797Z","repository":{"id":218578853,"uuid":"746819469","full_name":"achrefbenammar404/FeatureBasedImageMetamorphosis","owner":"achrefbenammar404","description":" implementation of a variation of the Feature-Based Image Metamorphosis algorithm, inspired by the paper \"Feature Based Image Metamorphosis\" by Thaddeus Beer and Shawn Neely (2011)","archived":false,"fork":false,"pushed_at":"2024-12-12T09:15:41.000Z","size":7728,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-12T10:22:58.690Z","etag":null,"topics":["computer-vision","image-morphing"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/achrefbenammar404.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-01-22T18:29:01.000Z","updated_at":"2024-12-12T09:15:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"59fd6800-eddd-43c7-9bbc-92de8f4636f3","html_url":"https://github.com/achrefbenammar404/FeatureBasedImageMetamorphosis","commit_stats":null,"previous_names":["achrefbenammar404/featurebasedimagemetamorpohosis","achrefbenammar404/featurebasedimagemetamorphosis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/achrefbenammar404/FeatureBasedImageMetamorphosis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2FFeatureBasedImageMetamorphosis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2FFeatureBasedImageMetamorphosis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2FFeatureBasedImageMetamorphosis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2FFeatureBasedImageMetamorphosis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/achrefbenammar404","download_url":"https://codeload.github.com/achrefbenammar404/FeatureBasedImageMetamorphosis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2FFeatureBasedImageMetamorphosis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267150952,"owners_count":24043557,"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-07-26T02:00:08.937Z","response_time":62,"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","image-morphing"],"created_at":"2025-07-26T10:42:33.011Z","updated_at":"2025-07-26T10:42:34.783Z","avatar_url":"https://github.com/achrefbenammar404.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Feature-Based Image Metamorphosis (Variation)\n\n## Visual Demonstration\n\n![Feature Based Image Metamorphosis](Image/image.png)\n\nThis repository contains an implementation of a variation of the **Feature-Based Image Metamorphosis** algorithm, inspired by the research paper [\"Feature-Based Image Metamorphosis\"](https://dl.acm.org/doi/10.1145/133994.134003) by Thaddeus Beier and Shawn Neely (1992). The variation is designed for use with a single image and a set of coupled vectors, enabling creative and unique image transformations.\n\n---\n\n## Algorithm Overview\n\nFeature-based image metamorphosis is a geometric warping technique that uses a set of **line pairs** (corresponding features) to guide the transformation of an image. The transformation involves two main steps:\n1. **Warping the image based on feature lines.**\n2. **Interpolating between source and target images using a blend factor.**\n\n### Core Warping Formula\n\nGiven:\n- A source image $I_s$.\n- A target image $I_t$.\n- A set of feature lines in the source image $\\{(P_i, Q_i)\\}$.\n- Corresponding feature lines in the target image $\\{(P'_i, Q'_i)\\}$.\n- A blending factor $t \\in [0, 1]$.\n\n#### Step 1: Compute Per-Pixel Warp\n\nEach pixel $X$ in the destination image is mapped back to the source image using a weighted sum of transformations induced by all feature line pairs. The warping function is defined as:\n\n$$\nX_s = X + \\sum_{i=1}^N \\text{weight}_i \\cdot \\text{displacement}_i\n$$\n\nWhere:\n- $\\text{displacement}_i = \\frac{\\overrightarrow{X'P'_i} \\cdot \\overrightarrow{Q'_iP'_i}}{\\|\\overrightarrow{Q'_iP'_i}\\|^2} \\cdot \\overrightarrow{Q_iP_i} + \\frac{\\overrightarrow{X'Q'_i} \\cdot \\overrightarrow{Q'_iP'_i}}{\\|\\overrightarrow{Q'_iP'_i}\\|^2} \\cdot \\overrightarrow{P_iQ_i}$.\n\n- $\\text{weight}_i = \\frac{\\|Q'_iP'_i\\|^p}{(a + \\text{distance}(X', L'_i))^b}$, where:\n  - $L'_i$ is the line defined by $P'_i, Q'_i$.\n  - $p$, $a$, and $b$ are user-defined constants controlling the smoothness and influence of the transformation.\n\n#### Step 2: Blend Images\n\nThe pixel intensities in the final output image are computed as a linear interpolation between the source and target images:\n\n$$\nI(X) = (1 - t) \\cdot I_s(X_s) + t \\cdot I_t(X_t)\n$$\n\nWhere $t$ controls the blending ratio between the source and target images.\n\n---\n\n## Usage\n\nRefer to the [How to Use Notebook](HowToUse.ipynb) for detailed instructions on applying the Feature-Based Image Metamorphosis algorithm with a single image and coupled vectors.\n\n---\n\n## Implementation Details\n\n- **`ImageMorphism.py`**: Core implementation of the Feature-Based Image Metamorphosis algorithm variation.\n- **`Line.py`**: Definition of a class later needed in the algorithm.\n- **`How_to_Use.ipynb`**: Jupyter Notebook providing a step-by-step guide to using the algorithm.\n\n---\n\n## Requirements\n\nEnsure you have the following dependencies installed:\n\n- **Python 3.x**\n- Required Python packages (listed in `requirements.txt`).\n\n---\n\n## Getting Started\n\n1. Clone this repository:\n\n   ```bash\n   git clone https://github.com/achrefbenammar404/FeatureBasedImageMetamorpohosis.git\n   cd FeatureBasedImageMetamorphosis\n   ```\n\n2. Install the required dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Refer to the **`How_to_Use.ipynb`** notebook for instructions on using the algorithm.\n\n---\n\n## Mathematical Insights\n\n### Influence of Parameters\n- **Line Pair Influence**: The parameters $p$, $a$, and $b$ allow fine-tuning of how much each line pair affects the pixels. Increasing $p$ reduces the influence of distant lines, while larger $b$ sharpens the transformation near the line.\n- **Blending Factor $t$**: Controls the interpolation between the source and target image. A value of $t = 0$ results in the source image, while $t = 1$ gives the target image.\n\n### Smoothness and Complexity\nThe algorithm handles smooth warping by adjusting weights dynamically for every pixel. However, the computational complexity grows with the number of feature lines and image resolution.\n\n---\n\n## Contributing\n\nIf you encounter issues or have suggestions, feel free to:\n\n- Open an issue.\n- Submit a pull request.\n\n---\n\n## References\n\nThis implementation is inspired by the following paper:\n\n- Thaddeus Beier and Shawn Neely, [**\"Feature-Based Image Metamorphosis\"**](https://dl.acm.org/doi/10.1145/133994.134003), Proceedings of SIGGRAPH '92, ACM, 1992.  \n\nThe algorithm adapts concepts from the original research to support single images and coupled vector transformations for enhanced creative flexibility.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefbenammar404%2Ffeaturebasedimagemetamorphosis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fachrefbenammar404%2Ffeaturebasedimagemetamorphosis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefbenammar404%2Ffeaturebasedimagemetamorphosis/lists"}