Bioprinting
This was an interesting week! For full details, please see wiki page.
Jack and I worked together throughout this week. Jack knows a lot more about materials and specifically bio-materials, so I was helping him along with whatever he needed. Also, I characterized the printer and printed the lattices, smileys and shape Jack wanted to later transform. I also meddled with Python and OpenCV to capture high-res videos of the extrusion. Here is the code:
import cv2
import numpy as np
from PIL import Image
cv2.namedWindow('raw', cv2.WINDOW_NORMAL)
cv2.resizeWindow('raw', 768, 1024)
cv2.namedWindow('diff', cv2.WINDOW_NORMAL)
cv2.resizeWindow('diff', 768, 1024)
capture = cv2.VideoCapture(1)
print("Hit r to record video, q to quit.")
ret, prev_frame = capture.read()
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out_raw = cv2.VideoWriter('raw.avi',fourcc, 20.0, (prev_frame.shape[1],prev_frame.shape[0]))
print("Dim: ", prev_frame.shape)
record = False
while True:
ret, frame = capture.read()
cv2.imshow("raw", frame)
diff = cv2.absdiff(frame,prev_frame)
diff = cv2.blur(diff,(5, 5))
gray = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(gray, 15 ,255, cv2.THRESH_BINARY_INV)
if record:
out_raw.write(frame)
prev_frame = frame
cv2.imshow("diff", thresh)
pressed = cv2.waitKey(1)
if pressed & 0xFF == ord('q'):
break
elif pressed & 0xFF == ord('r'):
record = not record
print("Recording: ", record)
capture.release()
cv2.destroyAllWindows()