Quadcopter, Camera and Software to Monitor Coastal Erosion

We are based in Wicklow Town near to the Murrough which is a piece of coastline directly to the North of Wicklow town. Recently a part of the Murrough has been undergoing rather alarming & incredibly fast erosion, differences in the shore line can be observed on a weekly basis. The erosion is occurring mostly at the end of some new rock armour that was quite recently placed to the North of Wicklow town.

Anyway I started to think about how an amateur could monitor the progress of the erosion and maybe plot time-laps type pictures as it progresses, I couldn’t think of any kind of cheap and accessible survey method that could be used to monitor the erosion until I thought of a quadcopter with a downward facing camera along with some offline computer vision software, here’s the kind of thing that I am thinking of:

1.) Fly a quadcopter on a pre-programmed route low over the area of erosion every few days (may need to fly a grid)

2.) Use a downward facing camera on the quadcopter to acquire images of the shore directly below

3.) Use some computer vision software (OpenGL based) to detect features and use them register the images in space to one another yielding a photo-mosaic for each flight.

4.) Use static features (like the rock armour) to register the photo-mosaics from one flight to another.

This may yield a photo-mosaic of the coast from each flight which can be spatially registered to one another (using static features). This could allow us to accurately monitor the erosion as a function of time in detail along this section of coast.

Now if only I had some spare time (oh and a quadcopter)….


Which OpenCV libraries do I need for VideoWriter ?

I am currently testing some video encoding times for a computer vision project that I am working on using the OpenCV video functionality in windows. I hate wrestling with all of the OpenCV library files, but to use VideoWriter you just need to use the following libs:


Where XXX is the version number of the libs that you are using, so for example on the software project that I am currently working on, I need to include:


You will need to have the corresponding .dll files on your path as well to run your program.

OpenCV Display window title corrupted and multiple windows show

I had a very strange (and annoying problem) with an OpenCV project in VS2012, when my program created an image display window (namedWindow) I noticed that its window title was all garbled and soon afterwards other display windows were created even though the code had not requested them.

I spent a lot of time comparing the VS2012 projects settings with those of another working project and eventually found that I could make the problem go away by adding this to the ‘Preprocessor Definitions’ setting:


I have no idea at the moment why adding this fixed the problem but it did! I must have added it to the working project (which was born inside VS2010) but I can’t remember why!

Building / Cross Compiling OpenCV for Linux ARM

This article outlines the steps necessary for building OpenCV for a Linux ARM target. OpenCV is an open-source, cross-platform computer vision and machine vision library.


I cross compiled OpenCV for a Xilinx Zinq ARM system yesterday by more-or-less following the steps outlined in the above document – I had to change a few things to get the build to work. I am documenting the exact steps that I took in case anybody is having trouble (probably future me!).


I started with a fairly clean Ubuntu install on a virtual machine (it already had git installed) , first I installed some build tools, feel free to skip any that you already have:

sudo apt-get install build-essential
sudo apt-get install cmake

Then I installed the GNU ARM tool-chain:

sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi

This installed version 4.7 of the compilers while the build process calls for version 4.6, to get around this I modified the cmake platform file slightly, see below.


Create a build directory, cd into it and get the OpenCV source from github:

mkdir opencv_build
cd opencv_build
git clone

To fix the version problem I modified the compiler version in the platform file (this may not be the most correct way to do this but it worked for me!):


I edited this file:




I changed the GCC_COMPILER_VERSION variable’s value from 4.6 to 4.7 to match my installed compiler. I had to edit the file as I wasn’t able to override these variables from the command line.


Now create a sub-directory called build and cd into it:

mkdir build
cd build

And configure the build:

cmake -DSOFTFP=ON  -DCMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv

This should complete without errors if you have the compiler that it is looking for installed etc.


Now run ‘make’ and ‘make install’:

make install

Make will take a few minutes to run, make install should copy the output files to a subdirectory called ‘install’.


All being well you should now have all the include and lib files that you need to build an OpenCV app for your ARM device.


Using OpenCV from .NET C++/CLI

I am happy to report that I have had a reasonably easy run of using OpenCV from a .NET C++/CLI project, I was initially worried that the two might not play well together, but so far – so good! I am wrapping some machine vision code that uses OpenCV in a C++/CLI assembly so that I can call it from C# code. I have kept the rather creepy CLI stuff to a minimum it just implements the interface, everything else is vanilla C++ using the standard library.


The only thing I had to do to get rid of build errors was to make sure that each _proper_ C++ file in the project had the following value for the ‘Common Language RunTime Support’ build setting -> ‘No Common Language RunTime Support’!


So if you are toying with the idea of developing some OpenCV based software from within C++/CLI, I say give it twirl it makes interacting with .NET much easier than (say) using COM or similar!