<commit_before>###Prerequisites###
First make sure you have cmake and git installed:

    sudo apt-get install cmake git

You might also need gcc/g++ in case it's not already installed, along with some other libraries:

    sudo apt-get install gcc g++ libx11-dev libxt-dev libxext-dev libgraphicsmagick1-dev libcv-dev libhighgui-dev


You need the raspberry pi userland libraries:

    mkdir -p ~/git/raspberrypi
    cd ~/git/raspberrypi
    git clone https://github.com/raspberrypi/userland.git
    cd userland
    ./buildme
    

### Build the raspicam library ###

    mkdir -p ~/git
    cd ~/git
    git clone https://github.com/robidouille/robidouille.git
    cd robidouille/raspicam_cv
    mkdir objs
    make

This will create:

- **libraspicamcv.a**: The raspberry cam library which provides an opencv like interface
- **raspicamtest**: A small test app which uses the library
 
### Use it in your own project ###

Add the include path

    -I$(HOME)/git/robidouille/raspicam_cv
Link with the raspicamcv library

    -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcv
Link with the userland libraries: 

    -L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -l mmal_util -lvcos -lbcm_host

In your code add **#include "RaspiCamCV.h"** and replace:

- cvCreateCameraCapture -> raspiCamCvCreateCameraCapture
- cvQueryFrame -> raspiCamCvQueryFrame
- CvCapture -> RaspiCamCvCapture
 
### Credits ###
RaspiCamCV.c/h is the library source.

It's converted from camcv_vid0.c from [<NAME>](https://thinkrpi.wordpress.com/2013/05/22/opencv-and-camera-board-csi/ "<NAME>").

### More info ###
- [http://www.robidouille.com](http://www.robidouille.com)
- [https://www.google.com/+Robidouille](https://www.google.com/+Robidouille)


### Troubleshooting ###
#### No rule to make target `objs/RaspiCamControl.o' ####
If your userland library is in another directory than as specified above, you need to update the USERLAND_ROOT variable in the Makefile.

#### RaspiCamCV.c:38:16: fatal error: cv.h: No such file or directory  
You didn't apt-get the suggested libraries at the top of this file

#### (RaspiCamTest:14072): Gtk-WARNING **: cannot open display ####
You need to run raspicamtest within an X server. Type startx first, open a terminal window, and launch raspicamtest from there.<commit_msg>add note about PSU which affected me<commit_after>###Prerequisites###
First make sure you have cmake and git installed:

    sudo apt-get install cmake git

You might also need gcc/g++ in case it's not already installed, along with some other libraries:

    sudo apt-get install gcc g++ libx11-dev libxt-dev libxext-dev libgraphicsmagick1-dev libcv-dev libhighgui-dev


You need the raspberry pi userland libraries:

    mkdir -p ~/git/raspberrypi
    cd ~/git/raspberrypi
    git clone https://github.com/raspberrypi/userland.git
    cd userland
    ./buildme
    

### Build the raspicam library ###

    mkdir -p ~/git
    cd ~/git
    git clone https://github.com/robidouille/robidouille.git
    cd robidouille/raspicam_cv
    mkdir objs
    make

This will create:

- **libraspicamcv.a**: The raspberry cam library which provides an opencv like interface
- **raspicamtest**: A small test app which uses the library
 
### Use it in your own project ###

Add the include path

    -I$(HOME)/git/robidouille/raspicam_cv
Link with the raspicamcv library

    -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcv
Link with the userland libraries: 

    -L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -l mmal_util -lvcos -lbcm_host

In your code add **#include "RaspiCamCV.h"** and replace:

- cvCreateCameraCapture -> raspiCamCvCreateCameraCapture
- cvQueryFrame -> raspiCamCvQueryFrame
- CvCapture -> RaspiCamCvCapture
 
### Credits ###
RaspiCamCV.c/h is the library source.

It's converted from camcv_vid0.c from [<NAME>](https://thinkrpi.wordpress.com/2013/05/22/opencv-and-camera-board-csi/ "<NAME>").

### More info ###
- [http://www.robidouille.com](http://www.robidouille.com)
- [https://www.google.com/+Robidouille](https://www.google.com/+Robidouille)


### Troubleshooting ###
#### No rule to make target `objs/RaspiCamControl.o' ####
If your userland library is in another directory than as specified above, you need to update the USERLAND_ROOT variable in the Makefile.

#### RaspiCamCV.c:38:16: fatal error: cv.h: No such file or directory  
You didn't apt-get the suggested libraries at the top of this file

#### (RaspiCamTest:14072): Gtk-WARNING **: cannot open display ####
You need to run raspicamtest within an X server. Type startx first, open a terminal window, and launch raspicamtest from there.

#### raspicamtest causes the entire raspberry pi to crash ####
Your pi power supply may not be up to the task. Capturing images in a loop makes the pi work hard.
{'fraction_non_alphanumeric': 0.10981697171381032, 'fraction_numerical': 0.008735440931780365, 'mean_word_length': 3.9121552604698673, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 10, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7209917', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1579, 'n_words': 510}