receipt-enhancer


Namereceipt-enhancer JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryThis module is essential for preprocessing receipt images to improve visual quality and facilitate automatic analysis.
upload_time2024-08-14 17:48:28
maintainerNone
docs_urlNone
authorRicardo Castro
requires_python<4.0,>=3.8
licenseMIT
keywords document nfe invoice receipt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Receipt Enhancer

Receipt Enhancer is a Python module designed to enhance and process images of receipts. It provides various functionalities for improving the quality of receipt images, including converting to grayscale, detecting lines using the Hough transform, enhancing local contrast, adaptive thresholding, and more.

## Features

- **Convert to Grayscale:** Converts the input image to grayscale for further processing.
- **Hough Line Detection:** Detects lines in the image using the Hough transform, useful for identifying borders and text regions.
- **Densest Region Detection:** Finds the densest region of lines in the image, often indicating the center of the receipt.
- **Image Rotation Correction:** Corrects the rotation of the image based on detected lines.
- **Adaptive Local Contrast Enhancement:** Enhances the local contrast of the image to improve visibility of text and details.
- **Adaptive Weighting:** Adjusts the intensity of image pixels based on local statistics to improve overall quality.
- **Adaptive Binary Thresholding:** Applies adaptive binary thresholding to segment the image into foreground and background regions.

## Installation

You can install Receipt Enhancer using pip:

```bash
pip install receipt-enhancer
```

## Usage

```python
from receipt_enhancer import ReceiptEnhancer
import cv2

# Initialize ReceiptEnhancer
enhancer = ReceiptEnhancer()

# Load an image
image = cv2.imread('receipt_image.jpg')

# Example Usage:
# Convert to grayscale
grey_image = enhancer.convert_to_greyscale(image)

# Detect lines using Hough transform
lines = enhancer.get_hough_lines(image, length=(50, 100), min_distance=(20, 50))

# Find densest region
densest_x, densest_y = enhancer.find_densest_region(image, lines)

# Correct rotation
corrected_image = enhancer.rotation_fix_hough_based(image, lines)

# Enhance local contrast
contrast_enhanced_image = enhancer.adaptive_local_contrast(image)

# Apply adaptive weighting
weighted_image = enhancer.adaptative_weight(image)

# Apply adaptive binary thresholding
binary_image = enhancer.adaptive_binary_threshold(image)
```

## Contributions

Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue or submit a pull request on GitHub.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "receipt-enhancer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "document, nfe, invoice, receipt",
    "author": "Ricardo Castro",
    "author_email": "srrenks@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cd/55/de5fceb8a5072207f1fa992f13d83271b2af085e7582216245c2cee0dfc3/receipt_enhancer-0.1.8.tar.gz",
    "platform": null,
    "description": "# Receipt Enhancer\n\nReceipt Enhancer is a Python module designed to enhance and process images of receipts. It provides various functionalities for improving the quality of receipt images, including converting to grayscale, detecting lines using the Hough transform, enhancing local contrast, adaptive thresholding, and more.\n\n## Features\n\n- **Convert to Grayscale:** Converts the input image to grayscale for further processing.\n- **Hough Line Detection:** Detects lines in the image using the Hough transform, useful for identifying borders and text regions.\n- **Densest Region Detection:** Finds the densest region of lines in the image, often indicating the center of the receipt.\n- **Image Rotation Correction:** Corrects the rotation of the image based on detected lines.\n- **Adaptive Local Contrast Enhancement:** Enhances the local contrast of the image to improve visibility of text and details.\n- **Adaptive Weighting:** Adjusts the intensity of image pixels based on local statistics to improve overall quality.\n- **Adaptive Binary Thresholding:** Applies adaptive binary thresholding to segment the image into foreground and background regions.\n\n## Installation\n\nYou can install Receipt Enhancer using pip:\n\n```bash\npip install receipt-enhancer\n```\n\n## Usage\n\n```python\nfrom receipt_enhancer import ReceiptEnhancer\nimport cv2\n\n# Initialize ReceiptEnhancer\nenhancer = ReceiptEnhancer()\n\n# Load an image\nimage = cv2.imread('receipt_image.jpg')\n\n# Example Usage:\n# Convert to grayscale\ngrey_image = enhancer.convert_to_greyscale(image)\n\n# Detect lines using Hough transform\nlines = enhancer.get_hough_lines(image, length=(50, 100), min_distance=(20, 50))\n\n# Find densest region\ndensest_x, densest_y = enhancer.find_densest_region(image, lines)\n\n# Correct rotation\ncorrected_image = enhancer.rotation_fix_hough_based(image, lines)\n\n# Enhance local contrast\ncontrast_enhanced_image = enhancer.adaptive_local_contrast(image)\n\n# Apply adaptive weighting\nweighted_image = enhancer.adaptative_weight(image)\n\n# Apply adaptive binary thresholding\nbinary_image = enhancer.adaptive_binary_threshold(image)\n```\n\n## Contributions\n\nContributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue or submit a pull request on GitHub.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This module is essential for preprocessing receipt images to improve visual quality and facilitate automatic analysis.",
    "version": "0.1.8",
    "project_urls": null,
    "split_keywords": [
        "document",
        " nfe",
        " invoice",
        " receipt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b32e863361b75ddd0041c8d91a7c6c8ee5bbcf5b4d4042a1d5fa79c37a572d3a",
                "md5": "6e80e01752b7359b4b13a2b34473f584",
                "sha256": "de6d5a99203050ae88e41e515aa009cae738f19bb88f557061370663f64f0644"
            },
            "downloads": -1,
            "filename": "receipt_enhancer-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6e80e01752b7359b4b13a2b34473f584",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7310,
            "upload_time": "2024-08-14T17:48:27",
            "upload_time_iso_8601": "2024-08-14T17:48:27.773237Z",
            "url": "https://files.pythonhosted.org/packages/b3/2e/863361b75ddd0041c8d91a7c6c8ee5bbcf5b4d4042a1d5fa79c37a572d3a/receipt_enhancer-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd55de5fceb8a5072207f1fa992f13d83271b2af085e7582216245c2cee0dfc3",
                "md5": "7994f4f031275a3241b4172c67db0a05",
                "sha256": "875974bf6ef5978a005e20acc7a59e6bde5d23e17ffab2ed07f16e8d51a52f6a"
            },
            "downloads": -1,
            "filename": "receipt_enhancer-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "7994f4f031275a3241b4172c67db0a05",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 6560,
            "upload_time": "2024-08-14T17:48:28",
            "upload_time_iso_8601": "2024-08-14T17:48:28.807866Z",
            "url": "https://files.pythonhosted.org/packages/cd/55/de5fceb8a5072207f1fa992f13d83271b2af085e7582216245c2cee0dfc3/receipt_enhancer-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 17:48:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "receipt-enhancer"
}
        
Elapsed time: 0.34225s