# Sharpening-Effect
**Repository Path**: chunfengshi/Sharpening-Effect
## Basic Information
- **Project Name**: Sharpening-Effect
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-11-10
- **Last Updated**: 2025-11-10
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Sharpening-Effect
Sharpening an image is a very basic method of image processing. In principle, image sharpening consists
of adding to the original image a signal that is proportional to a high-pass filtered version of the original image
## Tools and Languages:
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install cv2 and numpy.
```bash
pip install cv2
pip install numpy
```
## Import
Use [import](https://www.w3schools.com/python/ref_keyword_import.asp) keyword to import modules.
```python
import cv2
import numpy as np
```
## Reading image from file
```python
img = cv2.imread("cat.png")
```
## Adding Sharpening effect
Image sharpening refers to any enhancement technique that highlights edges and,
fine details in an image.
Image sharpening is widely used in printing and photographic industries for increasing
the local contrast and sharpening the images.
```python
kernel_sharpening = np.array([[-1,-1,-1],
[-1, 9,-1],
[-1,-1,-1]])
```
Above we are adding a kernel enabled with an array of values used to normalize the pixel values.
You can play with the values we have entered to change the amount of sharpening.
```python
sharpened = cv2.filter2D(img,-1,kernel_sharpening)
```
Here we used *cv2.filter2D( )* function in order to produce our sharpen image. Here the kernel and
input image are filtered.
This function takes 3 args *input image* , *Desired depth* & *kernel values*.
## Completion message
```python
print('Image Sharpened.')
```
## comparing original vs resized
```python
cv2.imshow('ORIGINAL',img)
cv2.imshow('SHARPEN',sharpened)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
## Images