лаба 1 рабочая
This commit is contained in:
BIN
lab1/image/apple.bmp
Normal file
BIN
lab1/image/apple.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 325 KiB |
16
lab1/image/main.py
Normal file
16
lab1/image/main.py
Normal 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()
|
Reference in New Issue
Block a user