image-fragment


Nameimage-fragment JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/fuzailpalnak/fragment
SummaryData Section
upload_time2023-05-31 10:33:05
maintainer
docs_urlNone
authorFuzail Palnak
requires_python~=3.6
license
keywords numpy window section array stitch split
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Fragment
![GitHub](https://img.shields.io/github/license/fuzailpalnak/fragment)
![Python](https://img.shields.io/badge/python-v3.6+-blue.svg)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)
![Downloads](https://pepy.tech/badge/image-fragment)

Any extent is a set of smaller fragment extent , which can be as small as *1 x 1* to the *size* of the extent given.
This library will section the given extent in to specified smaller fragment extent


## Installation

    pip install image-fragment


## Image Fragments

![fragments](https://user-images.githubusercontent.com/24665570/91711219-2b7c8980-eba3-11ea-94d2-8239cf6713c4.gif)

An image extent can be sectioned into many fragments, these fragments holds positional information to where it is located 
to the original extent

Now this information can be used to extract selected fragments from the Image, perform operation, and transfer the new 
data to selected position.


```python
import numpy as np
from image_fragment.fragment import ImageFragment

image = np.zeros((1, 1024, 1024, 3))
new_image = np.zeros((1, 1024, 1024, 3))
image_fragment = ImageFragment.image_fragment_4d(fragment_size=(1, 512, 512, 3), org_size=(1, 1024, 1024, 3))
for fragment in image_fragment:
    # GET DATA THAT BELONGS TO THE FRAGMENT
    fragmented_image = fragment.get_fragment_data(image)
    
    # DO SOME OPERATION ON THE FRAGMENTED DATA
    operation_done_on_fragmented_data = np.rot(fragmented_image)
    
    # TRANSFER OPERATED IMAGE ON NEW IMAGE ON THE FRAGMENT POSITION
    new_image = fragment.transfer_fragment(transfer_from=operation_done_on_fragmented_data, transfer_to=new_image)
    
```

If image is 3 Dimensional then switch to `image_fragment = ImageFragment.image_fragment_3d(fragment_size=(512, 512, 3), org_size=(1024, 1024, 3))`, 
this will provide fragments for 3 dimensional image

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fuzailpalnak/fragment",
    "name": "image-fragment",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.6",
    "maintainer_email": "",
    "keywords": "numpy, Window, Section, Array, Stitch, Split",
    "author": "Fuzail Palnak",
    "author_email": "fuzailpalnak@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/53/df/b8b2dbdf94473594d73a780a0b7a5344a7152cc08c5f9db7f6889cf3d5fe/image_fragment-0.2.3.tar.gz",
    "platform": null,
    "description": "# Fragment\n![GitHub](https://img.shields.io/github/license/fuzailpalnak/fragment)\n![Python](https://img.shields.io/badge/python-v3.6+-blue.svg)\n![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)\n![Downloads](https://pepy.tech/badge/image-fragment)\n\nAny extent is a set of smaller fragment extent , which can be as small as *1 x 1* to the *size* of the extent given.\nThis library will section the given extent in to specified smaller fragment extent\n\n\n## Installation\n\n    pip install image-fragment\n\n\n## Image Fragments\n\n![fragments](https://user-images.githubusercontent.com/24665570/91711219-2b7c8980-eba3-11ea-94d2-8239cf6713c4.gif)\n\nAn image extent can be sectioned into many fragments, these fragments holds positional information to where it is located \nto the original extent\n\nNow this information can be used to extract selected fragments from the Image, perform operation, and transfer the new \ndata to selected position.\n\n\n```python\nimport numpy as np\nfrom image_fragment.fragment import ImageFragment\n\nimage = np.zeros((1, 1024, 1024, 3))\nnew_image = np.zeros((1, 1024, 1024, 3))\nimage_fragment = ImageFragment.image_fragment_4d(fragment_size=(1, 512, 512, 3), org_size=(1, 1024, 1024, 3))\nfor fragment in image_fragment:\n    # GET DATA THAT BELONGS TO THE FRAGMENT\n    fragmented_image = fragment.get_fragment_data(image)\n    \n    # DO SOME OPERATION ON THE FRAGMENTED DATA\n    operation_done_on_fragmented_data = np.rot(fragmented_image)\n    \n    # TRANSFER OPERATED IMAGE ON NEW IMAGE ON THE FRAGMENT POSITION\n    new_image = fragment.transfer_fragment(transfer_from=operation_done_on_fragmented_data, transfer_to=new_image)\n    \n```\n\nIf image is 3 Dimensional then switch to `image_fragment = ImageFragment.image_fragment_3d(fragment_size=(512, 512, 3), org_size=(1024, 1024, 3))`, \nthis will provide fragments for 3 dimensional image\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Data Section",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/fuzailpalnak/fragment"
    },
    "split_keywords": [
        "numpy",
        " window",
        " section",
        " array",
        " stitch",
        " split"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e978fba84bd3778babe50ba73300e313300877e5da1e0ac4d86c7324253cf96a",
                "md5": "6c744d374cab0f5dd9a2cc285749248b",
                "sha256": "9c2f48d2a2bae25eb51b3dd94604f5ac81626200f74d631ee75fcfd093cc6410"
            },
            "downloads": -1,
            "filename": "image_fragment-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c744d374cab0f5dd9a2cc285749248b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.6",
            "size": 5051,
            "upload_time": "2023-05-31T10:33:03",
            "upload_time_iso_8601": "2023-05-31T10:33:03.688827Z",
            "url": "https://files.pythonhosted.org/packages/e9/78/fba84bd3778babe50ba73300e313300877e5da1e0ac4d86c7324253cf96a/image_fragment-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53dfb8b2dbdf94473594d73a780a0b7a5344a7152cc08c5f9db7f6889cf3d5fe",
                "md5": "7c43fc31ebb64474802459e6e4ebeb6d",
                "sha256": "adbd5b7036a4bd744ec8620b0e0b8704642a228139f67093e34160df945d9c1c"
            },
            "downloads": -1,
            "filename": "image_fragment-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7c43fc31ebb64474802459e6e4ebeb6d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.6",
            "size": 4784,
            "upload_time": "2023-05-31T10:33:05",
            "upload_time_iso_8601": "2023-05-31T10:33:05.079172Z",
            "url": "https://files.pythonhosted.org/packages/53/df/b8b2dbdf94473594d73a780a0b7a5344a7152cc08c5f9db7f6889cf3d5fe/image_fragment-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-31 10:33:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fuzailpalnak",
    "github_project": "fragment",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "image-fragment"
}
        
Elapsed time: 0.07067s