Skip to content
Snippets Groups Projects
Commit 1a27c4c1 authored by dakotagoldberg's avatar dakotagoldberg
Browse files

Add image to stroke to vector (points) script

parent 0e0766c3
Branches
No related tags found
No related merge requests found
Showing with 55 additions and 1 deletion
.idea
output
output2
stroke
vec
File added
File added
File added
import cv2
import numpy as np
import os
def bf(image_path, output_path):
image = cv2.imread(image_path)
filtered = cv2.bilateralFilter(image, d=9, sigmaColor=75, sigmaSpace=75)
gray = cv2.cvtColor(filtered, cv2.COLOR_BGR2GRAY)
edges = cv2.adaptiveThreshold(
gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, blockSize=9, C=4)
# inverted_edges = cv2.bitwise_not(edges)
post_filtered = cv2.bilateralFilter(
edges, d=9, sigmaColor=75, sigmaSpace=75)
# Save the result
cv2.imwrite(output_path, post_filtered)
# for filename in os.listdir('/Users/dakotagoldberg/cba/raspi_drawing_machine/code/img/input-resized'):
# filepath = os.path.join(
# '/Users/dakotagoldberg/cba/raspi_drawing_machine/code/img/input-resized', filename)
# # Check if it is a file
# if os.path.isfile(filepath):
# print(filename)
# # name = "polite_cat.png"
# bf(f'/Users/dakotagoldberg/cba/raspi_drawing_machine/code/img/input-resized/{filename}',
# f'/Users/dakotagoldberg/cba/raspi_drawing_machine/code/output2/{filename}')
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment