This commit is contained in:
王庆刚
2024-09-02 11:50:08 +08:00
parent 5109400a57
commit 0cc36ba920
34 changed files with 1401 additions and 275 deletions

View File

@ -0,0 +1,6 @@
5幅图
incart.png
outcart.png
incart_ftmp.png
outcart_ftmp.png
cartboarder.png

View File

@ -36,10 +36,10 @@ def temp_add_boarder():
def create_front_temp():
image = cv2.imread("image_front.png")
image = cv2.imread("./iCart4/b.png")
Height, Width = image.shape[:2]
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh, binary = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY_INV)
thresh, binary = cv2.threshold(gray, 128, 255, cv2.THRESH_BINARY_INV)
board = cv2.bitwise_not(binary)
contours, _ = cv2.findContours(board, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
@ -48,12 +48,12 @@ def create_front_temp():
img = np.zeros((Height, Width), dtype=np.uint8)
cv2.drawContours(img, [cnt], -1, 255, 3)
k += 1
cv2.imwrite(f"fronttemp_{k}.png", img)
cv2.imwrite(f"./iCart4/back{k}.png", img)
imgshow = cv2.drawContours(image, contours, -1, (0,255,0), 3)
cv2.imwrite("board_ftmp_line.png", imgshow)
cv2.imwrite("./iCart4/board_back_line.png", imgshow)
# cv2.imwrite("4.png", board)
# cv2.imwrite("./iCart4/4.png", board)
# cv2.imwrite("1.png", gray)
# cv2.imwrite("2.png", binary)

Binary file not shown.