PCL C2988 unrecognizable template declaration/definition Visual Studio 2017

If you get this compile error:

Error C2988 unrecognizable template declaration/definition

When you:

from the Point Cloud Library (PCL) in Visual Studio 2017, then either throw the following in before the #include, like this:

or upgrade your version of Visual Studio 2017 (I haven’t tested this yet myself!)

Not sure why, it’s something to do with workarounds for VS 2017 bugs or something…

ExifTool truncates ASCII MakerNote data

ExifTool can be used to output a specific Exif MakerNote from your images’ metadata by using the following command:

This will output makernote Id 0x13, however if the makernote that you are interested is long, then ExifTool may truncate it and output only the start with […] at the end!

To have ExifTool output the full makernote, use the -b (binary) option like this:

Raspberry Pi and GPS for Testing Camera Image Timestamps with NTP and PPS

raspberry_pi_gps_pps_time_image_timestamp

An image time-stamp will tell you when an image was acquired by its camera, they are typically donated in Coordinated Universal Time (UTC) – accurate time-stamps are very often important in Computer Vision Applications especially those that involve observing or analyzing change over time.

Implementing such time-stamp functionality on a camera is very hard and typically involves both hardware and software support – testing the functionality to make sure that the time-stamps are accurate is nearly even harder!

A time-stamp’s accuracy is partly dependent on how well the camera’s time is synchronized, if it’s time is well synchronized by the Network Time Protocol (NTP) then an accuracy of a few milliseconds can be expected, if full pulse-per-second (PPS) synchronization is used then (with care) an accuracy of tens of microseconds can be achieved.

In order to test time-stamp accuracy it is necessary to have an accurate time source to act as a test base-line for comparison purposes, multiple cameras can the then be synchronized to this via their acquisition triggers and NTP or PPS and their images and image time-stamps can be compared.

To this end we have been prototyping a Stratum 1 time source built using a Raspberry Pi with a GPS shield. This will take its time reference from GPS and provide the following for testing cameras:

+ NTP time server (stratum 1) – Raspberry Pi & NTP syncs its time to GPS time via PPS signal and time packets (ZDA packets), the cameras’ NTP clients can use this for synchronizing their clocks (purley software based synchronization).

+ Electrical PPS output – Can be used by camera for syncing it’s time via PPS and for triggering acquisition on second boundaries

+ Re-transmit PPS time packets (ZDA) via UDP – Can be used by cameras for syncing their time via PPS (software & hardware synchronization)

To build the time source we are following this excellent article which explains the various steps involved:

http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html

Many thanks to David Taylor, it is a rather complex subject with lots of software setup on the Pi, it hurts our heads but we are making progress, and the initial prototype has already been very helpful in characterizing camera triggering and time-stamping behavior. We expect great things.

In terms of hardware we are using:

Uptronics Raspberry Pi+ GPS Expansion Board – with the GPS Timing Antenna

Raspberry Pi 3

Image Processing with Intel’s SSE SIMD instructions for 12-bit images

Over the last few days I have been working on implementing some low-level 12-bit image processing functions using Intel’s SIMD instruction set – SSE. The aim here is to increase processing time performance as much as possible – initial results are very encouraging, those 128bit register really get things to scream along!

It has been a while since I have done such work on Intel devices (ARM and hence ARM NEON is more common on IoT projects), the last time was before MMX ‘Intrinsics’ were invented and involved hand coding MMX instructions with associated support assembly language. Intrinsics really make coding this stuff so much simpler!

Very often it doesn’t pay for a software engineer to hand-code and optimise image processing algorithms, but when maximum performance is required, huge speed gains can be made with some careful coding on standard hardware!

Accuracy of the various Windows software timers

This (admittedly quite old) article provides an interesting comparison of the accuracy of the various software timers available under windows, it looks like the Multimedia timers are still the best despite apparently being frowned upon my Microsoft.

http://omeg.pl/blog/2011/11/on-winapi-timers-and-their-resolution/

I plan to trial camera acquisition using a software trigger, and in order to obtain as accurate and reliable a trigger as possible I want to get as close to a timer interrupt handler as windows will allow, in the hopes that it will be ‘good enough’ for my computer vision application. For a really reliable trigger time-base I normally use a hardware trigger generated by a micro-controller or similar, but this time as the timing constraints aren’t as onerous I have decided to see if I can get away without one, so we will see…. I guess I will have to test the various options and see which is best and if any of them are (generally) within spec..

Good NTP Client Setup Description

As a software engineer (rather than an NTP guru), I find that configuring and debugging an NTP setup can be quite challenging, it is (by its nature) a difficult subject, and a lot of the info out there is quite dense and hard to parse, so I was presently surprised to come across this nice article, called ‘Real Life NTP’ which gives a good overview and describes the use of ntpq -p etc.

https://pthree.org/2013/11/05/real-life-ntp/

Thanks Aaron!

Nice Bootsrap / AngularJS based templates

I was browsing yesterday and came across some nice bootstrap based templates for web app development, especially this one:

http://wrapbootstrap.com/preview/WB04HF123

The nice this is that a version built on AngularJS is available, although I can’t vouch for its build quality not having seen the code…

Templates like these are a great starting point for software developers wishing to put together a web application that doesn’t necessarily look terrible – without the need of one of those GUI guys! Perfect for developing a HMI for an embedded device for example or for developing a cloud application, or even for developing a local app on your PC with Node.js!?

Generating Win32 Crash Dumps

Every Software Engineer knows that most software ends up crashing eventually, when it does it is very useful to have a full crash log to help you determine the cause of the problem, to that end here is a good article that I found on working on what Microsoft calls ‘Minidumps’ on windows.

http://crashrpt.sourceforge.net/docs/html/using_minidump.html

This is some code for catching unhanded exceptions (typically like null pointer references or heap corruption etc.) and writing a crash dump that can later be opened up with visual studio:

You will need to link to DbgHelp.lib.

If you run your program from within visual studio’s debugger (e.g. F5) then the debugger won’t let execution run on to the handler, so to test the handler you will have to run your program without the debugger (e.g. ctrl-F5), bit of an annoyance but there you have it…

Image Storage and Indexing for Machine Vision Images

Every Software Engineer needs a hobby – to this end I have been toying with an idea for the last while.

There are many machine vision and computer vision applications that capture images from cameras and store them on disk. These applications can generate so many images that working with them can be quite difficult. For example consider an application that acquires from two cameras each acquiring at 30 frames per second – this application will save 216K images per hour, a 5 hour run would generate 1 million images!

Very often the images will be stored on a file system (local or networked) in some sort of hierarchical directory structure. Using a file system is a very efficient way of storing images, database systems (Relational or NoSQL) don’t offer many advantages and indeed can have associated disadvantages.

But how can we effectively work with so many images, we have possibly millions of images sitting in a set of directories, how can we interact with them and efficiently and query them based on attributes that are interest to us so the we can perform more analysis?

For example consider this set of (contrived) image queries:

Give me all of the images:

+ from camera 1
+ from camera 1 acquired on Sunday between 13:00 and 13:10
+ whose file size > 1MB
+ acquired within 100 meters of this GPS location
+ that have an average brightness > 63 Grey levels

Some people have attacked this image query problem by using a relational database to store image meta-data, if designed well this can allow for efficient image retrieval, however it seems to me that a schema-less approach is a better fit for images with dynamic attributes and I like the idea of not being tied down to any particular database technology and all of the baggage that comes with it.

So my idea is to start out on the road of implementing (for fun) a simple image indexing system for rather large sets of images, it will have an associated tool set, API and maybe even a query language in the future.

The system will:

Allow indexing of large numbers of images in arbitrary hierarchical directory structures

Index images based on standard attributes such as:

+ Acquisition Date/Time
+ Name
+ Source (e.g. camera)
+ Type
+ Size
+ Bit Depth
+ Exif Data, e.g.:
–> Location
–> Author
–> Acquisition parameters (aperture, exposure time etc.)
+ Etc.

Index images optionally based on Computer Vision metrics, e.g.
+ Brightness
+ Sharpness
+ Etc.

Allow users to define their own attributes for indexing, e.g.:
+ Define image attributes based on an OpenCV algorithm
+ Define attributes based on the contents of the image fie name.

The system will:

+ Have no dependencies on technologies such as Database systems etc.
+ Be cross platform

To get the ball rolling and so that we can say the first sod has been turned, here is some (naive) python which scans a directory tree of images and creates a flat CSV file of the image name, path and size:

Run it like this:

Once the directory tree has been walked and the CSV file generated we can use the following script to query images:

This allows us to run queries like this:

This will quickly list the images whose file size > 76000 bytes and whose name contains ‘_43’

This is a really simple first step but it does demonstrate how even a flat ‘index’ of attributes can be of great use.

Next Step:

+ Add more image attributes to the CSV file

Software Algorithm Complexity Cheat-Sheet

Software Algorithm Complexities – Having trouble remembering your O(n)’s from your O(log N)’s, not to worry I just found this very handy complexity cheat-sheet –

http://bigocheatsheet.com/

I am currently doing some research into possible indexing mechanisms for very large sets of images in Computer Vision applications, so this sheet is very handy, thanks Eric!