opencv

Can I get the OpenCV source code snippet for k-means clustering algorithm?

I was going the K-means algorithm as a technique for clustering images, as part of my project in the area of Image Processing. In the process, I decided to code using OpenCV libraries. So, can somebody help me in coding the algorithm in C++ using OpenCV. I can manage well, if some code snippet is provided. I just started learning about t...

OpenCV SURF, is it normal that the captured videos lag by a little? How to speed it up?

How do I speed up the correspondence matching processes of SURF? I used the samples provided and changed it to capture color images from the webcam for processing, however, the speed certainly needs improvement. Where should this be tackled on? ...

python opencv: no image

Hi all, I am trying to capture from a Sony Handicam DCR-HC38, running the code below, and passing [-1 .. 3] to the CaptureFromCAM function. The code runs, but I get no image. Do I need to "wrap" the camera somehow? Skype recognizes the camera, but python/opencv won't. I'm running Windows Vista if that helps any. import cv cv.Named...

Using OpenCV to detect clothing buttons on a piece of paper

I have no background in computer vision, but I was curious to know how I could use OpenCV library to achieve the following: I have a jar of spare buttons, assorted in colour, style and diameter. For the most part they are circular. I evenly scatter them on a piece of white paper, and under good lighting, take a fairly high resolution pi...

Playing AVI files in OpenCV

Hi all, I can't seem to play my avi files using OpenCV. I am on a Mac and the files work with Quicktime and VLC player. I have tried using mencoder to convert it to i420 but that still has not been successful. No error messages occur and it seems like the program closes automatically and I'm not sure how to debug it. int main(int arg...

When I load an image in OpenCV it is always darker than the original. Why?

Hey guys and gals, So I load a color .png file that has been taken with an iphone using cvLoadImage. And after it's been loaded, when I immediately display it in my X11 terminal, the image is definitely darker than the original png file. I currently use this to load the image: IplImage *img3 = cvLoadImage( "bright.png", 1); For th...

where to read image pixel?

Respected sir, I am about to start my final year project "Real time/fast implemantation license plate recognition" using opencv. Opencv is totaly new for me and i am working on it now-a-days and i am facing couple of problems with it. I know how to display images but i don't know where to read image pixels or read image in mat...

OpenCV: Invert a mask?

Is there a simple way to invert a mask using OpenCV? For example, if I've got a mask like this: 010 111 010 I'd like to invert it and get this: 101 000 101 Note: I'm using OpenCV's Python bindings, so while it would be possible to simply loop over each element in the mask, execution speed could become an issue. ...

How to modify openCV source code?

I copied the part of codes that I wanted to modify into my main.cpp. However, upon executing it, the speed is much slower. Why is that so and how do I modify codes in this case? ...

OpenCV: cvLoadImage opens 16-bit image as 8-bit

I am trying to process 16-bit single-channel uncompressed TIFF images with OpenCV 2.1, but when I call cvLoadImage, apparently they get converted to 8-bit: IplImage* img = cvLoadImage("myImage.tif", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR); std::cout << img->depth << std::endl; prints 8 The images have been produced ...

OpenCV: Enumerate shapes in binary image?

If I've got an image which look, for example, like this: 0101001 1101101 0101001 Is there any method I can use which will find both of those disconnected blobs? For example, producing something like this: 0102003 1102203 0102003 Like scipy.ndimage.label. ...

OpenCV: get Hough accumulator value?

Is it possible to get the accumulator value along with rho and theta from a Hough transform? I ask because I'd like to differentiate between lines which are "well defined" (ie, which have a high accumulator value) and lines which aren't as well defined. Thanks! ...

Need to keep track of types of opencv Mats

Hi, So I'm using the class Mat from opencv in a program I'm writing. Mat looks something like this: class Mat { public: Mat(int width, int height, int type); template <typename T> T getElt(int x, int y); int depth(); ... } The type in the constructor specifies whether elements in the Mat are float...

OpenCV: Load multiple images

Hi All, I am updating some older OpenCV code that was written in (I guess) an OpenCV 1.1 manner (i.e. using IplImages). What I want to accomplish right now is to simply load a series of images (passed as command line arguments) as Mats. This is part of a larger task. The first code sample below is the old code's image loading method. ...

Whenever I use cvMatchTemplate in openCV, I get a segmentation fault. Why?

Hey guys and gals, I'm trying to do a simple template match in openCV and at the line in my code where I call cvMatchTemplate, I get a segmentation fault. I don't know if this is relevant, but i'm on a mac using x11 and i'm using opencv 2.0.0. Here is relevant code: IplImage* imgOriginal = cvLoadImage("reference.png", 0); IplImage*...

SWIG Python bindings to native code not working with OpenCV 2.1

I have an OpenCV project mixing Python and C. After changing to OpenCV 2.1, my calls to C code are not working any more, probably because OpenCV is no more using SWIG bindings. From Python, I was used to call a C function with the following prototype: int fast_support_transform(CvMat * I, CvMat * N,...); Now, I get the following err...

Visual Studio 2008 not Aligning Stack Variables?

I'm trying to read an avi file in OpenCV 2.1, VS2008 standard for 2 days now with no luck. I constantly get this message in the program console: Compiler did not align stack variables. Libavcodec has been miscompiled and may be very slow or crash. This is not a bug in libavcodec, but in the compiler. You may try recompiling using...

Is there any official place to find opencv article references?

I'am having a hard time trying to find the article which is referenced in the cvFindContours algorithm, it is "Topological structural analysis of digitized binary images by border following" Satoshi Suzuki and Keiichi Abe. [suzuki85] So I wonder if there any resource where all the OpenCv references are stashed. Also, any explanation...

Totally Lost on "Installing" OpenCV / ctypes-opencv for Python 3.

I'm trying to get OpenCV working with Python 3. A friend showed me ctypes-opencv that appears to work with Python 3. The problem is I totally can not figure out how to "install" or get any code working. I've followed all instructions I could find from a few people mentioning installs on google and none of those seemed to work or I couldn...

OpenCV and Regions of Interests (ROI)?

How does OpenCV handle Regions of Interest (ROI)? Say I set a region of interest using cvSetImageROI(). Is that ROI stored with the IplImage structure? If so, when I pass the image to functions such as cvSmooth() or cvFindContours(), will those functions operate on the whole image or just the ROI ? cvFindContours() seems to provide ...