nagyistoce / pyopencv

Automatically exported from code.google.com/p/pyopencv
0 stars 0 forks source link

getAffineTransform() does't works #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
>>> What steps will reproduce the problem?

import pyopencv as cv
a = [cv.Point(0,0),cv.Point(1,0),cv.Point(0,1)]
b = [cv.Point(0,0),cv.Point(1,0),cv.Point(0,1)]
m = cv.getAffineTransform(a,b)
print m

When run the program, I got following error:

Traceback (most recent call last):
  File "xxx.py", line 4, in <module>
    m = cv.getAffineTransform(a,b)
TypeError: No registered converter was able to extract a C++ reference to 
type cv::Mat from this Python object of type list

>>> What is the expected output? What do you see instead?

output a Mat object.

>>> What version of the product are you using? On what operating system?

Windows XP, Version: 2.1.0.wr1.0.2

>>> Please provide any additional information below.

the document string shows that getAffineTransform() will get two list of 
Point2f object, and return a object.

>>> cv.getAffineTransform?
Type:           function
Base Class:     <type 'builtin_function_or_method'>
String Form:    <Boost.Python.function object at 0x00CEB500>
Namespace:      Interactive
Docstring:
    getAffineTransform( (list)src, (list)dst) -> object :

    Argument 'src':
        C/C++ type: ::cv::Point2f const *.
        Python type: Python sequence with elements of C++ type 
'::cv::Point_<
        float >'.
    Argument 'dst':
        C/C++ type: ::cv::Point2f const *.
        Python type: Python sequence with elements of C++ type 
'::cv::Point_<
        float >'.

    C++ signature :
        boost::python::api::object 
getAffineTransform(boost::python::list,boost::python::list)

Original issue reported on code.google.com by ruoyu0...@gmail.com on 28 May 2010 at 2:28

GoogleCodeExporter commented 9 years ago
Hi,

Class Point2f is different from class Point. Can you replace cv.Point with 
cv.Point2f
and see if it works?

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 28 May 2010 at 4:00

GoogleCodeExporter commented 9 years ago
I changed to following code, but the same error:

import pyopencv as cv
a = [cv.Point2f(0,0),cv.Point2f(1,0),cv.Point2f(0,1)]
b = [cv.Point2f(0,0),cv.Point2f(1,0),cv.Point2f(0,1)]
m = cv.getAffineTransform(a,b)
print m

Original comment by ruoyu0...@gmail.com on 28 May 2010 at 10:39

GoogleCodeExporter commented 9 years ago
Thanks. I'll take a look. I'm a bit too busy now and have made some changes to 
the
getAffineTransform() function recently.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 28 May 2010 at 10:52

GoogleCodeExporter commented 9 years ago

Original comment by pmtri80@gmail.com on 28 May 2010 at 10:52

GoogleCodeExporter commented 9 years ago
Hi,

I just tested and would like to confirm the bug. I will fix it in the next 
release.
Thanks for filing the issue.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 28 May 2010 at 11:14

GoogleCodeExporter commented 9 years ago
I have fixed the bug in the main trunk. However, in the current version, a 
number of function calling sequences have been modified. These changes are 
necessary for the future. For example, your code is now runnable if you use a 
cv.vector_Point2f instead of a Python list:

import pyopencv as cv
a = cv.vector_Point2f([cv.Point2f(0,0),cv.Point2f(1,0),cv.Point2f(0,1)])
b = cv.vector_Point2f([cv.Point2f(0,0),cv.Point2f(1,0),cv.Point2f(0,1)])
m = cv.getAffineTransform(a,b)
print m

Minh-Tri

Original comment by pmtri80@gmail.com on 16 Jul 2010 at 2:40