{"id":15551280,"url":"https://github.com/nuhmanpk/cv2filters","last_synced_at":"2025-04-23T19:25:20.391Z","repository":{"id":177864284,"uuid":"661018868","full_name":"nuhmanpk/cv2filters","owner":"nuhmanpk","description":"CV2Filters a powerful Python package designed as a wrapper around OpenCV,cv2Filters simplifies image processing tasks by providing a higher-level abstraction of the underlying OpenCV functionality","archived":false,"fork":false,"pushed_at":"2023-10-08T09:51:13.000Z","size":72014,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T19:25:09.115Z","etag":null,"topics":["computer-vision","computer-vision-opencv","dataset","hacktoberfest","hacktoberfest-accepted","hacktoberfest2022-accepted","image-analysis","image-manipulation","image-processing","object-detection","ocr-processing","opencv","opencv-python","pip","preprocessing","pypi","python","wrapper"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cv2filters/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuhmanpk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"nuhmanpk"}},"created_at":"2023-07-01T14:31:53.000Z","updated_at":"2023-10-08T10:28:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b75c127-6a81-4cc0-beac-1d6b7e23b49a","html_url":"https://github.com/nuhmanpk/cv2filters","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":0.06666666666666665,"last_synced_commit":"18de8c318cfc39416523a0f100ddcf2994e42c00"},"previous_names":["nuhmanpk/cv2filters"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhmanpk%2Fcv2filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhmanpk%2Fcv2filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhmanpk%2Fcv2filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhmanpk%2Fcv2filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuhmanpk","download_url":"https://codeload.github.com/nuhmanpk/cv2filters/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250498363,"owners_count":21440452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","computer-vision-opencv","dataset","hacktoberfest","hacktoberfest-accepted","hacktoberfest2022-accepted","image-analysis","image-manipulation","image-processing","object-detection","ocr-processing","opencv","opencv-python","pip","preprocessing","pypi","python","wrapper"],"created_at":"2024-10-02T14:03:53.637Z","updated_at":"2025-04-23T19:25:20.369Z","avatar_url":"https://github.com/nuhmanpk.png","language":"Python","funding_links":["https://github.com/sponsors/nuhmanpk"],"categories":[],"sub_categories":[],"readme":"# CV2Filters\n[![Downloads](https://static.pepy.tech/personalized-badge/cv2filters?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=yellow\u0026left_text=Total-Downloads)](https://pepy.tech/project/cv2filters)\n![PyPI - Format](https://img.shields.io/pypi/format/cv2filters)\n[![GitHub license](https://img.shields.io/github/license/nuhmanpk/cv2filters.svg)](https://github.com/nuhmanpk/cv2filters/blob/main/LICENSE)\n[![Upload Python Package](https://github.com/nuhmanpk/cv2filters/actions/workflows/publish.yml/badge.svg)](https://github.com/nuhmanpk/cv2filters/actions/workflows/publish.yml)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/cv2filters.svg)](https://pypi.org/project/cv2filters)\n![PyPI](https://img.shields.io/pypi/v/cv2filters)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/cv2filters)\n[![Downloads](https://static.pepy.tech/personalized-badge/cv2filters?period=week\u0026units=international_system\u0026left_color=grey\u0026right_color=brightgreen\u0026left_text=Downloads/Week)](https://pepy.tech/project/cv2filters)\n\nCV2Filters a powerful Python package designed as a wrapper around OpenCV, the popular open-source computer vision library. cv2Filters simplifies image processing tasks by providing a higher-level abstraction of the underlying OpenCV functionality. This package aims to make image processing more accessible to both beginner and advanced users, enabling them to efficiently perform a wide range of image manipulation and analysis tasks\n\nCV2Filters empowers users to harness the power of OpenCV in a simplified and intuitive manner. By abstracting away the complexities, the package enables a broader audience to explore image processing, drive innovation, and unlock new possibilities in the field of computer vision.\n\n[![Demo](https://raw.githubusercontent.com/nuhmanpk/cv2filters/a334cf4b4cd1e3e21d043d3d0fa1dbed70a4c6d2/demo.gif)](https://github.com/nuhmanpk/cv2filters)\n\n## Installation\n\n[Refer Example](https://github.com/nuhmanpk/cv2filters/wiki) \n\nTo install the library, you can use pip:\n\n```shell\npip install cv2filters\n```\n\n## Usage\n\nFirst, import the `Filters` class from the library:\n\n```python\nfrom cv2filters import Filters\n# Create an instance of the Filters class\nfilters = Filters()\n```\n\nNow you can use the various filtering functions available in the library. For example, let's show how to use the increase_brightness and apply_blur functions:\n\n\nCreate an instance of the Filters class and then call the desired methods on the instance. For example:\n\n```python\nfrom cv2filters import Filters\n# Create an instance of the Filters class\nfilters = Filters()\nimport cv2\n\n# Read an image\ncv2.imread('./path-to-img.jpg')\n\n# Increase brightness of the image\nbrightened_image = filters.increase_brightness(image,value=10)\n\n# Blur the image\nblurred_image = filters.blur(image,kernal_size=(5,5))\n\n# Rotate the image\nrotated_image = filters.rotate_image(image, angle=45)\n\n# Flip the image horizontally\nflipped_image = filters.flip_image(image, flip_code=1)\n\n# Crop a region from the image\ncropped_image = filters.crop_image(image, x=100, y=100, width=200, height=200)\n\n# Resize the image\nresized_image = filters.resize_image(image, width=500, height=500)\n\n# Convert the image to grayscale\ngrayscale_image = filters.convert_to_grayscale(image)\n\n# Detect edges in the image\nedges_image = filters.detect_edges(image,threshold1=100, threshold2=200)\n\n# Apply the Sobel filter to detect edges\nsobel_image = filters.sobel_filter(image,dx=1, dy= 1, ksize=3)\n\n# Apply bilateral filtering to reduce noise\nfiltered_image = filters.bilateral_filter(image,d=9, sigma_color=75, sigma_space=75)\n\n# Perform erosion on the image\neroded_image = filters.erosion(image,kernel=None, iterations=1)\n\n# Perform dilation on the image\ndilated_image = filters.dilation(image,kernel=None, iterations=1)\n\n# Apply perspective transformation to the image\ntransformed_image = filters.perspective_transform(image, src_points, dst_points)\n\n# Perform morphological opening on the image\nopened_image = filters.morphological_opening(image,kernel=None, iterations=2)\n\n# Perform morphological closing on the image\nclosed_image = filters.closing(image,kernel=None, iterations=2)\n\n# Highlight a box region in the image\nhighlighted_image = filters.highlight_box(image, (x, y, width, height))\n```\n\n* Make sure to replace 'path_to_image.jpg' with the actual path to the image file you want to process, and adjust the method arguments as needed.\n  \n## Methods\n\n1. **read_image**(file_path: str) -\u003e np.ndarray:\nThis method reads an image from the specified file path and returns it as a NumPy array.\n\n2. **increase_brightness**(image: np.ndarray, value: int = 10) -\u003e np.ndarray:\nThis method increases the brightness of an image by the specified value.\n\n3. **blur**(image: np.ndarray, kernel_size: tuple = (5, 5)) -\u003e np.ndarray:\nThis method applies a Gaussian blur to the image using the specified kernel size.\n\n4. **rotate_image**(image: np.ndarray, angle: float) -\u003e np.ndarray:\nThis method rotates an image by the specified angle.\n\n5. **flip_image**(image: np.ndarray, flip_code: int) -\u003e np.ndarray:\nThis method flips an image horizontally or vertically based on the flip code.\n\n6. **crop_image**(image: np.ndarray, x: int, y: int, width: int, height: int) -\u003e np.ndarray:\nThis method crops a rectangular region from an image based on the specified coordinates and dimensions.\n\n7. **resize_image**(image: np.ndarray, width: int = 250, height: int = 250) -\u003e np.ndarray:\nThis method resizes an image to the specified width and height.\n\n8. **convert_to_grayscale**(image: np.ndarray) -\u003e np.ndarray:\nThis method converts an image to grayscale.\n\n9. **detect_edges**(image: np.ndarray, threshold1: float = 100, threshold2: float = 200) -\u003e np.ndarray:\nThis method detects edges in an image using the Canny edge detection algorithm.\n\n10. **sobel_filter**(image: np.ndarray, dx: int = 1, dy: int = 1, ksize: int = 3) -\u003e np.ndarray:\nThis method applies the Sobel filter to an image for edge detection.\n\n11. **bilateral_filter**(image: np.ndarray, d: int = 9, sigma_color: float = 75, sigma_space: float = 75) -\u003e np.ndarray:\nThis method applies a bilateral filter to an image for noise reduction.\n\n12. **erosion**(image: np.ndarray, kernel: np.ndarray = None, iterations: int = 1) -\u003e np.ndarray:\nThis method applies erosion to an image using the specified kernel and number of iterations.\n\n13. **dilation**(image: np.ndarray, kernel: np.ndarray = None, iterations: int = 1) -\u003e np.ndarray:\nThis method applies dilation to an image using the specified kernel and number of iterations.\n\n14. **perspective_transform**(image: np.ndarray, src_points: np.ndarray, dst_points: np.ndarray) -\u003e np.ndarray:\nThis method applies a perspective transformation to an image using the specified source and destination points.\n\n15. **morphological_opening**(image: np.ndarray, kernel: np.ndarray = None, iterations: int = 2) -\u003e np.ndarray:\nThis method applies morphological opening to an image to remove noise and small objects.\n\n16. **closing**(image: np.ndarray, kernel: np.ndarray = None, iterations: int = 2) -\u003e np.ndarray:\nThis method applies morphological closing to an image to close small holes.\n\n17. **highlight_box**(image: np.ndarray, box: Tuple[int, int, int, int]) -\u003e np.ndarray:\nThis method highlights a box region in an image by turning the rest of the image to black.\n\n## For testing \n\n```bash\n\npython -m unittest tests.test_image_filters\n\n\n```\n\n## Contributing\n\nIf you'd like to contribute to this library, please follow these steps:\n\n* Fork the repository.\n* Create a new branch.\n* Make your changes and test them.\n* Submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuhmanpk%2Fcv2filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuhmanpk%2Fcv2filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuhmanpk%2Fcv2filters/lists"}