• Stars
    star
    191
  • Rank 201,725 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Virtual camera is created only using opencv and numpy. It simulates a camera where we can control all its parameters, intrinsic and extrinsic to get a better understanding how each component in the camera projection matrix affects the final image of the object captured by the camera.

VirtualCam

Virtual camera is created only using OpenCV and numpy. It simulates a camera where we can control all its parameters intrinsic and extrinsic to get a better understanding how each component in the camera projection matrix affects the final image of the object captured by the camera. It can be used to understand concepts of image formation and to understand the intrinsic and extrinsic camera parameters. An interractive GUI is also provided which simulates a virtual camera and a plane in 3D world. By changing the extrinsic parameters of the camera (rotation and translation) you can simulate how the image being formed changes.

Standard books related to multi-view geometry and computer vision were refered to ensure validty of equations in the code. I also refered this blog from learnopencv.com to understand the geometry of image formation. The opportuinity to sit through the CS763: Computer Vision Spring 2020 course at IIT Bombay also helped me to clear my fundamental concepts related to the geometry of image formation and camera projection matrix.

An interesting application of this library can be seen in FunMirrors project

Link to the post about FunMirrors

Instructions to run the GUI

  1. Install the virtual camera library using the following command
pip3 install vcam
  1. Clone the repositoy git clone https://github.com/kaustubh-sadekar/VirtualCam.git
  2. Run the GUI using the following command python3 GUI.py

Camera Translation

Camera-Translation

When you control the X, Y, Z trackerbars you are basically controlling the position of camera in the 3D world. The plane remains fixed and thus we can observe shifting of the plane as we move the camera. You can also objserve the changes in the last column of the camera projection matrix being prined in the right terminal.

Camera Rotation

Camera-Rotation

When you control the alpha, beta, gamma trackbars you are controlling the rotations of camera in 3D world. This gives turning effect to the image.

Camera Distortion Coefficients

Camera-Rotation

When you control the k and p trackbars you are controlling the distortion coefficients. The computations performed in numpy also take into account the equation for lens distortions for a pin hole camera.

Camera apparent pixel size and focal lenght

Camera-apparent-pixel-size-and-focus

When you control the sx and sy trackbars the apparent pixel size in x and y direction changes. As Sx increases the apparent pixel width increases making the image stretch horizontally and similarly Sy increases the apparent pixel height, making the image stretch vertically.

Basically the plane is a mesh of 3D points. We compute the camera projection matrix and thus the image coordinates corresponding to these 3D points. The projected points and the original mesh points are used to compute a map and finally a remapping function is applied on the image.

python3 GUI.py

Code files

GUI.py is the file for GUI to play with camera parameters.

More Repositories

1

Invisibility_Cloak

This is a fun application of image processing which enables you to experience the magic of an invisibility cloak. Let's make our childhood fantasy of using an invisibility cloak come true.
Python
199
star
2

OmniCV-Lib

A computer vision library for omnidirectional (360 degree) cameras.
C++
124
star
3

FunMirrors

This is a fun project I created to motivate computer vision enthusiasts and to highlight the importance of understanding fundamental concepts related to image formation in a camera.
Python
54
star
4

AIR_Drums

This project enables you to play virtual drums simply by using concepts of image processing and computer vision.
Python
51
star
5

ShadowArt-Revisited

Shadow Art Revisited: A Differentiable Rendering Based Approach
Python
13
star
6

PixoCube

PixoCube is a digital version of photo cubes that people usually gift others. It is basically a 3D cube with different images consisting of different sides of the cube. The interesting part of this project is I used concepts of camera projection and only opencv functions to render the cube. Moreover the camera view point is rendered such that it shifts based on the movement of users face.
Python
9
star
7

Colab-Notebooks

This repository contains tutorials related to python, OpenCV , TensorFlow and PyTorch in form of colab notebooks
Jupyter Notebook
7
star
8

LS-HDIB

LS-HDIB: A Large Scale Handwritten Document Image Binarization Dataset
Python
6
star
9

Cyclops-Visual-Assistant

Cyclops is a spatial AI based visual assistant. It is assembled in a device similar to a VR headset and allows the wearer to ask if any objects matching the speech input are found nearby and provides an active feedback when approaching found objects.
Python
4
star
10

SPAD-Simulator

Physics-based modeling of SPAD sensor measurements.
3
star
11

PyTorch_KinectFusion

Kinect Fusion implementation with GPU acceleration capabilities using PyTorch. Vectorized implementation of the ICP algorithm and TSDF Fusion algorithm to enable GPU aceleration capabilities.
3
star
12

dlutils

This repository contains a small collection of utility functions
Python
2
star
13

Stereo-Cam-Lib

Library for affordable stereo camera.
1
star
14

QuickRef

Use this website as a quick reference
1
star
15

TemplateProjectpage

Test Project Website
1
star
16

kaustubh-sadekar.github.io

HTML
1
star
17

FunCV

This repository contains some useful codes related to different topics of OpenCV
1
star
18

no-more-writers-block

Temp experiment
HTML
1
star
19

DataFolder

This is a repository which contains some images which can be used for learning OpenCV functionalities. Main purpose of this repository is to provide an easy way to play with images with OpenCV using google colab.
1
star
20

githubActions

This repository is used to understand functioning of github actions. The code shared is simply for demo purpose. However the repository contains the complete process of using github actions, CD/CI workflow and pushing a project to pipy automatically using tagged commits.
Python
1
star