Bossgaming099 / ctypes-opencv

Automatically exported from code.google.com/p/ctypes-opencv
0 stars 0 forks source link

cvMat by Column Access #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a float matrix (M) using cvCreateMat
2. Access the matrix by column using M[:,col_idx]
3.

What is the expected output? What do you see instead?
For eg,
M = [0,1,2,3;
         4,5,6,7] with type CV_32FC1
M[:,0] gives [0;4] as expected, whereas M[:,i] i=1,2,3 gives wrong result.

What version of the product are you using? On what operating system?
Ctypes-0.7.2 & OpenCV 1.1.0 on Mac OS X

Please provide any additional information below.

Original issue reported on code.google.com by zhu....@gmail.com on 25 Feb 2009 at 3:38

GoogleCodeExporter commented 8 years ago
Thank you for having raised the issue. I can reproduce the problem. I will fix 
it as
soon as I can. Meanwhile, here is the quick fix on your installation:

1) Open file cxcore.py in ctypes-opencv's installation folder (i.e. <python's 
Lib
folder>/site-packages/opencv)
2) Replace line 743 containing:
        data_address = addressof(self.data.ptr.contents)+self.step*sy.start+sx.start
with:
        datatype = type2ctype(self.type)
        data_address =
addressof(self.data.ptr.contents)+self.step*sy.start+sx.start*sizeof(datatype)

It should solve the problem.

Minh-Tri

Original comment by pmtri80@gmail.com on 25 Feb 2009 at 4:32

GoogleCodeExporter commented 8 years ago
I applied the patch you suggested and it works like a charm.

Many thanks for creating this great wrapper and actively maintaining it.  It 
has really saved me from a hell of a 
mess dealing with the SWIG wrapper...

Original comment by zhu....@gmail.com on 25 Feb 2009 at 5:10

GoogleCodeExporter commented 8 years ago
Fixed. Thanks.

Original comment by pmtri80@gmail.com on 5 Apr 2009 at 6:49