forked from facebookarchive/Surround360
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fbshipit-source-id: 8d0501007f5d85ee9d45ecbf338743b9c854b686
- Loading branch information
FBShipIt
committed
Jul 26, 2016
0 parents
commit 23f2ee3
Showing
132 changed files
with
534,815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Surround360 System | ||
|
||
Surround360 is a hardware and software system for capturing and rendering 3d (stereo) 360 videos and photos, suitable for viewing in VR. We divide the open source components of the system into three subdirectories: | ||
|
||
* /surround360_design -- hardware designs and assembly instructions | ||
* /surround360_camera_ctl -- software for controlling the camera to capture raw data | ||
* /surround360_render -- software for rendering the raw data that is captured into a format suitable for viewing in VR. | ||
|
||
## Join the Surround360 community | ||
|
||
* Website: https://facebook360.fb.com/facebook-surround-360/ | ||
|
||
See the CONTRIBUTING file in each subdirectory for how to help out. | ||
|
||
## License | ||
|
||
The hardware designs, camera control software, and rendering software are subject to different licenses. Please refer to the LICENSE file in each subdirectory. We also provide an additional patent grant. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Makefile | ||
bin/ | ||
lib/ | ||
CMakeFiles/ | ||
CMakeCache.txt | ||
cmake_install.cmake | ||
local/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax: regexp | ||
^Makefile | ||
^bin/.*$ | ||
^lib/.*$ | ||
.*\.pyc$ | ||
.*\.pyo$ | ||
CMakeFiles/.*$ | ||
^CMakeCache\.txt | ||
^cmake_install\.cmake | ||
^local/.*$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(Surround360CameraCtl CXX) | ||
include_directories(/usr/include/flycapture) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source/camera_control) | ||
|
||
IF( NOT DEFINED CMAKE_BUILD_TYPE ) | ||
SET( ${CMAKE_BUILD_TYPE} Release ... FORCE ) | ||
ENDIF() | ||
|
||
SET( PLATFORM_SPECIFIC_LIBS "-lpthread -lgflags") | ||
|
||
IF ( NOT ${CMAKE_BUILD_TYPE} MATCHES Debug ) | ||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Ofast" ) | ||
ENDIF () | ||
|
||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-write-strings" ) | ||
|
||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
### Add custom targets to show all source and header files in IDEs ### | ||
|
||
file( GLOB SRC "${CMAKE_CURRENT_SOURCE_DIR}/source/*" ) | ||
add_custom_target( _source SOURCES ${SRC} ) | ||
|
||
### CameraControl ### | ||
|
||
add_executable( | ||
CameraControl | ||
source/camera_control/PointGrey.cpp | ||
source/camera_control/CameraControl.cpp | ||
) | ||
|
||
target_compile_features(CameraControl PRIVATE cxx_range_for) | ||
target_link_libraries( | ||
CameraControl | ||
"-lflycapture${D}" | ||
"-lusb-1.0" | ||
"-lpthread" | ||
"-lgflags" | ||
"-lswscale" | ||
"-lavutil" | ||
"-lavcodec" | ||
"-lavformat" | ||
"-lavfilter" | ||
${PLATFORM_SPECIFIC_LIBS} | ||
) | ||
|
||
### Producer consumer test ### | ||
add_executable( | ||
pc_test | ||
source/camera_control/pc_test.cpp | ||
) | ||
|
||
target_link_libraries( | ||
pc_test | ||
${PLATFORM_SPECIFIC_LIBS} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributing to Surround 360 | ||
|
||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Our Development Process | ||
|
||
We maintain a repository for Surround 360 using Facebook's internal infrastructure, which is automatically synched with GitHub. | ||
|
||
## Pull Requests | ||
|
||
We actively welcome your pull requests. | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
|
||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Issues | ||
|
||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe | ||
disclosure of security bugs. In those cases, please go through the process | ||
outlined on that page and do not file a public issue. | ||
|
||
## Coding Style | ||
|
||
* 2 spaces for indentation rather than tabs | ||
* 80 character line length (with discretion in cases where it makes code less readable). | ||
* TODO | ||
|
||
## License | ||
|
||
The Surround 360 camera control code is licensed as described in LICENSE_camera_ctl.md under /surround360_camera_ctl. We also provide an additional patent grant. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
LICENSE AGREEMENT | ||
|
||
For Surround 360 Camera Control software | ||
|
||
Copyright (c) 2016-present, Facebook, Inc. All rights reserved. | ||
|
||
Facebook, Inc. ("Facebook") owns all right, title and interest, including all | ||
intellectual property and other proprietary rights, in and to the Nuclide | ||
software (the "Software"). Subject to your compliance with these terms, you are | ||
hereby granted a non-exclusive, worldwide, royalty-free copyright license to | ||
(1) use and copy the Software; and (2) reproduce and distribute the Software as part | ||
of your own software ("Your Software"), provided Your Software does not consist | ||
solely of the Software; and (3) modify the Software for your own internal use. | ||
Facebook reserves all rights not expressly granted to you in this license agreement. | ||
|
||
THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS OR | ||
IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. | ||
IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR EMPLOYEES | ||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Surround 360 Camera Control Software | ||
|
||
This part of the Surround 360 software controls the hardware (cameras) and captures the data they collect to a local file storage system (e.g., a RAID of SSD drives). | ||
|
||
## Requirements | ||
|
||
* The Surround 360 camera control software requires Ubuntu Linux 14.04 64-bit (required by the PointGrey camera SDK) | ||
|
||
* The essential dependencies of the Surround 360 camera control software are: | ||
* FlyCapture SDK (from PointGrey), and its prereqs: | ||
* libraw1394-11 | ||
* libgtkmm-2.4-1c2a | ||
* libglademm-2.4-1c2a | ||
* libgtkglextmm-x11-1.2-dev | ||
* libgtkglextmm-x11-1.2 | ||
* libusb-1.0-0 | ||
* libglademm-2.4-dev | ||
* CMake | ||
* gflags | ||
* OpenCV 3.0+ | ||
* ffmpeg | ||
|
||
## Installing Dependencies of the Surround 360 Camera Control Software | ||
|
||
* Download Point Grey FlyCapture SDK and Grasshopper 3 USB 3.0 (GS3-U3-41C6C-C) Firmware: | ||
* Go to https://www.ptgrey.com/support/downloads | ||
* You will need to register (free) to download software | ||
* Product Families: Grasshopper3 | ||
* Camera Models: GS3-U3-41C6C-C | ||
* Operating Systems: Linux Ubuntu 14.04 | ||
* Software -> download latest FlyCapture SDK - Linux Ubuntu (64-bit) | ||
* (optional, see below) Firmware -> download GS3-U3-41C6 Firmware 2.23.3.0 | ||
|
||
* Install FlyCapture SDK (method 1): | ||
Uncompress SDK file and follow instructions from README file | ||
|
||
* Install FlyCapture SDK (method 2): | ||
* Install FlyCapture SDK dependencies: | ||
<pre> | ||
sudo apt-get install libraw1394-11 libgtkmm-2.4-1c2a libglademm-2.4-1c2a libgtkglextmm-x11-1.2-dev libgtkglextmm-x11-1.2 libusb-1.0-0 libglademm-2.4-dev | ||
</pre> | ||
|
||
* Open /etc/modules and append | ||
<pre> | ||
raw1394 | ||
</pre> | ||
|
||
* Install FlyCapture2 deb files using the script provided: | ||
<pre> | ||
chmod +x install_flycapture.sh | ||
sudo sh install_flycapture.sh | ||
</pre> | ||
|
||
* By default, Linux limits image capture to 2 MB. To capture images over 2 MB, | ||
extend the USBFS limit on how many buffers can be locked into the driver. | ||
This is done by updating the boot params in grub | ||
|
||
Open /etc/default/grub, and find and replace: | ||
<pre> | ||
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" | ||
</pre> | ||
with | ||
<pre> | ||
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.usbfs_memory_mb=2000" | ||
</pre> | ||
Then update grub: | ||
<pre> | ||
sudo update-grub | ||
</pre> | ||
|
||
* Install Grasshopper 3 USB 3.0 (GS3-U3-41C6C-C) Firmware (optional): | ||
Cameras should come with latest firmware installed, but you can follow these | ||
steps to upgrade it | ||
WARNING: This can only be done in Windows, so you would need to download and | ||
install the Windows version of FlyCapture SDK (see steps above) | ||
* Open UpdatorGUI: | ||
Located under Point Grey FlyCapture2 SDK -> Utilities -> UpdatorGUI3 | ||
* Select the camera(s) to update, point to the uncompressed .ez2 file and select "Update" | ||
* A power cycle of the cameras should not be required, as they are automatically rebooted after firmware update | ||
|
||
* Install CMake (method 2 - Linux only) | ||
<pre> | ||
sudo apt-get install software-properties-common | ||
sudo add-apt-repository ppa:george-edison55/cmake-3.x | ||
sudo apt-get update | ||
sudo apt-get install cmake && sudo apt-get upgrade cmake | ||
</pre> | ||
|
||
* Install gflags: | ||
<pre> | ||
sudo apt-get install libgflags2 libgflags-dev | ||
</pre> | ||
|
||
* Install ffmpeg: | ||
see https://trac.ffmpeg.org/wiki/CompilationGuide | ||
|
||
## Compiling the Surround 360 Camera Control Software | ||
|
||
After installing all of the dependencies as described above, run: | ||
<pre> | ||
cd <install path>/surround360/surround360_camera_ctl | ||
cmake -DCMAKE_BUILD_TYPE=Release | ||
make | ||
</pre> | ||
|
||
To test that compilation is successful, run: | ||
|
||
<pre> | ||
./bin/CameraControl -numcams 17 -raw -nbits 8 -shutter 20 -gain 0 -debug | ||
</pre> | ||
|
||
We recommend configuring CMake to compile in Release mode because the code will execute faster. However, you can also set it up for debug mode with: | ||
<pre> | ||
cmake -DCMAKE_BUILD_TYPE=Debug | ||
</pre> | ||
|
||
## Join the Surround 360 community | ||
|
||
* Website: https://facebook360.fb.com/facebook-surround-360/ | ||
|
||
See the CONTRIBUTING file for how to help out. | ||
|
||
## License | ||
|
||
The Surround 360 camera control code is licensed as described in LICENSE_camera_ctl.md under /surround360_camera_ctl. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
HTTPPort 8090 | ||
HTTPBindAddress 0.0.0.0 | ||
MaxHTTPConnections 50 | ||
MaxClients 50 | ||
MaxBandwidth 4000 | ||
CustomLog - | ||
|
||
<Stream stat.html> | ||
Format status | ||
ACL allow localhost | ||
</Stream> | ||
|
||
<Feed preview.ffm> | ||
File /tmp/preview.ffm | ||
FileMaxSize 1G | ||
ACL allow 127.0.0.1 | ||
</Feed> | ||
|
||
<Stream live.webm> | ||
NoAudio | ||
Feed preview.ffm | ||
Format webm | ||
VideoCodec libvpx-vp9 | ||
VideoSize 512x512 | ||
VideoFrameRate 1/30 | ||
AVOptionVideo flags +global_header | ||
AVOptionVideo cpu-used 0 | ||
AVOptionVideo qmin 10 | ||
AVOptionVideo qmax 42 | ||
AVOptionVideo quality realtime | ||
PreRoll 3 | ||
StartSendOnKey | ||
VideoBitRate 3000 | ||
</Stream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
mount -o noatime /dev/sda /media/snoraid | ||
echo noop > /sys/block/sda/queue/scheduler | ||
echo 0 > /sys/block/sda/queue/rotational | ||
echo 1024 > /sys/block/sda/queue/nr_requests | ||
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do [ -f $CPUFREQ ] || continue; echo -n performance > $CPUFREQ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
if [[ $EUID != 0 ]] ; then | ||
echo This must be run as root! | ||
exit 1 | ||
fi | ||
|
||
counter=0 | ||
|
||
for id in $(lspci | grep Renesas | cut -f 1 -d " ") | ||
do | ||
echo "Resetting $id..." | ||
echo -n 0000:$id > /sys/bus/pci/drivers/xhci_hcd/unbind | ||
echo -n 0000:$id > /sys/bus/pci/drivers/xhci_hcd/bind | ||
counter=$((counter+1)) | ||
done | ||
|
||
echo "$counter USB controllers have been reset!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2016-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE_camera_ctl file in the root directory of this subproject. | ||
*/ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <memory> | ||
#include <string> | ||
|
||
namespace surround360 { | ||
class Camera { | ||
public: | ||
virtual ~Camera() {} | ||
virtual int attach() = 0; | ||
virtual int detach() = 0; | ||
virtual int init(bool isMaster) = 0; | ||
virtual int startCapture() = 0; | ||
virtual int stopCapture() = 0; | ||
virtual void* getFrame() = 0; | ||
virtual unsigned int getDroppedFramesCounter() const = 0; | ||
virtual int powerCamera(bool onOff) = 0; | ||
|
||
protected: | ||
Camera() {} | ||
Camera(const Camera& c) = delete; | ||
}; | ||
} |
Oops, something went wrong.