# satcompression
Efficient decomposition of satellite images in a Quad-Tree structure
## Installation
```bash
pip install satcompression
```
## Usage
Compression and decompression of satellite images using the Quad-Tree structure.
```python
import satcompression
import rasterio as rio
# Load an image
with rio.open('path/to/image.tif') as src:
image_meta = src.meta
image_data = src.read()
# Compress the image
image_data_compress = satcompression.compress_and_encode_image_data(
image_data=image_data, detail_error_threshold=20
)
# Decompress the image
image_data_decompress = satcompression.reconstruct_image_data(
data=image_data_compress, dtype=image_data.dtype, nchannels = image_data.shape[0]
)
```

Obtain the pseudo-mtf from the quadtree structure.
```python
import satcompression
import matplotlib.pyplot as plt
with rio.open('path/to/image.tif') as src:
image_data = src.read()
mtf_values1, x_axis1 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=20)
mtf_values2, x_axis2 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=10)
mtf_values3, x_axis3 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=5)
plt.plot(x_axis1, mtf_values1, label="Detail Error Threshold: 0.002")
plt.plot(x_axis2, mtf_values2, label="Detail Error Threshold: 0.001")
plt.plot(x_axis3, mtf_values3, label="Detail Error Threshold: 0.0005")
plt.legend()
plt.ylim(0, 1.2)
plt.title("Pseudo-MTF obtained from the quadtree decomposition")
plt.show()
```

Obtain the classification of the quadtree nodes.
```python
import satcompression
with rio.open('path/to/image.tif') as src:
image_data = src.read()
satcompression.create_classification_map(image_data, detail_error_threshold=20)
```

Raw data
{
"_id": null,
"home_page": "https://github.com/csaybar/satcompression",
"name": "satcompression",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Cesar Aybar",
"author_email": "fcesar.aybar@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/49/c6/222cc01e27ea56f527e406c22732ca3f4a131bd656e4c193e3bd9995b4dc/satcompression-0.0.3.tar.gz",
"platform": null,
"description": "# satcompression\nEfficient decomposition of satellite images in a Quad-Tree structure\n\n\n## Installation\n\n```bash\npip install satcompression\n```\n\n## Usage\n\nCompression and decompression of satellite images using the Quad-Tree structure.\n\n```python\nimport satcompression\nimport rasterio as rio\n\n# Load an image\nwith rio.open('path/to/image.tif') as src:\n image_meta = src.meta\n image_data = src.read()\n\n# Compress the image\nimage_data_compress = satcompression.compress_and_encode_image_data(\n image_data=image_data, detail_error_threshold=20\n)\n\n# Decompress the image\nimage_data_decompress = satcompression.reconstruct_image_data(\n data=image_data_compress, dtype=image_data.dtype, nchannels = image_data.shape[0]\n)\n```\n\n\n\nObtain the pseudo-mtf from the quadtree structure.\n\n```python\nimport satcompression\nimport matplotlib.pyplot as plt\n\nwith rio.open('path/to/image.tif') as src: \n image_data = src.read()\n\nmtf_values1, x_axis1 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=20)\nmtf_values2, x_axis2 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=10)\nmtf_values3, x_axis3 = satcompression.quadtree_mtf(image_data, 10, detail_error_threshold=5)\n\nplt.plot(x_axis1, mtf_values1, label=\"Detail Error Threshold: 0.002\")\nplt.plot(x_axis2, mtf_values2, label=\"Detail Error Threshold: 0.001\")\nplt.plot(x_axis3, mtf_values3, label=\"Detail Error Threshold: 0.0005\")\nplt.legend()\nplt.ylim(0, 1.2)\nplt.title(\"Pseudo-MTF obtained from the quadtree decomposition\")\nplt.show()\n```\n\n\n\nObtain the classification of the quadtree nodes.\n\n```python\nimport satcompression\n\nwith rio.open('path/to/image.tif') as src: \n image_data = src.read()\n\nsatcompression.create_classification_map(image_data, detail_error_threshold=20)\n```\n\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A python package to compress sat data",
"version": "0.0.3",
"project_urls": {
"Documentation": "https://csaybar.github.io/satcompression/",
"Homepage": "https://github.com/csaybar/satcompression",
"Repository": "https://github.com/csaybar/satcompression"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4bf9f36588629bfec616ed33253626d5d266f497432257f834f7cc144606b15e",
"md5": "fb6d77b08eca1eb94b9817e7a06c14e2",
"sha256": "6af0c812035a4f13da621a728b82a87d47eae9da84159a1b2c805f92aff35027"
},
"downloads": -1,
"filename": "satcompression-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb6d77b08eca1eb94b9817e7a06c14e2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 9631,
"upload_time": "2024-07-13T19:12:26",
"upload_time_iso_8601": "2024-07-13T19:12:26.764963Z",
"url": "https://files.pythonhosted.org/packages/4b/f9/f36588629bfec616ed33253626d5d266f497432257f834f7cc144606b15e/satcompression-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49c6222cc01e27ea56f527e406c22732ca3f4a131bd656e4c193e3bd9995b4dc",
"md5": "04c05358b762af03e1504b8e468134a2",
"sha256": "6c10fbfa83c8e0bd3be0dca31b76a62705bdb36b0949cc4ba5c5e52766ebaf1b"
},
"downloads": -1,
"filename": "satcompression-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "04c05358b762af03e1504b8e468134a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 8833,
"upload_time": "2024-07-13T19:12:28",
"upload_time_iso_8601": "2024-07-13T19:12:28.290254Z",
"url": "https://files.pythonhosted.org/packages/49/c6/222cc01e27ea56f527e406c22732ca3f4a131bd656e4c193e3bd9995b4dc/satcompression-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-13 19:12:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "csaybar",
"github_project": "satcompression",
"github_not_found": true,
"lcname": "satcompression"
}