# Ricoh Library Build ## Useful Links * https://github.com/maldworth/gphoto2pp * http://maldworth.github.io/gphoto2pp/index.html * https://fossies.org/linux/libgphoto2/examples/sample-capture.c * https://codetricity.github.io/theta-linux/software/ ## We require gphoto2 lib and its wrapper. ### install gphoto2 library * remove previous libgphoto versions ```! sudo apt-get remove gphoto2 libgphoto2-6 libgphoto2-dev libgphoto2-l10n libgphoto2-port12 ``` * install libgphoto2 (oneline) **source**: https://github.com/gonzalo/gphoto2-updater ```! wget https://raw.githubusercontent.com/gonzalo/gphoto2-updater/master/gphoto2-updater.sh && wget https://raw.githubusercontent.com/gonzalo/gphoto2-updater/master/.env && chmod +x gphoto2-updater.sh && sudo ./gphoto2-updater.sh ``` ### install gphoto2pp wrapper * Clone the gphoto2pp wrapper **source**: https://github.com/maldworth/gphoto2pp ```! git clone https://github.com/maldworth/gphoto2pp.git ``` ##### **refer**: Readme of the repo. * run the following command in the directory. ```! cd gphoto2pp ./cmake_release.sh ``` * run the following command in **build/release** directory. ```! cd build/release make make examples sudo make install sudo ldconfig ``` ## This concludes the installation of library and wrapper. ### Test the functionality: * create a source file: ```! touch testgphoto2pp.cpp ``` * add the following code into the **testgphoto2pp.cpp** file. ``` #include <gphoto2pp/camera_wrapper.hpp> // Header for CameraWrapper #include <gphoto2pp/camera_file_wrapper.hpp> // Header for CameraFileWrapper #include <gphoto2pp/helper_camera_wrapper.hpp> // Used for helper::capture(...) method #include <iostream> int main() { // Connects to the first camera found and initializes gphoto2pp::CameraWrapper camera; // Prints out the summary of your camera's abilities std::cout << camera.getSummary() << std::endl; // Creates empty instance of a cameraFile, which will be populated in our helper method gphoto2pp::CameraFileWrapper cameraFile; // Takes a picture with the camera and does all of the behind the scenes fetching gphoto2pp::helper::capture(camera, cameraFile); // Lastly saves the picture to your hard drive // Your camera might take files in different formats (bmp, raw) // so this extension might be wrong and you should rename your file appropriately cameraFile.save("my-gphoto2pp-test.jpg"); return 1; } ``` * run the following command. ```! g++ -std=c++11 testgphoto2pp.cpp -lgphoto2pp -lgphoto2 ``` ### connect the camera. ### Before executing the file, make sure the camera storage is unmounted from file system. * run the command: ```! ./a.out ```