Monday 9 July 2012

Primitive Computer Vision


I'm working on a project at the moment, which see's me taking screen shots of the system (desktop as a whole) and looking for visual queues on the screen in order to seemingly smartly decided what to do, this is directly on the back of the graphics project I have at work, when something is going wrong, I want to capture the DirectX surface I'm rendering to, save it as a PNG or raw BMP and then process it for "visual queues".

The trouble is, the human eye is a hell of a lot more use than parsing through pixel data, which is pretty much what I'm reduced to at the moment.

I've been looking at implementing a Neural Network to recognise the colours, but Neural Nets have always been a bit of a dark art for me, even though I did two three month courses on AI at uni, Neural Networks only really came up in passing conversation, and then only for the lecturer to try to sell us on the book he'd just written the foreword for - a book I might add which I still have, and which is utterly useless at explaining the concepts at hand... Anyway....

I've also looked at fuzzy logic, and statistical comparison... At the moment I'm happy to stick to plain old comparison, with a tollerance range, so statistics... but I want something smarter to actually see subtler shades later...

That brings me to the other can of worms I've been dealing with, you'll maybe have seen the image processing I'd been doing in C++, I posted some images on this very blog a while back... Well... That was using CImg in Ubuntu, and it worked like a charm, no issues from the off and it just seamlessly worked... Just the way I like things.

Having had that experience I was hoping for just as easy an experience within Windows with CImg... Boy was I disappointed, it just never came together for me, I could not load Jpeg's... Even linking against libjpeg and even libjpeg-turbo didn't work... It was like Visual Studio had an axe to grind, and refused to help.

The awful kluge I've gone for is using the GDI+ Jpeg loader as a Gdiplus::Bitmap*, and then to save the image with the CLSID image/bmp back through Gdiplus::Image::Save.  Utter nightmare, really inefficient, using GDI... gah.. Hate it....

But CImg refused to load the jpeg... No matter what I did... 

As for my two earlier posts about a bug in G++... Well, its not a bug in G++, and its technically not a bug in the GNU STD C++ implementation, rather it seems to be a bug whereby the underlying C API does not meet its own specification.

A chat was very helpful, spent some of this time mailing me back about the problem at hand, but... He was more interested in saying that this was not a bug, but that my code had passed an "out of bounds value"... When I pointed out the C specification for the data type stated that my known value was within bounds, suddenly I stopped getting mails from him :(

The other thing I have done is sign up for Dell's project Sputnik... I'd be very very interested in seeing if they take my application seriously, not least because the XPS series of laptops were high in the running when I was speccing the machine I am writing this very blog post on.  The XPS machines I thought would seamlessly run Ubuntu, and that's the distro DELL have gone with... The reason I didn't get an XPS was because for the specification I'm sat on right now it costed out at over £1100 from them... Whilst I paid only £550 for it, on an off the shelf Intel Chasis... in black, rather than brushed aluminium.

That's not to knock Dell kit, I use Dell kit exclusively at work, have done for about eight years when I forcefully retired my HP desktop and specced a new Desktop Dell, both my home servers are older quad core Dell machines, and my old laptop is a trusty Inspiron 6400... There's a lot of Dell kit around here.

But their support for Ubuntu, even when listed as a Canonical partner was not very forth coming, indeed somewhere I have quotable transcriptions of chats with Dell customer service reps where they speak of not getting any other OS than Windows...

So, Sputnik, come my way, I'll put you through your paces, and rant, rave and be constructive along the way.

(Xel knows he's not going to get jack squat, but hey least I wrong it here).

No comments:

Post a Comment