Working With OpenCV Eclipse.
The Open Source Computer Vision Library has >2500 algorithms, extensive documentation and sample code for real-time computer vision. It works on Windows, Linux, Mac OS X, Android and iOS.
Download OpenCV from below link:
http://sourceforge.net/projects/opencvlibrary/
Run the .exe file. The self extractor will ask you to provide location to store the extracted file.
My environment configuration
    OS: Windows 8 (64-bit)
    Eclipse: Kepler Service Release 2 , 32-bit
    OpenCV: Version 2.4.9
Follow below steps to configure OpenCV and Eclipse.
- Open Ecplise. 
- Goto Window --> Preferences  
- Java --> Build Path --> User Libraries  
- Click on New... button  
- "New User Library" box will open. Enter the name of the Library as shown in figure. Now Click on "OK" button.  
- 
Now Click on "Add External JARs..." button   
- Locate and select the "opencv-249.jar" file from the "JAR selection" dialog box. See the circle for the path to 'opencv-249.jar' file. Now Click on "open" button. 
-  "Preference" Box will look like below figure. 
- Now select "Native library location" and click on "Edit..." button. 
- Now click on "External Folder..." to locate the native library. 
- See the figure to locate the native library. If the eclipse is of 64-bit, then you should choose 'x64' folder. Since I am using Eclipse 32-bit, so I choose 'x86' folder. Then click on "OK" button. 
- Now click on the "OK" button. 
- 
Now click on "OK" button on the preference box.  
 Now it is the time to test. Follow the below steps to test the above configurations.
- Open Eclipse , and create a new Java project. (Say the project name is "testOpenCV")
- 
After creating the project, right click on the project name and select "Properties" option.  
- 
Now select "Java Built Path" --> "Libraries" tab --> "Add Library" button. 
- 
Select "User Library" and click on "Next" button.   
- 
Now select the add the user library, "openCV-2.4.9" and click on "Finish" button.   
- 
Now click on "OK" button.   
- 
Now create a java file. (say the file name is "test")  
- 
Now insert the following Code.  
package testOpenCV;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class test {
   public static void main(String[] args) {
    System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
         Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
         System.out.println( "mat = " + mat.dump() );
 }}
Now Execute the java file. You should get the following output. 
-Thank you.