Showing posts with label OpenCV. Show all posts
Showing posts with label OpenCV. Show all posts

Sunday, March 1, 2009

OpenCV get pixel value!!!!

In OpenCV, using functions to get pixel values from an image, the pixel position must be carefully set!!!!!

 

Usually, the position we got from images or mouse click is in the form (x,y).

3318775976

In the function cvGet2D(Iplimage *image, int idx0, int idx1), the first parameter is used to specify which image data to get. However, the second parameter is not corresponding to x. Instead, the second parameter is the first index of the image data array, from the above figure, the first index of the image data should be y not x!

 

That means to get the pixel data of the image at (x,y) using
cvGet2D(image, y, x);
not
cvGet2D(image, x, y);

Tuesday, February 10, 2009

Using OpenCV

After installation, you must add "{installation folder}/OpenCV/bin" and "{installation folder}/OpenCV/lib" to the system environment path.

In Visual Studio, add "{installation folder}/OpenCV/cv/include", "{installation folder}/OpenCV/cxcore/include", "{installation folder}/OpenCV/ml/include" and "{installation folder}/OpenCV/otherlibs/highgui" to Tools->Options->Projects and Solutions -> VC++ Directories :Include files.

Moreover, add "{installation folder}/OpenCV/lib" to library files.

Then, open the property dialogue of the project, add "highgui.lib cv.lib cxcore.lib ml.lib" to Linker-> Input.

Google+