Git Product home page Git Product logo

vision's Introduction

deprecated, see my learning repo

On Images, Spring 2019

For assignment 2, we had to use mylar to recreate a 3D image by taping the mylar to a window and drawing the contour.

I found this incredibly difficult, as it required me to close an eye and stay in the exact same position.

For every new line I added, I had to check roughly half of the lines already on the mylar to make sure that I was still in the correct position.

This algorithm is O(n^2) because for each new line added, a linear proportion of existing lines must be checked.

The algorithm to draw with aligned perspectives has a constant time insert because no other lines need to be referred to, therefore O(n) time.

After about an hour, it became obvious that I needed a better solution.

OpenCV is a python package that allows for image transformations and uses numpy for data/array management.

These are some basic functions that I used to produce images that helped me finish the assignment:

  • cv2.cvtColor(img, cv2.COLOR_RGB2GRAY): given an image img, this function call will return the grayscaled image.
  • cv2.GaussianBlur(img, (n, n {where n % 2 != 0}), 0): Given img and blur size, GaussianBlur will remove some of the more irrelevant edges.
  • cv2.Canny(img, n, m): Canny is the edge detection function, and (n, m) are
    • click here for more details on the math of edge detection.

edges.py given 'cvtest.jpg', grayscales, blurs, and does edge detection (in that order) and writes the new image and a smaller, resized version to the repository root.

edges.py output

Now that I had the edges, all I needed to do was overlay the image and my mylar and trace.

Using OBS, and a camera hung from above, I was able to use the filter effects in OBS to add the image and the edges as overlay to the mylar.

Now that both the mylar and the image were in the same 2D plane, I could simply watch the stream and trace.

Using different combinations of the image mask/blend settings:

  • Edges and mylar
  • Edges and mylar
  • Photo and mylar
  • Photo and mylar
  • Edges, photo, and mylar
  • Edges, photo, and mylar

Final Drawing

Final Drawing

vision's People

Contributors

anandijain avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.