лаба 1 рабочая

This commit is contained in:
2022-11-24 15:27:13 +03:00
parent fffd3dbe72
commit 0f101d9dd8
5 changed files with 45586 additions and 0 deletions

BIN
lab1/image/apple.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

16
lab1/image/main.py Normal file
View File

@@ -0,0 +1,16 @@
import cv2
src = cv2.imread('apple.bmp', 1)
cv2.imshow('original', src)
imgray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', imgray)
_, tresh = cv2.threshold(imgray, 127, 255, 0)
cv2.imshow('tresh', tresh)
contours, _ = cv2.findContours(tresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(src, contours, -1, (0, 255, 0), 2)
cv2.imshow('eye', src)
cv2.waitKey(0)
cv2.destroyAllWindows()