RSS

Eye controls for apps

Visit Fixational.com

Archive

Sep
12th
Wed
permalink

Prediction: iPhone 5 front camera will suck

FaceTime HD

Update

We were right! One nice surprise is the backside illumination which will definitely help in low-light conditions.

——

While loads of rumours are flying as usual, there hasn’t been much talk about the front facing camera for the iPhone 5. The main source has been this piece from June 2012. Coupled with the photos and video leaks of the new screen, we’re predicting that front facing iOS cameras are going to continue to suck.

Prediction: iPhone 5 with new Facetime HD camera…meh

Not as impressive as it sounds. This is likely to involve a 1280x720 pixel, 0.9 megapixel 16:9 aspect ratio sensor. While this is triple the number of pixels from the 640x480 pixel, 0.3 megapixel VGA iPhone and iPad staple, most of those pixels are background information.

edit: The primary uses for this camera are video calling and self-portrait photos. While 16:9 is great for movies and pictures of landscapes, 4:3 makes more sense for photos of faces. The majority of the “new pixels” won’t carry any useful information if the user’s face is in the centre of the image.

front camera resolution iPhone 4S vs iPhone 5

For those of us hoping to go magical things with a high-resolution front facing camera this will be a big let down. As covered in a previous post, this type of sensor has been used as the rear-camera for the iPad 2 and the iPod touch 4G. This is well behind the 1.9 megapixel sensor in the Samsung Galaxy S3, and even lags behind Google’s value entry Nexus 7 tablet at 1.2 megapixels. It’s not even as good as the camera from the original 2007 iPhone.

Let’s hope we’re pleasantly surprised, will update after the launch. Enjoy the show!

Sep
3rd
Mon
permalink

pick of the day

Wahey! Fixationals Wink Camera has been awarded “Pick of The Day” by The Next Web (TNW). You can see the article in full here, along with a dodgy, unshaven photo of our CEO Ronan O Malley :-P

May
4th
Fri
permalink
Fixational has been shortlisted for the Irish Software Association’s Investor Forum. We’re looking forward to pitching to the panel of VCs next week.

Update: Fixational finished Runner-Up in the award for “Top Investor Company”. Congratulations to the winners SilverCloud Health. A big thanks to the ISA for organising the event, to all the investors and to WhitneyMoore for our shiny new iPad which is already being put to excellent use testing Winksworth.

Fixational has been shortlisted for the Irish Software Association’s Investor Forum. We’re looking forward to pitching to the panel of VCs next week.

Update: Fixational finished Runner-Up in the award for “Top Investor Company”. Congratulations to the winners SilverCloud Health. A big thanks to the ISA for organising the event, to all the investors and to WhitneyMoore for our shiny new iPad which is already being put to excellent use testing Winksworth.

Mar
20th
Tue
permalink

Interview with Fixational CEO Ronan O’Malley at the recent Enterprise Ireland startup showcase [VIDEO]

Mar
12th
Mon
permalink

OpenCV vs Matlab

opencv vs matlab

Deep in the heart of Fixationals research headquarters, we spend many hours working with the various image and video processing tools out there. More than often than not, if you are in the image and video processing arena, you use either Mathworks Matlab, or the open source OpenCV programming environment. We are no different; we are pretty sussed in both, and have come to know the benefits and disadvantages of each. So if you’re a n00bie to the whole image and video processing thang, or you’re an old hand looking for a change, follow our very scientific NeckBeardIndex* to find out which programming environment is for you. 

Ease of use

Matlab is a relatively easy language to get to grips with. Matlab is a pretty high-level scripting language, meaning that you don’t have to worry about libraries, declaring variables, memory management or other lower-level programming issues. As such, it can be very easy to throw together some code to prototype your image processing idea. Say for example I want to read in an image from file and display it. In Matlab, I would create a new matlab file called test.m and in it I would write this as:

I = imread('springbreak.jpg');
imshow(I)


Easy, right? Now, if I wanted to do the same using OpenCV, I would create a test.c file and (if I wrote it in c) it would look like:

#include "cv.h" //main OpenCV header
#include "highgui.h" //GUI header

int main() {

// declare a new IplImage pointer
IplImage* myimage;

// load an image
myimage = cvLoadImage("springbreak.jpg",1); //change the file name to your own image

//create a new window & display the image
cvNamedWindow("Smile", 1);
cvShowImage("Smile", myimage);

//wait for key to close the window
cvWaitKey(0);
cvDestroyWindow("Smile");
cvReleaseImage(&myimage);
return 0;
}

Woha. Granted, we could get away with a bit less lines than what we showed here, but there are still many more lines of code to do the same thing than in Matlab. Much of these extra lines consist of “housekeeping code” which will become second nature for you to write as it is very similar between all projects. However, this does mean that OpenCV has a higher learning curve. 

NeckbeardIndex:

Matlab 9/10

OpenCV 3/10

-Matlab is a much easier language to get to grips with. 


Speed

Matlab is a pretty high-level scripting language, meaning that you don’t have to worry about memory management or other lower-level programming issues. However, this is due to the fact that Matlab is built on Java, and Java is built upon C. So when you run a Matlab program, your computer is busy trying to interpret all that Matlab code. Then it turns it into Java, and then finally executes the code.

OpenCV is basically a library of functions written in C.  You are closer to directly provide machine language code to the computer to get executed. So ultimately you get more image processing done for your computers processing cycles, and not more interpreting. As a result of this, programs written in OpenCV run much faster than similar programs written in Matlab. For example, we might write a small program to detect peoples smiles in a sequence of video frames. In Matlab, we would typically get 3-4 frames analysed per second. In OpenCV, we would get at least 30fps, resulting in real-time detection. This makes OpenCV much better at demoing prototype programs using a standard PC and webcam for example.

NeckbeardIndex:

Matlab 2/10

OpenCV 9/10

-OpenCVs speed wipes the floor with Matlab, and is makes your real-time video demonstrations more impressive for showing off to your mates. 


Resources Needed

Closely related to speed, the resources used by both programming environments needs to be looked at. Image and video processing in its nature can be pretty resource heavy due to the amount of pixel data in each image. However, there is a wide gulf on the resource scale between Matlab vs OpenCV. Due to the high level nature of Matlab, it is a resource hog. We have had Matlab code that has required over a gig of RAM to run through video. In comparison, our typical OpenCV programs only require ~70mb of RAM to run in real-time (assuming your code has no “leaks”, see “Memory Management” below). Similarly, a full installation of Matlab plus all the toolboxes will take up a couple of gigs on your computer. In comparison, OpenCV only requires a gig at most. 

NeckbeardIndex:

Matlab 4/10

OpenCV 9/10

-OpenCV will happily run on your old desktop PC. Matlab might be a good excuse to buy that new PC. 


Cost

List price for the base (no toolboxes) MATLAB (commercial, single user License) is around €1500 euros.  OpenCV (BSD license) is free.  

Nuff ‘said. 

NeckbeardIndex:

Matlab 4/10

OpenCV 10/10

-You wont get much better than free.  


Development Environment

Matlab comes with its own development environment, shown below. 

Matlab screenshot

As the Matlab development environment is based on Java, Mathworks have made versions of their IDE (Integrated development environment) for Windows, Linux and OSX. As such, when you install Matlab, you are in essence installing the programming environment and the IDE as well. We have found the Matlab development environment in Windows and Ubuntu to be a nicely laid out affair. However, in Apple OSX, it can be somewhat awkward to use due to its non-native support of cocoa and having use of X11 instead. 

For OpenCV, there is no particular IDE that you have to use. Instead, you have a choice of any C programming IDE depending on whether you are using Windows, Linux, or OS X. For Windows, Microsoft Visual Studio or NetBeans is the typical IDE used for OpenCV. In Linux, its Eclipse or NetBeans, and in OSX, we use Apples Xcode (shown below).

OpenCV xcode screenshot

To install OpenCV with your IDE of choice on a particular platform will require following a guide of various complexity. We have been happy with using the various IDEs for OpenCV, but due to Mathworks exclusive IDE for Matlab and its cross-platform ability, Matlab pips OpenCV to the post here. 

NeckbeardIndex:

Matlab 8/10

OpenCV 6/10

-Whether its Netbeans or Eclipse or Visual Studio, many developers have their favourite IDE for OpenCV. However, due to its exclusivity to the Matlab programming language, and thus is lack of complexity in setting it up, the Mathworks IDE wins out here. 


Memory Management

OpenCV is based on C. As such, every time you allocate a chunk of memory you will have to release it again. If you have a loop in your code where you allocate a chunk of memory in that loop and forget release it afterwards, you will get what is called a “leak”. This is where the program will use a growing amount of memory until it crashes from no remaining memory. Due to the high-level nature of Matlab, it is “smart” enough to automatically allocate and release memory in the background. We have found Matlabs memory management to be pretty good, demonstrated by the fact where we have run video analyzing programs for days and only have had a small increase in the overall memory footprint. Although OpenCVs overall memory footprint is very small to begin with in comparison, when you have a memory leak it can escalate into a huge amount resulting in much hair pulled in trying to track it down.

NeckbeardIndex:

Matlab 9/10

OpenCV 4/10

-Matlabs memory management is pretty good. Unless your careful with your OpenCV memory allocation and releasing, you can still be frustrated beyond belief. 


Portability

Both Matlab and the OpenCV development environment can be installed and run on Linux, Windows, and OS X. In our experience, we have had little issue with OpenCV and Matlab programs developed on one platform and running them on another platform. In some cases headers may have to be changed in OpenCV, or different codecs may have to be used for reading and writing video in Matlab. To the advantage of OpenCV, ports have been written for many additional platforms: here at Fixational we have had OpenCV running on everything from The Cloud (Amazon EC2 instances) to embedded devices such as Apple iPods. This reduces the barrier from a programs prototyping stage, to the final stage of embedding it on a device for real-time video applications.  

NeckbeardIndex:

Matlab 3/10

OpenCV 8/10

-If it can run C, there is a good chance that it will run OpenCV. 


Development of useful programming skills

Both Matlab and OpenCV are great programming languages to develop image-processing skills. However, as OpenCV is written in C, it’s a great way to simultaneously develop C programming skills. This can be good if you need to develop C programs for other applications, or even as a good jumping off-point if you want to learn Java or C++ for example. As OpenCV programs can be written using the common IDEs such as Netbeans, Xcode or Eclipse, it is also a great way to get to know your way around them for other programming applications that share the same IDEs.   

NeckbeardIndex:

Matlab 3/10

OpenCV 8/10

-Although there is a high learning curve with learning OpenCV in comparison with Matlab, the skills learned in OpenCV can be more useful.


Debugging

Many of the standard dedugging operations can be used with both Matlab and OpenCV: breakpoints can be added to code, the execution of lines can be stepped through, variable values can be viewed during code execution etc. Matlab however, offers a number of additional debugging options over OpenCV. One great feature is that if you need to quickly see the output of a line of code, the semi-colon at the end can be omitted. Also, as Matlab is a scripting language, when execution is stopped at a particular line, the user can type and execute their own lines of code on the fly and view the resulting output without having to recompile and link again. Added to this is are Matlabs powerful functions for displaying data and images, resulting in Matlab being our choice for the easiest development environment for debugging code. 

NeckbeardIndex:

Matlab 9/10

OpenCV 5/10

-As Matlab is a scripting language, it offers many additional debugging features over OpenCV.


Help and Sample code

Matlab features a very concise and informative help section in their IDE. Here, each function and its usage is outlined, along with some sample code demonstrating their use. The standard image processing functions are available along with a number of the newer image processing methods bundled in the various toolboxes. Some additional functions and sample programs are available on the blogs online, with the majority residing on the Mathworks “Matlab Central” website. As you have paid for the software, it is also useful to have a Matworks rep on the phone to ring up for help when there are issues with the software. 

To figure out what functions do what in OpenCV, a not-so-user-friendly search online is required to get the information needed. However, a huge benefit to OpenCV is the wealth of sample code available online. When a new image processing method is developed, it’s not long before somebody somewhere makes an implementation in OpenCV available online for download. 

NeckbeardIndex:

Matlab 8/10

OpenCV 9/10

-Matlab has a great help section in their IDE. However, OpenCV has a greater number of image processing functions available online.


Conclusion

opencv vs matlab tally

From the final scores we can see that OpenCV has the edge over Matlab for image and video processing development . Although Matlab has an easy learning curve, built in memory management, a great help section, it is very slow to execute code, and is expensive to get started in. While OpenCV can be difficult to debug and requires much “housework code” needed for memory management, header files, etc., it wins out due to its free cost, the magnitude of sample code available on the internet, the short development path from prototype code to embedding code, the useful programming skills learnt from its use, and its super-fast speed. Matlab is a more “generic” programming language in that it was designed for many uses, demonstrated by its numerous toolboxes ranging from financial to specialized DNA analyzing tools. On the other hand, OpenCV was made for image processing. Each function and data structure was designed with the image processing coder in mind. 

As such, if you are new to the whole image and video processing area or looking to make a change in your programming environment, we would recommend that you get started in OpenCV.  

References: 

1. “Why OpenCV?”, Utkarsh, http://www.aishack.in/2010/02/why-opencv/

Uktarsh gives a good comparison between the the two programming environments. 

2. Mathworks Matlab, http://www.mathworks.co.uk/products/matlab/

The original products website

3. OpenCV, http://opencv.willowgarage.com/wiki/

The original OpenCV website.