Preprocess images using PIL
- Open
- Filter
- Contrast Change
- Grey scale
- Tricks to denoise
- Binarize
- Crop
We can use PIL
package to preprocess images in order to do some other stuff(?). For example, we have the following image and we want to extract clear character from the images.
This is another way to denoise. For each pixel, we look its surrounding pixels. If it has more than 2 surrounding pixels belong to background, we label as noise. However, it does not work well in this case.
array([[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
...,
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255]], dtype=uint8)