Compare commits
2 Commits
48b8bfaec8
...
b6baa3894e
Author | SHA1 | Date |
---|---|---|
kosa-as | b6baa3894e | 2 years ago |
kosa-as | 39ca580882 | 2 years ago |
@ -0,0 +1,53 @@
|
||||
# ---> Eagle
|
||||
# Ignore list for Eagle, a PCB layout tool
|
||||
|
||||
# Backup files
|
||||
*.s#?
|
||||
*.b#?
|
||||
*.l#?
|
||||
*.b$?
|
||||
*.s$?
|
||||
*.l$?
|
||||
|
||||
# Eagle project file
|
||||
# It contains a serial number and references to the file structure
|
||||
# on your computer.
|
||||
# comment the following line if you want to have your project file included.
|
||||
eagle.epf
|
||||
|
||||
# Autorouter files
|
||||
*.pro
|
||||
*.job
|
||||
|
||||
# CAM files
|
||||
*.$$$
|
||||
*.cmp
|
||||
*.ly2
|
||||
*.l15
|
||||
*.sol
|
||||
*.plc
|
||||
*.stc
|
||||
*.sts
|
||||
*.crc
|
||||
*.crs
|
||||
|
||||
*.dri
|
||||
*.drl
|
||||
*.gpi
|
||||
*.pls
|
||||
*.ger
|
||||
*.xln
|
||||
|
||||
*.drd
|
||||
*.drd.*
|
||||
|
||||
*.s#*
|
||||
*.b#*
|
||||
|
||||
*.info
|
||||
|
||||
*.eps
|
||||
|
||||
# file locks introduced since 7.x
|
||||
*.lck
|
||||
|
@ -0,0 +1,72 @@
|
||||
import os
|
||||
import sys
|
||||
import cv2
|
||||
import numpy as np
|
||||
import random as rng
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
img = cv2.imread('./image-se.jpg')
|
||||
|
||||
src = img
|
||||
|
||||
img[np.all(img == 255, axis=2)] = 0
|
||||
|
||||
kernel = np.array([[1, 1, 1], [1, -8, 1], [1, 1, 1]], dtype=np.float32)
|
||||
|
||||
Laplacian = cv2.filter2D(img, cv2.CV_32F, kernel)
|
||||
|
||||
imgres = np.float32(img) - Laplacian
|
||||
|
||||
imgres = np.clip(imgres, 0, 255)
|
||||
|
||||
imgres = np.uint8(imgres)
|
||||
|
||||
bw = cv2.cvtColor(imgres, cv2.COLOR_BGR2GRAY)
|
||||
|
||||
_, bw = cv2.threshold(bw, 40, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
|
||||
|
||||
dist = cv2.distanceTransform(bw, cv2.DIST_L2, 3)
|
||||
|
||||
cv2.normalize(dist, dist, 0, 1.0, cv2.NORM_MINMAX)
|
||||
|
||||
_, dist = cv2.threshold(dist, 0.4, 1.0, cv2.THRESH_BINARY)
|
||||
|
||||
kernel1 = np.ones((3, 3), dtype=np.uint8)
|
||||
|
||||
dist = cv2.dilate(dist, kernel1)
|
||||
|
||||
dist_8u = dist.astype('uint8')
|
||||
|
||||
contours, _ = cv2.findContours(dist_8u, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
markers = np.zeros(dist.shape, dtype=np.int32)
|
||||
|
||||
for i in range(len(contours)):
|
||||
cv2.drawContours(markers, contours, i, (i + 1), -1)
|
||||
|
||||
cv2.circle(markers, (5, 5), 3, (255, 255, 255), -1)
|
||||
|
||||
cv2.watershed(imgres, markers)
|
||||
|
||||
mark = markers.astype('uint8')
|
||||
|
||||
colors = []
|
||||
|
||||
for conlour in contours:
|
||||
colors.append((rng.randint(0, 256), rng.randint(0, 256), rng.randint(0, 256)))
|
||||
|
||||
dst = np.zeros((markers.shape[0], markers.shape[1], 3), dtype=np.uint8)
|
||||
|
||||
for i in range(markers.shape[0]):
|
||||
for j in range(markers.shape[1]):
|
||||
index = markers[i, j]
|
||||
if index > 0 and index <= len(contours):
|
||||
dst[i, j, :] = colors[index - 1]
|
||||
|
||||
img = np.hstack([src, dst])
|
||||
|
||||
cv2.imshow('Final Result', img)
|
||||
|
||||
cv2.waitKey(0)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
{
|
||||
"sigma_list": [
|
||||
15,
|
||||
80,
|
||||
200
|
||||
],
|
||||
"G": 5.0,
|
||||
"b": 25.0,
|
||||
"alpha": 125.0,
|
||||
"beta": 46.0,
|
||||
"low_clip": 0.01,
|
||||
"high_clip": 0.99
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import json
|
||||
|
||||
control={"sigma_list": [15, 80, 200],
|
||||
"G" : 5.0,
|
||||
"b" : 25.0,
|
||||
"alpha" : 125.0,
|
||||
"beta" : 46.0,
|
||||
"low_clip" : 0.01,
|
||||
"high_clip" : 0.99
|
||||
}
|
||||
|
||||
json.dump(control,open('config.json','w'),indent=4)
|
||||
|
@ -0,0 +1,11 @@
|
||||
import os
|
||||
def CreateFolder(path):
|
||||
del_path_space = path.strip()
|
||||
del_path_tail = del_path_space.rstrip('\\')
|
||||
is_exists = os.path.exists(del_path_tail)
|
||||
if not is_exists:
|
||||
os.makedirs(del_path_tail)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -0,0 +1 @@
|
||||
Subproject commit 49ebf0e483924c9d9622fba7337657b5b18ceaf7
|
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,31 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
import os
|
||||
import sys
|
||||
import Digital_image_basics
|
||||
import Edge_detection
|
||||
import Image_enhancement
|
||||
import Image_repair
|
||||
import Image_segmentation
|
||||
import recognition_face
|
||||
if __name__ == '__main__':
|
||||
print("选择你要实现的功能")
|
||||
|
||||
print("1.数字图像基础 2.边缘检测 3.图像增强 4.图像修复 5.图像分割 6.人脸识别")
|
||||
|
||||
myinput = input()
|
||||
|
||||
if myinput == '1':
|
||||
Digital_image_basics.main()
|
||||
elif myinput == '2':
|
||||
Edge_detection.main()
|
||||
elif myinput == '3':
|
||||
Image_enhancement.main()
|
||||
elif myinput == '4':
|
||||
Image_repair.main()
|
||||
elif myinput == '5':
|
||||
Image_segmentation.main()
|
||||
elif myinput == '6':
|
||||
recognition_face.main()
|
||||
else:
|
||||
print("wrong input!")
|
Loading…
Reference in new issue