Introduction to 3D Vision

Introduction to 3D Vision

Deep Convolutional Neural Networks have largely dominated many Computer Vision(CV) tasks in the past decade. We will focus on a more ‘old-school’ aspect of Computer Vision: 3D Vision. I am sure 3D vision is something we encounter in our everyday lives — I mean, our eyes basically function using this principle. This post aims to introduce some of the basic concepts behind it!

Find the focal length (in pixels) of your smartphone

In the world of Computer Vision(CV), there are many interesting concepts. Deep Convolutional Neural Networks have largely dominated many CV tasks in the past decade. CNNs are able to perform better than humans at things like image classification, object detection and image segmentation in certain domains. The best advantage of CNNs are that they can run at scale, hence putting much of the image data collected by individuals and corporations to good use! Recently, Transformers are also being explored for CV tasks. However, in this post, we will focus on a more ‘old-school’ aspect of Computer Vision: 3D Vision. I am sure 3D vision is something we encounter in our everyday lives — I mean, our eyes basically function using this principle. This post aims to introduce some of the basic concepts behind it!

Image for post

Photo by Nathan Dumlao on Unsplash

One of the key functions of 3D vision is to capture depth information. With a single camera, we only have 2D information about a particular scene, therefore 2 cameras are needed at minimum! (E.g. our eyes!). In this series, I will demonstrate how to do 3 simple tasks that can be done with your smartphone camera:

  • Find the Focal Length of your smartphone camera
  • Recover the depth of an object using 2 photos
  • Find the angle of rotation of your camera when taking 2 pictures of the same scene from the same spot.

Finding focal length

The focal length of a camera is illustrated in the figure below. This is a simplified of the inner workings of cameras and lenses. We can easily see that the focal length can be found by measuring the real height, real distance and image height of an object. These quantities are related by the formula:

Image for post

Image for post

If you remember your high school physics lessons, this probably looks familiar. Now, we will go further than theory, and try to find out the focal length of our smartphones! You can follow the steps and try it out yourself.

  1. Find an object with a known height, H. Use your friends/family or you can just use 2 points on a wall and measure the distance.

  2. Take a photo from a certain distance, *D *away from the object.

    Image for post

Photo of my bedroom with 2 beautifully drawn crosses on the wall.

3. Measure the image height, *h *of the object. You can use any common image editing tool or image viewer, I did it in Microsoft Paint. By hovering over the crosses with a brush tool, we can get the image coordinates shown in the bottom left of the image below.

Image for post

4. Calculate the image height from the two points using Pythagoras’ theorem. For my photo, the points were (1849,291), (1782,2954), and the calculated height was 2664 pixels.

5. Calculate f using the equation from above! Make sure that the units of H and D are the same (I used meters like most of the world).

6. I got a focal length of 3566 pixels, using a OnePlus 6T smartphone. Do share your results and phone model by commenting below!

computer-vision opencv deep-learning data-science developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Applications Of Data Science On 3D Imagery Data

The agenda of the talk included an introduction to 3D data, its applications and case studies, 3D data alignment and more.

Why you should learn Computer Vision and how you can get started

A few compelling reasons for you to starting learning Computer. In today’s world, Computer Vision technologies are everywhere.

Deep Learning — not only for the big ones

How you can use Deep Learning even for small datasets. When you’re working on Deep Learning algorithms you almost always require a large volume of data to train your model on.

How to auto rotate the image using Deep learning!!!

5 simple steps to auto rotate the image to get the right angle in the human photos using computer vision. The above image showed the input (left) and output (right).

50 Data Science Jobs That Opened Just Last Week

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.