Skip to main content

Data Section

Project description

Fragment

GitHub Python Contributions welcome

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 git+https://github.com/fuzailpalnak/fragment.git#egg=fragment

Image Fragments

fragments

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.

import numpy as np
from 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_fragment-0.2.1.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file image_fragment-0.2.1.tar.gz.

File metadata

  • Download URL: image_fragment-0.2.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7

File hashes

Hashes for image_fragment-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8a9f0d21657a8162efc53f271b0316ac7bdcd79b3fa6348cc5edb913b97fcc70
MD5 5e8931ffc8b58950ed5098d83b9aed6b
BLAKE2b-256 9e0bdd376e40b7da3b5a2af52cfd7320af0aa7bdd6daad94592a5ba0342705d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page