X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=interfaces%2Fswig%2Fpython%2Fadaptors.py;fp=interfaces%2Fswig%2Fpython%2Fadaptors.py;h=22e864d9e1fc6beb6d2d59b7eff9082bd454f19b;hb=80cd7b93506cc1926882d5fd08a2c74ee9359e29;hp=b56ae509f42538c6eb132b1dd398df2c975fc5e9;hpb=467a270adf12425827305759c0c4ea8f5b2b3854;p=opencv diff --git a/interfaces/swig/python/adaptors.py b/interfaces/swig/python/adaptors.py index b56ae50..22e864d 100644 --- a/interfaces/swig/python/adaptors.py +++ b/interfaces/swig/python/adaptors.py @@ -203,7 +203,7 @@ try: raise ValueError, 'Unknown or unsupported input mode' result = cv.cvCreateImage( - cv.cvSize(input.shape[0], input.shape[1]), # size + cv.cvSize(input.shape[1], input.shape[0]), # size depth, # depth channels # channels ) @@ -248,13 +248,13 @@ try: # Get the numpy array and reshape it correctly if input.nChannels == 1: array_1d = numpy.fromstring(input.imageData, dtype=ipl2dtype[key]) - return numpy.reshape(array_1d, (input.width, input.height)) + return numpy.reshape(array_1d, (input.height, input.width)) elif input.nChannels == 3: # Change the order of channels from BGR to RGB rgb = cv.cvCreateImage(cv.cvSize(input.width, input.height), input.depth, 3) cv.cvCvtColor(input, rgb, cv.CV_BGR2RGB) array_1d = numpy.fromstring(rgb.imageData, dtype=ipl2dtype[key]) - return numpy.reshape(array_1d, (input.width, input.height, 3)) + return numpy.reshape(array_1d, (input.height, input.width, 3)) except ImportError: pass