Ejemplo n.º 1
0
def selectFileToOpen():
    user_selected_image = filedialog.askopenfilename(initialdir="./images", title='FaceDraw: Open File')
    # Opening the image
    path, file_name = os.path.split(user_selected_image)
    cvimage = process_image.openImage(file_name)
    #cvimage = cv.cvtColor(cvimage, cv.COLOR_BGR2RGB)
    updateWindowImages(cvimage, user_selected_image)
Ejemplo n.º 2
0
def loadBlank():
    print("loading blank")
    blank_image = process_image.openImage("BlueSquare.png")
    blank_image = convertImageToTk(blank_image, True, 300, 300)
    blank_image_text = tkinter.StringVar()
    blank_image_text.set("Please Choose An Image")
    blank_image_label = tkinter.Label(image_frame, textvariable=blank_image_text, anchor='center')
    blank_image_label.grid(row=0, column=0)
    blank_image_frame = tkinter.Label(image_frame, image=blank_image, anchor='center')
    blank_image_frame.image = blank_image
    image_frame.image = blank_image
    image_frame2.image = blank_image
    blank_image_frame.grid(row=1, column=0)
Ejemplo n.º 3
0
# Your filename here
filename = 'dock.jpeg'

# Printer configuration
bed_height = 220
bed_width = 280
bed_size = [bed_height, bed_width]  # The size of your printer bed
feedrate = 750
# The feedrate of your x-y moves

z_hop = 3.0  # The total Z-hop between each dot (mm)
z_tune = 0.0  # Tune the Z-axis

# Take the picture
# takepicture.take_picture(filename) # Uncomment this if you want to take a picture

# open the image
cv_image = process_image.openImage(filename)

facedraw_image = FaceDrawImage.FaceDrawImage(cv_image, bed_size, line_width=1)

raster = Raster.Raster(facedraw_image.final_image)

points = raster.raster()

Writer.points_moves_to_gcode(filename,
                             points,
                             feedrate,
                             z_hop=z_hop,
                             z_tune=z_tune)
Ejemplo n.º 4
0
    if resize:
        resized_image = pil_image.resize((width, height), Image.ANTIALIAS)
        tk_image = ImageTk.PhotoImage(resized_image)
    else:
        tk_image = ImageTk.PhotoImage(pil_image)
    return tk_image


# Image Elements
image_frame = tkinter.Frame(root)
image_frame.grid(row=1, column=0, sticky='W')
o_image_text = tkinter.StringVar()
o_image_text.set("Please Select An Image")
original_image_label_text = tkinter.Label(image_frame, textvariable=o_image_text, anchor='center')
original_image_label_text.grid(row=0, sticky='N')
blank_image = convertImageToTk(process_image.openImage("BlueSquare.png"), True, 300, 300)
original_image_label = tkinter.Label(image_frame, image=blank_image, anchor='center')
original_image_label.image = blank_image
original_image_label.grid(row=1, column=0)

image_frame2 = tkinter.Frame(root)
image_frame2.grid(row=2, column=0, sticky='W')
p_image_text = tkinter.StringVar()
p_image_text.set("")
processed_image_label_text = tkinter.Label(image_frame2, textvariable=p_image_text, anchor='center')
processed_image_label_text.grid(row=0, sticky='N')
processed_image_label = tkinter.Label(image_frame2, image=blank_image, anchor='center')
processed_image_label.image = blank_image
processed_image_label.grid(row=1, sticky='N')

# Options frame
Ejemplo n.º 5
0
# Input: max_height: The maximum height to move in
# Input: z_hop: The height to hop in between draw moves
# Input: lines: An array of lines to be drawn
# Output: None
def linetogcode(file, max_width, max_height, image_width, image_height, z_hop,
                lines):
    # Assumptions: All the points are in order representing a path

    # Iterate through all the lines to draw
    for line in lines:

        # Iterate through all the points in the line
        for point in line:
            # Point = (height, width)
            x = point[0]
            y = point[1]


# Loading test images
test_image = process_image.openImage('slicer_test_1.png')  # A real test image
black_image = np.zeros((test_image.shape[0], test_image.shape[1]),
                       dtype=np.uint8)  # A black test image
blank_image = np.ones((test_image.shape[0], test_image.shape[1]),
                      dtype=np.uint8) * 255  # A white test image

# Select which image to run
run_image = test_image

# Run the line-pathing algorithm
# print(str(readlines(run_image)))