473,563 Members | 2,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

trouble calling OpenCV cvFitLine

1 New Member
I am trying to use the OpenCV cvFitLine() function using the Python SWIG interface to OpenCV. My problem has to do with the fact that the last argument is a pointer to an array of four floats (to return the fitted line parameters). My first mindless attempt looked like this:

Expand|Select|Wrap|Line Numbers
  1. line = []
  2. cv.cvFitLine(img, cv.CV_DIST_L2, 0, 0.01, 0.01, line)
This produced the error:

TypeError: in method 'cvFitLine', argument 6 of type 'float *'
After googling around bit, I decided that ctypes would give me the array pointer that I needed, so I modified my code as follows:

Expand|Select|Wrap|Line Numbers
  1. FourFloats = ctypes.c_float * 4
  2. line = FourFloats()
  3. cv.cvFitLine(img, cv.CV_DIST_L2, 0, 0.01, 0.01, ctypes.byref(line))
But this produced the same error. I'm stuck. Can someone please point me in the right direction?


Thanks...
Dec 23 '08 #1
0 2050

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4653
by: Claudio Grondi | last post by:
What is the current status of Python OpenCV interface i.e. the opencv module? \OpenCV\samples\python\contours.py gives following ERROR: OpenCV Python version of contours Traceback (most recent call last): File "\OpenCV\samples\python\contours.py", line 6, in ? from opencv import cv ImportError: No module named opencv
1
2807
by: Claudio Grondi | last post by:
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of C functions and a few C++ classes that implement some popular Image Processing and Computer Vision algorithms. OpenCV library is mainly aimed at real time computer vision. Some example areas would be Human-Computer Interaction (HCI); Object Identification,...
3
4982
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function...
0
3329
by: mkd | last post by:
Hi there To compile opencv I need to use: g++ `pkg-config --cflags opencv` -o face face.c `pkg-config --libs opencv` Now I want to compile in KDevelop, but it chooses gcc instead Does anyone know, how to change the compiler used by KDevelop ?
3
10413
by: jlark | last post by:
Hello, I have just started working with opencv in python for my undergrad thesis. Im Trying to build a simple GUI which supports mouse inputs on an image. This is fairly simple in C and C++ , since there are tons of documentations for opencv funtions in that area. Anyway here is the problem. Im trying to create a mouse listener which is...
4
4962
by: hhx83 | last post by:
I'm trying to develop a MFC C++ app. How do you grab frames using Matrox ActiveMIL-lite library, and display using OpenCV where I can then use the image to do face detection? Hope someone can adivse me on that~
4
11977
by: kurapix | last post by:
Hi there!!! I've been working on recognizing EAN barcodes from images. Yes it's about recognizing barcodes from images but from bars not from the digit with the help of OCR software but with "Open Computer Vision library" (OpenCV). I haven't been successful yet. Here is my idea at how I should do it : - Image capture
1
2831
by: aneuryzma | last post by:
Hi guys, I'm doing a project with both ogre3d and openCV and now I have to merge the code. I have 2 Visual C++ solutions and either of them has his own configuration. Can you give me some suggestion on how to merge the two solutions and use both libraries together ? thanks!
2
2365
by: aneuryzma | last post by:
Hi guys, I'm doing a project with both ogre3d and openCV and now I have to merge the code. I have 2 Visual C++ solutions and either of them has his own configuration. Can you give me some suggestion on how to merge the two solutions and use both libraries together ? thanks!
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.