Tuesday, December 31, 2013

No library found for this namespace error in PrimeFaces

This silly error message usually occurs if you are using a PrimeFaces 3.0 version onward. With older version of PrimeFaces (less than 3.0) we used to make the following declaration:
xmlns:p="http://primefaces.prime.com.tr/ui"
However from 3.0 the following declaration need to be used instead:
xmlns:p="http://primefaces.org/ui"
So far so good, hopeful the road block is lifted .
Enjoy it.

Saturday, December 28, 2013

Morphological filters in opencv: erosin , dilation, opening and closing.

While reading through this famous book for getting started with opencv  I came across this simple explanation of morphological filters. In fact erosion and dilation are the most fundamental morphological operators. The fundamental instrument in mathematical morphology is the structuring element. A structuring element is simply defined as a configuration of pixels (a shape) on which an origin is defined (also called anchor point). Applying a morphological filter consists of probing each
pixel of the image using this structuring element.
The two filters of this recipe operate on the set of pixels (or neighborhood) around each pixel.
  • Erosion: replaces the current pixel with the minimum pixel value found in the defined pixel set.
  • Dilation: is the complementary operator, and it replaces the current pixel with the maximum pixel value found in the defined pixel set.
 If the input binary image contains only black (0) and white (255) pixels, each pixel is replaced by either a white or black pixel. In the opening and closing filters are simply defined in terms of the basic erosion and dilation operations:
  •  Closing: is defined as the erosion of the dilation of an image.
  •  Opening: is defined as the dilation of the erosion of an image.



Sunday, December 22, 2013

HSV a preferred color model in Computer Vision ?

           From my sincere personal view understanding different color models and their differences can be of tremendous importance when dealing with digital image processing and computer vision. Many new comers in the field usually try do everything with the most common color model : the RGB, but are quickly disappointed with the result they obtain. The objective of this post is not to explain in detail color models nor the HSV, rather to raise awareness about the issue.
   According  to wikipedia a color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or color components (e.g. RGB and CMYK are color models). There are five major models, that sub-divide into others, which are: CIE, RGB, YUV, HSL/HSV, and CMYK.
  What about the HSL/HSV ?






The above picture depicting the Ostwald diagram is briefly explained in this article as follow:
  • The hue (H) of a color refers to which pure color it resembles. All tints, tones and shades of red have the same hue.
    Hues are described by a number that specifies the position of the corresponding pure color on the color wheel, as a fraction between 0 and 1. Value 0 refers to red; 1/6 is yellow; 1/3 is green; and so forth around the color wheel.
  • The saturation (S) of a color describes how white the color is. A pure red is fully saturated, with a saturation of 1; tints of red have saturations less than 1; and white has a saturation of 0.
  • The value (V) of a color, also called its lightness, describes how dark the color is. A value of 0 is black, with increasing lightness moving away from black.
  • The outer edge of the top of the cone is the color wheel, with all the pure colors. The H parameter describes the angle around the wheel.
  • The S (saturation) is zero for any color on the axis of the cone; the center of the top circle is white. An increase in the value of S corresponds to a movement away from the axis.
  • The V (value or lightness) is zero for black. An increase in the value of V corresponds to a movement away from black and toward the top of the cone.
Another important explanation is from stackoverflow with the following key statement:

Unlike RGB, HSV separates luma, or the image intensity, from chroma or the color information. If you want to do histogram equalization of a color image, you probably want to do that only on the intensity component, and leave the color components alone. HSV is often used simply because the code for converting between RGB and HSV is widely available and can also be easily implemented.

 Using only the Hue component makes the algorithm less sensitive (if not invariant) to lighting variations. Like our hand has many parts palm, back palm, and below that. we can see different color variation in these areas, but the hue for all these regions don't vary much, so hue value can be useful in hand segmentation.

Finally I can say that  RGB is the way computers treats color, and HSV try to capture the components of the way we humans perceive color. Opening a view for machine color perception (RGB) vs human color perception (HSV). I am not an expert in computer vision nor in image processing  but a knowledge seeker trying to explore these fields. Any constructive comment shading more light on this issue is warmly welcome.

Sunday, December 15, 2013

cv prefix of class and function in opencv like CvMat and Mat

Hi, if you are exploring the opencv library with cpp for the first time you may have noticed that certain function or classes start with Cv and some note. In fact opencv has two interfaces C and C++ therefore those classes of C interface start with Cv in opposite to the C++ interface.
e.g:

IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage( "Example1", img );
cvWaitKey(0);


vs

 image = imread("test.jpg");
 namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
 imshow( "Display Image", image );

 waitKey(0);


Definitely the following ultimate question will come which one to choose ? or at least which interface will make your miserable life easier given that either C or Cpp is already a problem compared to Java, Python, etc ... My sincere advice is that unless you have some requirement obligation (embedded system interfacing ...)it is better to use the C++ interface, given different flexibilities that it provides you in term of automatic memory allocation and even more ...


Friday, December 13, 2013

Difference between versions of Eclipse : Europa, Helios, Galileo ,etc

Bingo ! here we are. Why am I even blogging about Eclipse today ? The truth is that Eclipse sucks and I don't have any better option.  I am sure most of you guyz out there hate eclipse for so many reasons. Me particularly when its come to choose an IDE I always choose Netbeans before even thinking about Visual studio (PROGRAM NOT RESPONDING ....no comment) or Eclipse. But the reality is that in many software companies Eclipse is being used. 
  Any way two days back I fell on OpenCV, after being amazed by its applications on computer vision, smart phones and robotics I decided to put matlab beside and explore these still unknown libraries. As you all all know the defacto and prime IDE for developing Android today is Eclipse. Same as opencv, many documentations and demo projects out there are on eclipse and C++.
  When it comes to different naming used by Eclipse, at first glance it is confusing. Are you going to use helios , juno, galileo or Europa ?  What is even the difference ?
 In fact Eclipse has it own way of versioning. Instead of using numbers say Eclipse 3.1 , Eclipse 3.2 , Eclipse 4.0 and etc it gives instead name to a particular version.

As you can see from the above table from Wikipedia these code names although appearing alphabetically as time goes on have no particular meaning.
 What I have observed is that these names are just simple version names. But feel free to drop a comment to add something or share your eclipse experience with us. A plus!!!