mirror of
https://gitcode.com/gh_mirrors/es/esp32-opencv.git
synced 2025-08-15 11:10:24 +08:00
initial commit
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
from __future__ import print_function
|
||||
import cv2 as cv
|
||||
import argparse
|
||||
|
||||
## [Load image]
|
||||
parser = argparse.ArgumentParser(description='Code for Histogram Equalization tutorial.')
|
||||
parser.add_argument('--input', help='Path to input image.', default='lena.jpg')
|
||||
args = parser.parse_args()
|
||||
|
||||
src = cv.imread(cv.samples.findFile(args.input))
|
||||
if src is None:
|
||||
print('Could not open or find the image:', args.input)
|
||||
exit(0)
|
||||
## [Load image]
|
||||
|
||||
## [Convert to grayscale]
|
||||
src = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
|
||||
## [Convert to grayscale]
|
||||
|
||||
## [Apply Histogram Equalization]
|
||||
dst = cv.equalizeHist(src)
|
||||
## [Apply Histogram Equalization]
|
||||
|
||||
## [Display results]
|
||||
cv.imshow('Source image', src)
|
||||
cv.imshow('Equalized Image', dst)
|
||||
## [Display results]
|
||||
|
||||
## [Wait until user exits the program]
|
||||
cv.waitKey()
|
||||
## [Wait until user exits the program]
|
Reference in New Issue
Block a user