Showing posts with label Robotics. Show all posts
Showing posts with label Robotics. Show all posts

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!!!

Monday, December 2, 2013

Should the human race be worried by the rise of robots?

I come to simply answer this question with this famous quotes from Francois Rabelais stating that

“Science without conscience is the soul's perdition.” 

 and therefore to conclude by saying that it is not the robots we need to worry about , but rather the people who programme. Knowledge itself has never been a crime, we may decide to use it for the good or the bad. Injecting little ethical values in anything we do or create will definitely put an end to such doubt and pave a way for a better world. This world of peace and love, of fraternity and tolerance, of justice and democracy among people without any discrimination based on gender, race, faith, social status...

Sunday, December 1, 2013

Robotics from a software perspective : Humanoid robot Vs Android robot

According to wikipedia : A humanoid robot is a robot with its body shape built to resemble that of the human body. A humanoid design might be for functional purposes, such as interacting with human tools and environments, for experimental purposes, such as the study of bipedal locomotion, or for other purposes. In general, humanoid robots have a torso, a head, two arms, and two legs, though some forms of humanoid robots may model only part of the body, for example, from the waist up. Some humanoid robots may also have heads designed to replicate human facial features such as eyes and mouths. Androids are humanoid robots built to aesthetically resemble humans.