Skip to content

Small program that does 2D GR lensing on images captured from camera devices.

License

Notifications You must be signed in to change notification settings

seanpquinn/lenspy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplified 2D GR lensing

This page provides install and usage instructions for a simple outreach lensing application, designed for a break out session of the 2015 TEDxCLE GR Centennial Celebration.

The code makes use of the formalism presented in "Gravitational lensing by cosmic string loops" Andrew A. de Laix and Tanmay Vachaspati, Phys. Rev. D 54, 4780, 1996, http://dx.doi.org/10.1103/PhysRevD.54.4780 to lens a 2D pixel array generated by a consumer camera.

The code is a single Python2 script which uses the OpenCV library to recognize faces combined with NumPy for array computations.

It was developed on Linux Machines running Ubuntu 14 LTS as well as Ubuntu 15. Install instructions assume you are running on the same environment. Unfortunately other platforms aren't currently supported. However, if your system has Python2 and the OpenCV library, chances are good the script will work for you too.

If successfully installed, you'll be able to use your camera to generate real time lensed video, such as the example provided below

Hardware

  • 1080p television
  • Small desktop machine
    • 1 GHz dual core processor
    • 2 GB system memory
    • 80 GB hard disk
    • Ethernet network adapter
    • Preferably HDMI video output. VGA seems to work OK
    • USB camera

Dependencies

We rely on the OpenCV Python2 wrapper. This is unfortunately not maintained on PyPI or I would have attempted to make this program into its own PyPI package.

Fortunately on Ubuntu someone has graciously decided to maintain the OpenCV Python2 wrapper. Install using

sudo apt-get install python-opencv

We also need NumPy which can be installed using

sudo apt-get install python-numpy

Once these are installed you should be good to go.

Running the script

The current build includes a feature to save lensed images every 1 minute and 10 seconds. Please provide the absolute path to your desired location by modifying the imgdir variable on line 8 in lens.py

When that's complete run the script using

python lens.py

Since it's a very basic program, to quit just use Ctrl-C

Conclusions

Thanks for stopping by and let us know if you have any questions or ideas for improvements. Our information is in the AUTHORS file

About

Small program that does 2D GR lensing on images captured from camera devices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published