receipt-enhancer


Namereceipt-enhancer JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryThis module is essential for preprocessing receipt images to improve visual quality and facilitate automatic analysis.
upload_time2024-04-30 02:04:34
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/35/83/83567bf1be5a2088e5a651ef4f0cdf33a066dd6fb56d7fb2e0307937edb2/receipt_enhancer-0.1.7.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.7",
    "project_urls": null,
    "split_keywords": [
        "document",
        " nfe",
        " invoice",
        " receipt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bcb1d4d313add7ba15b6616cff225f1efbfa2b9d99be8a3f53e526200b461afa",
                "md5": "7448b6f69f2d2d0015e9f73adac18b2e",
                "sha256": "271453d885a5c9ed2bbe17d67d59b12ac0d514b62394bb8c0b988e4fd083a5d4"
            },
            "downloads": -1,
            "filename": "receipt_enhancer-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7448b6f69f2d2d0015e9f73adac18b2e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7354,
            "upload_time": "2024-04-30T02:04:30",
            "upload_time_iso_8601": "2024-04-30T02:04:30.215486Z",
            "url": "https://files.pythonhosted.org/packages/bc/b1/d4d313add7ba15b6616cff225f1efbfa2b9d99be8a3f53e526200b461afa/receipt_enhancer-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "358383567bf1be5a2088e5a651ef4f0cdf33a066dd6fb56d7fb2e0307937edb2",
                "md5": "cc8338d24df8d4fc92a5d2e77ca1baf1",
                "sha256": "a97c77141d19e21179ed4f82560e99ac920320661523c604468f2871111e8e15"
            },
            "downloads": -1,
            "filename": "receipt_enhancer-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "cc8338d24df8d4fc92a5d2e77ca1baf1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 6487,
            "upload_time": "2024-04-30T02:04:34",
            "upload_time_iso_8601": "2024-04-30T02:04:34.391324Z",
            "url": "https://files.pythonhosted.org/packages/35/83/83567bf1be5a2088e5a651ef4f0cdf33a066dd6fb56d7fb2e0307937edb2/receipt_enhancer-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 02:04:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "receipt-enhancer"
}
        
Elapsed time: 0.24893s