What it does

Instantly copy any physical key from just its picture! Upload a 3-second video burst of the key to our webapp, and receive a 3D-printable CAD file in return.

How we built it

The core logic (https://github.com/copykey/copykey) consists of three stages: (1) video_to_frame, (2) frame_to_boundary, (3) boundary_to_stl. The first de-warps and straightens the bounding box around the key, and uses a heuristic to select the least blurry frame from the video burst. Once we have this frame, the second step locates the extent of the key within the image. The final step takes the “outline” of that key and extrudes it into three dimensions, depending upon whether it is Masterlock, Schlage, or Kwikset. The output file is OpenSCAD but can be easily be converted to STL for use with common 3D printers.

This core logic is wrapped by a lightweight server (https://github.com/copykey/server). The two parts are modular, and remain separate from one another.

Challenges we ran into

We found that image detection involving contours is hard to do in a general manner. Many of the solutions we came up with only worked well with some of the inputs. This was compounded by the fact that the OpenCV documentation could have been written more comprehensively.

Additionally, after 3D printing, some keys were too brittle to be used in real locks. We had to readjust our blank CAD files to overcome this.

Accomplishments that we're proud of, and what we learned

We were initially unsure if we would be able to accomplish our full goal within a 24-hour period, so we were especially excited when the program did succeed in unlocking several distinct locks. We learned how to debug a complex project with many moving parts, as well as several details of OpenCV.

Share this project: