تشخیص لبه های اشیا با پایتون
کدهای پروژه
1 >> First install library in cmd
pip install opencv-python
pip install numpy
pip install matplotlib
pip install pyqt5
2 >> Run Code With : python main.py
$$$$$$$$$$$$$$$$$$$$
import cv2 as cv
import matplotlib.pyplot as plt
def main():
img = cv.imread(‘../pic/ex5.jpg’)
#img_gry = cv.imread(img_path, 0)
img_gry = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
corners = cv.cornerHarris(img_gry, 3, 7, 0.04)
corner_dilated = cv.dilate(corners, None)
img[corner_dilated > 0.01*corner_dilated.max()] = [0, 0, 255]
plt.figure(num = ‘Corner Detection’)
plt.imshow(img)
plt.show()
if __name__ == “__main__”:
main()
دیدگاهتان را بنویسید