image processing pytorch code example
Example 1: image processing python
The OpenCV documentation itself is good to start with.
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_table_of_contents_imgproc/py_table_of_contents_imgproc.html
Example 2: image processing for OCR using python
1|
2| import cv2
3| import pytesseract
5|
6| image = cv2.imread(sample_image.png’)
7|
8| gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
9|
10|
11|
11|threshold_img = cv2.threshold(gray_image, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
12|
13| cv2.imshow(‘threshold image’, threshold_img)
14|
15| cv2.waitKey(0)
16|
17| cv2.destroyAllWindows()