Author Archives: admin

Boscam HD19 and Raspberry Pi

There seems to be only one way to feed live video from Boscam HD19 FPV camera to Raspberry Pi over wire. To do that you’ll need composite AV to USB capture card. The one I had lying around is called KWorld VS-USB2800D Composite/S-Video to USB 2.0 (see Pic 1 and 2).

KWorld VS-USB2800D

Pic 1. KWorld VS-USB2800D front side

KWorld VS-USB2800D

Pic 2. KWorld VS-USB2800D back side

Connect Boscam camera to capture card with supplied mini USB to composite AV cable. Insert supplied multifunctional port’s power cable and connect it to 12 V battery (as per Boscam’s specification). I used Turnigy 3S 11.1 V battery which seems to do the job. See pics bellow.

Pic 3. Boscam HD19 with composite and power cables connected

Pic 3. Boscam HD19 with composite and power cables connected

Pic 4. Turingy 3S 11.1 V battery

Pic 4. Turnigy 3S 11.1 V battery

Pic 5. Everything's connected

Pic 5. Everything’s connected

Connect capture card to Raspberry’s USB port (Pic 6).

Pic 6. And... It's a mess

Pic 6. And… It’s a mess

Turn on your Boscam camera by holding its power button and start Raspberry. If you’re lucky Raspberry will detect your capture card on boot and it’ll be ready to use. You can quickly test it with software like guvcview. You can find an incomplete list of supported devices here.

In my case, even though everything was detected, all I got was black screen. The problem was that KWorld’s capture card has two inputs: S-Video and composite and it defaults to using S-Video.

To fix this I listed available channels:


Pic 7. Listing available channels

and selected composite channel:


Pic 8. Selecting channel

It works!

Pic 7. guvcview works

Pic 9. guvcview works

Making Samsung Galaxy S2 i9100 and Samsung Galaxy Note 10.1 N8000 faster

I bought Samsung Galaxy S2 & Samsung Galaxy Note 10.1 couple of years ago and for the better part of the last half a year both devices became unbearably slow. I went through the usual motions of cleaning junk and cache and memory but nothing helped, so I just kinda written of bad performance as a case of “applications becoming more bloated and device performance staying the same”. However, recently I read that Android didn’t have TRIM support until 4.3 version (more about this here). Problem is, that highest supported version of Android by Galaxy S2 and Galaxy Note 10.1 is 4.1.2. I didn’t want to try custom roms, so I tried fixing my performance using third party software Trimmer (fstrim). Before trying this program you need to have your device rooted, you can read about it here (Galaxy S2) and here (Galaxy Note 10.1).

Running Trimmer (fstrim) software alleviated performance problems significantly.

P. S. There is a chance to brick your device by either rooting or running trimming software, so do it at your own risk.

Compiling bgslibrary demo program

Before beginning make sure you have OpenCV >= 2.4 installed.

Copy the following demo code into main.cpp:

#include <iostream>
#include <cv.h>
#include <highgui.h>

#include “package_bgs/FrameDifferenceBGS.h”

int main(int argc, char **argv)
CvCapture *capture = 0;
capture = cvCaptureFromCAM(0);

std::cerr << “Cannot initialize video!” << std::endl;
return -1;

IBGS *bgs;
bgs = new FrameDifferenceBGS;

IplImage *frame;
frame = cvQueryFrame(capture);
if(!frame) break;

cv::Mat img_input(frame);
cv::imshow(“Input”, img_input);

cv::Mat img_mask;
cv::Mat img_bkgmodel;

// by default, it shows automatically the foreground mask image
bgs->process(img_input, img_mask, img_bkgmodel);

// cv::imshow(“Foreground”, img_mask);
// do something

if(cvWaitKey(33) >= 0)

delete bgs;


return 0;

Copy package_bgs directory from bgslibrary into directory containing main.cpp file and create a new folder named config in the same directory.


g++ -c `pkg-config opencv –cflags` main.cpp package_bgs/FrameDifferenceBGS.cpp

Check library paths

pi@raspberrypi ~ $ cat /etc/

pi@raspberrypi ~ $ sudo ldconfig -v


g++ -o out `pkg-config opencv –libs` main.o FrameDifferenceBGS.o