Search Results

Search found 340 results on 14 pages for 'opencv'.

Page 3/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • OpenCV Python HoughCircles error

    - by Dan
    Hi, I'm working on a program that detects circular shapes in images. I decided a Hough Transform would be the best, and I found one in the OpenCV library. The problem is that when I try to use it I get an error that I have no idea how to fix. Is OpenCV for Python not fully implemented? Is there a fix to the library I need for the program to work? Here's the code: import cv #cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) gray = cv.CreateImage(cv.GetSize(img), 8, 1) edges = cv.CreateImage(cv.GetSize(img), 8, 1) cv.CvtColor(img, gray, cv.CV_BGR2GRAY) cv.Canny(gray, edges, 50, 200, 3) cv.Smooth(gray, gray, cv.CV_GAUSSIAN, 9, 9) storage = cv.CreateMat(1, 2, cv.CV_32FC3) #This is the line that throws the error cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) #cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break And here is the error I'm getting: OpenCV Error: Null pinter () in unknown function, file ..\..\..\..\ocv\openc\src\cxcore\cxdatastructs.cpp, line 408 Traceback (most recent call last): File "ellipse-detect-webcam.py", line 20, in cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) cv.error Thanks in advance for the help.

    Read the article

  • How to use opencv header in visual studio windows app

    - by yooo
    I did my work in visual studio 2010 c++ console , but now i am trying to convert my work into windows app (making interface of it) in visual studio c++ . For that i have to add some header files which i have to add manually in windows form application, like and it show me some error's in it like DetectRegions.h(10): error C2146: syntax error : missing ';' before identifier 'filename' DetectRegions.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(11): error C2061: syntax error : identifier 'string' DetectRegions.h(14): error C2143: syntax error : missing ';' before '<' DetectRegions.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(14): error C2238: unexpected token(s) preceding ';' DetectRegions.h(16): error C2143: syntax error : missing ';' before '<' DetectRegions.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(16): error C2238: unexpected token(s) preceding ';' DetectRegions.h(17): error C2061: syntax error : identifier 'RotatedRect' DetectRegions.h(18): error C2653: 'cv' : is not a class or namespace name DetectRegions.h(18): error C2146: syntax error : missing ';' before identifier 'histeq' DetectRegions.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(18): error C2061: syntax error : identifier 'Mat' DetectRegions.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DetectRegions.h(18): warning C4183: 'histeq': missing return type; assumed to be a member function returning 'int' Plate.h is same like DetectRegions.h I add the other headers of opencv in Form1.h like #include "opencv2/features2d/features2d.hpp" #include <opencv/highgui.h> #include "opencv2/opencv.hpp" .......

    Read the article

  • Sudden issues reading uncompressed video using opencv

    - by JohnSavage
    I have been using a particular pipeline to process video using opencv to encode uncompressed video (fourcc = 0), and opencv python bindings to then open and work on these files. This has been working fine for me on OpenCV 2.3.1a on Ubuntu 11.10 until just a few days ago. For some reason it currently is only allowing me to read the first frame of a given file the first time I open that file. Further frames are not read, and once I touch the file once with my program, it then cannot even read the first frame. More detail: I created the uncompressed video files as follows: out_video.open(out_vid_name, 0, // FOURCC = 0 means record raw fps, Size(640, 480)) Again, these videos worked fine for me until about a week ago. Now, when I try to open one of these I get the following message (from what I think is ffmpeg): Processing video.avi Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. [avi @ 0x29251e0] parser not found for codec rawvideo, packets or times may be invalid. It reads and displays the first frame fine, but then fails to read the next frame. Then, when I try to run my code on the same video, the capture still opens with the same message as above. However, it cannot even read the very first frame. Here is the code to open the capture: self.capture = cv2.VideoCapture(filename) if not self.capture.isOpened() print "Error: could not open capture" sys.exit() Again, this part is passed without any issue, but then the break happens at: success, rgb = self.capture.read() if not success: print "error: could not read frame" return False This part breaks at the second frame on the first run of the video file, and then on the first frame on subsequent runs. I really don't know where to even begin debugging this. Please help!

    Read the article

  • How to install OpenCV 2.0 on win32

    - by Jive Dadson
    I need to install OpenCV on Win32. I do not have it installed currently. I downloaded OpenCV-2.0.0a-win32.exe and ran it. What the heck do I do now? There are no .lib's and whatnot. I found some instructions for building the release using cmake at http://opencv.willowgarage.com/wiki/InstallGuide . I downloaded the latest and greatest cmake, and tried to follow the instructions, but I was guessing. No joy. I specified VC++9 when I did the "configure," but cmake built a VC++ 6 dsw file. No vcproj. I converted the dsw into a vc++9 vcproj anyway, just to see if it would work. Nope. It compiled lots of files, but many failed because it could not find omp.h. Sure enough, it's not there, anywhere. The build log said, 'A tool returned an error code from "Performing Custom Build Step".' I am lost. Ideally, I would like to find a full installation with all the files pre-built for Win32 vc++ 2008. Failing that, I need instructions that even I can follow. Short sentences and small words, but lots of them. Please help! UPDATE: I tried to build just CXCORE. It complained, "cannot open file 'VCOMPD.lib'" There's that OMP again.

    Read the article

  • displaying video from webcam in OpenCV

    - by Adi
    hi all, I have installed VS2008 and am able to run the demo codes "camshiftdemo and lkdemo " which comes in the opencv library. With this done, now I am trying to run some simple codes from the internet to get acquainted with the OpenCV. I am just trying to display video from webcam and I am getting the following error.. Error I am getting is : Unhandled exception at 0x5e7e3d10 (highgui200.dll) in opencv.exe: 0xC0000005: Access violation reading location 0x719b3856. The code I am trying to run is : include include void main(int argc,char argv[]) { int c; IplImage color_img; CvCapture* cv_cap = cvCaptureFromCAM(-1); // -1 = only one cam or doesn't matter cvNamedWindow("Video",1); // create window for(;;) { color_img = cvQueryFrame(cv_cap); // get frame if(color_img != 0) cvShowImage("Video", color_img); // show frame c = cvWaitKey(10); // wait 10 ms or for key stroke if(c == 27) break; // if ESC, break and quit } /* clean up */ cvReleaseCapture( &cv_cap ); cvDestroyWindow("Video"); } Any help in this will be greatly appreciated. Thanks aditya

    Read the article

  • OpenCV. cvFnName() works, but cv::FunName() doesn't work

    - by Innuendo
    I'm using OpenCV to write a plugin for a simulator. I've made an OpenCV project (single - not a plugin) and it works fine. When I added OpenCV libs to the plugin project, I added all libs required. Visual Studio 2010 doesn't highlight any code line with red. All looks fine and compiles fine. But in execution, the program halts with a Runtime Error on any cv::function. For example: cv::imread, or cv::imwrite. But if I replace them with cvLoadImage() and cvSaveImage(), it works fine. Why does this happen? I don't want to rewrite the whole script in old-api-style (cvFnName). It means I should change all Mat objects to IplImages, and so on. UPDATE: // preparing template ifstream ifile(tmplfilename); if ( !FILE_LOADED && ifile ) { // loading template file Mat tmpl = cv::imread(tmplfilename, 1); // << here occurs error FILE_LOADED = true; } Mat src; Bmp2Mat(hDC, hBitmap, src); TargetDetector detector(src, tmpl); detector.detectTarget(); If I change to: if ( !FILE_LOADED && ifile ) { IplImage* tmpl = 0; tmpl = cvLoadImage(tmplfilename, 1); // no error occurs } And then no error occurs. Early it displayed some Runtime Error. Now, I wanted to copy exact message and it just crashes the application (simulator, what I am pluginning). It displays window error - to kill process or no. (I can't show exact message, because I'm using russian windows now)

    Read the article

  • setting the openCV configuration in an openGL project produce several errors

    - by GolSa
    I have a win32 solution which is set for openGL; it works well; but I want to write a function which use functions of openCV; I set the configuration for openCV for both X86 and X64;;I commented the openCV function and just to test the correctness of configuration, I run it; but when I want to run it on X64 I faced with the error below: Error 1 error C2065: 'GWL_HINSTANCE' : undeclared identifier D:\matrix\matrixProjection\src\ControllerMain.cpp 35 1 matrixProjection Error 2 error C2664: 'CreateDialogParamW' : cannot convert parameter 4 from 'BOOL (__cdecl *)(HWND,UINT,WPARAM,LPARAM)' to 'DLGPROC' D:\matrix\matrixProjection\src\DialogWindow.cpp 47 1 matrixProjection Error 2 points to this line of code: HWND DialogWindow::create() { /*-->this line*/ handle = ::CreateDialogParam(instance, MAKEINTRESOURCE(id), parentHandle, Win::dialogProcedure, (LPARAM)controller); return handle; } but on Debug Win32 configure, it runs; I used openGL32 in my project; is there any probability to be the cause? is there any X64 version for openGL? I know that there is something needed in X64 mode which my solution can not handle it; I googled a lot about it but I did not find any solution; How can I solve that?

    Read the article

  • OpenCV: Getting and Setting Camera Settings

    - by jhaip
    I have been searching around and can't find an example of how to get and set the camera capturing settings. For example the capturing resolution, fps, color balance, etc. I have only seen examples of how to change the settings when saving the captured video but I want to be able to find all the camera's capturing modes and choose which one I want. For example, I am using the PS3eye webcam and in the test program it allows you to change the settings (320x240 at 15,30,60,120 fps, 640x480 at 15,30,60,75 fps). So is there a function in OpenCV for getting all the camera's capture modes and choosing one? I remember in OpenFrameworks there was a function to change these settings but I would like to know how to do it in OpenCV. Here is the code for OpenFrameworks with OpenCV that does sort of what I want: vidGrabber.setDeviceID( 4 ); vidGrabber.setDesiredFrameRate( 30 ); //I want this vidGrabber.videoSettings(); vidGrabber.setVerbose(true); vidGrabber.initGrabber(320,240); //And this

    Read the article

  • Laplacian of Gaussian: how does it work? (opencv)

    - by maximus
    Does anybody know how does it work and how to do it using opencv? Laplacian can be calculated using opencv, but the result is not what I expected. I mean I expect the image to be approximately constant contrast at background regions, but it is black, and edges are white. There are a lot of noise also, even after gauss filter. I filter image using gaussian filter and then apply laplace. I think what I want is done by a different way.

    Read the article

  • How to use OpenCV in Python?

    - by Roman
    I have just installed OpenCV on my Windows 7 machine. As a result I get a new directory: C:\OpenCV2.2\Python2.7\Lib\site-packages In this directory I have two files: cv.lib and cv.pyd. Then I try to use the opencv from Python. I do the following: import sys sys.path.append('C:\OpenCV2.2\Python2.7\Lib\site-packages') import cv As a result I get the following error message: File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified module could not be found. What am I doing wrong? ADDED As it was recommended here, I have copied content of C:\OpenCV2.0\Python2.6\Lib\site-packages to the C:\Python26\Lib\site-packages. It did not help.

    Read the article

  • Using opencv in Win32 application for image show

    - by erjik
    Is it possible to output images so that they all will be inside a single window? Before, I used to output data using only opencv functions: cvNamedWindow("Image 1"); cvShowImage("Image 1", img); So I change image, then call: cvShowImage function and so on. But If I want to look at more than one image, then every new image needs its own window to be shown there And what I want is to put every such an output opencv's window inside one big main window. Is it possible to do it? And how?

    Read the article

  • OpenCv not initializing usb camera

    - by brainbarshan
    I am trying to capture video from usb camera using OpenCv. #include <highgui.h> #include <iostream> using namespace std; using namespace cv ; int main() { VideoCapture cap (-1); if(!cap.isOpened()) cout << "Cam initialize failed" ; else cout << "Cam initialized" ; return 0; } It is failing to initialize the camera. cap.isOpened() is returning zero. The same program, with same version of OpenCv and same usb camera, is correctly running in my friend's machine. I am running fedora 16. I did some searching in Google and Stack Overflow. But no useful help. Any idea ?

    Read the article

  • How i can do image CROP in OpenCV

    - by Nolik
    How i can do image crop such in PIL in OpenCV. Working example on PIL im = Image.open('0.png').convert('L') im = im.crop((1, 1, 98, 33)) im.save('_0.png') But how i can do it on OpenCV? I wanted to do so im = cv.imread('0.png', cv.CV_LOAD_IMAGE_GRAYSCALE) (thresh, im_bw) = cv.threshold(im, 128, 255, cv.THRESH_OTSU) im = cv.getRectSubPix(im_bw, (98, 33), (1, 1)) cv.imshow('Img', im) cv.waitKey(0) But it doesnt work. I think, i wrong use getRectSubPix. If it true, please explain how i can correctly use this function. Thanks.

    Read the article

  • Creating AVI files in OpenCV

    - by user80003
    Hello. I have been trying to create an application using OpenCV and Visual Studio 2008, to capture images from a webcam, apply a filter to them, and then write them to an AVI file. Everything works, except creating the AVI file. The problem is that it works on my computer, but it doesn't work on my colleague's computer. The reason for that (I think) is that he does not have the necessary video encoders for OpenCV to use. The cvCreateVideoWriter function does not return NULL, but I end up with a 0kb file on the disk.

    Read the article

  • Detecting video playing in browser from a screenshot -- OpenCV

    - by Jon
    I would like to draw a rectangle around a video playing on my screen. For example, I am watching a YouTube video in my browser. I would like to be able to take a screenshot, analyze that screenshot, and then draw a rectangle around where the YouTube video is playing. I have just started looking into how I might be able to to this. I came across OpenCV. I understand that OpenCV covers many computer vision techniques. Would any of them be particularly well suited for this task? Also, is this something that can be done in real time? Finally, is there a technique that would work for both in browser and full screen? Thanks!

    Read the article

  • Using OpenCV in QTCreator (linking problem)

    - by Jane
    Greetings! I have a problem with the linking simpliest test program in QTCreator: CODE: #include <QtCore/QCoreApplication> #include <cv.h> #include<highgui.h> #include <cxcore.hpp> using namespace cv; int _tmain(int argc, _TCHAR* argv[]) { cv::Mat M(7,7,CV_32FC2,Scalar(1,3)); return 0; } .pro file: QT -= gui TARGET = testopencv CONFIG += console CONFIG -= app_bundle INCLUDEPATH += C:/OpenCV2_1/include/opencv TEMPLATE = app LIBS += C:/OpenCV2_1/lib/cxcore210d.lib \ C:/OpenCV2_1/lib/cv210d.lib \ C:/OpenCV2_1/lib/highgui210d.lib\ C:/OpenCV2_1/lib/cvaux210d.lib SOURCES += main.cpp I've tried to use -L and -l like LIBS+= -LC:/OpenCV2_1/lib -lcxcored ang .pri file QMAKE_LIBDIR += C:/OpenCV2_1/lib/Debug LIBS += -lcxcore210d \ -lcv210d \ -lhighgui210d The errors are like debug/main.o:C:\griskin\test\app\testopencv/../../../../OpenCV2_1/include/opencv/cxcore.hpp:97: undefined reference to cv::format(char const*, ...)' Could anyone help me? Thanks! In Visual Studio it works but I need it works in QTCreator..

    Read the article

  • OpenCV: Shift/Align face image relative to reference Image (Image Registration)

    - by Abhischek
    I am new to OpenCV2 and working on a project in emotion recognition and would like to align a facial image in relation to a reference facial image. I would like to get the image translation working before moving to rotation. Current idea is to run a search within a limited range on both x and y coordinates and use the sum of squared differences as error metric to select the optimal x/y parameters to align the image. I'm using the OpenCV face_cascade function to detect the face images, all images are resized to a fixed (128x128). Question: Which parameters of the Mat image do I need to modify to shift the image in a positive/negative direction on both x and y axis? I believe setImageROI is no longer supported by Mat datatypes? I have the ROIs for both faces available however I am unsure how to use them. void alignImage(vector<Rect> faceROIstore, vector<Mat> faceIMGstore) { Mat refimg = faceIMGstore[1]; //reference image Mat dispimg = faceIMGstore[52]; // "displaced" version of reference image //Rect refROI = faceROIstore[1]; //Bounding box for face in reference image //Rect dispROI = faceROIstore[52]; //Bounding box for face in displaced image Mat aligned; matchTemplate(dispimg, refimg, aligned, CV_TM_SQDIFF_NORMED); imshow("Aligned image", aligned); } The idea for this approach is based on Image Alignment Tutorial by Richard Szeliski Working on Windows with OpenCV 2.4. Any suggestions are much appreciated.

    Read the article

  • OpenCV and iPhone

    - by gn-mithun
    Hello, I am writing an application to create a movie file from a bunch of images on an iPhone. I am using OpenCv. I downloaded openCv static libraries for arm(iPhones native instruction architecture) and the libraries were generated just fine. There were no problems linking to them libraries. As a first step, i was trying to create a .avi file using one image, to see if it works. But cvCreateVideoWriter always returns me a NULL value. I did some searchin and i believe its due to the codec not being present. I am trying this on the iPhone simulator. this is what i do... (void)viewDidLoad { [super viewDidLoad]; UIImage *anImage = [UIImage imageNamed:@"1.jpg"]; IplImage *img_color = [self CreateIplImageFromUIImage:anImage]; //The image gets created just fine CvVideoWriter *writer = cvCreateVideoWriter("out.avi",CV_FOURCC('P','I','M','1'), 25,cvSize(320,480),1); //writer is always null int result = cvWriteFrame(writer, img_color); NSLog(@"\n%d",result); //hence this is also 0 all the time cvReleaseVideoWriter(&writer); } I am not sure about the the second parameter. What sort of codec or what exactly it does... I am a n00B in this. Any suggestions?

    Read the article

  • iPhone and OpenCV

    - by gn-mithun
    Hello, I am writing an application to create a movie file from a bunch of images on an iPhone. I am using OpenCv. I downloaded openCv static libraries for arm(iPhones native instruction architecture) and the libraries were generated just fine. There were no problems linking to them libraries. As a first step, i was trying to create a .avi file using one image, to see if it works. But cvCreateVideoWriter always returns me a NULL value. I did some searchin and i believe its due to the codec not being present. I am trying this on the iPhone simulator. this is what i do... (void)viewDidLoad { [super viewDidLoad]; UIImage *anImage = [UIImage imageNamed:@"1.jpg"]; IplImage *img_color = [self CreateIplImageFromUIImage:anImage]; //The image gets created just fine CvVideoWriter *writer = cvCreateVideoWriter("out.avi",CV_FOURCC('P','I','M','1'), 25,cvSize(320,480),1); //writer is always null int result = cvWriteFrame(writer, img_color); NSLog(@"\n%d",result); //hence this is also 0 all the time cvReleaseVideoWriter(&writer); } I am not sure about the the second parameter. What sort of codec or what exactly it does... I am a n00B in this. Any suggestions?

    Read the article

  • Draw fitted line (OpenCV)

    - by Sunny
    I'm using OpenCV to fit a line from a set of points using cvFitLine() cvFitLine() returns a normalized vector that is co-linear to the line and a point on the line. See details here Using this information how can I get the equation of a line so that I can draw the line?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >