What is the difference between mat and matND?
opencv, python
Solution
It seems there is no more differences between Mat and MatND. MatND is now obsolete.
By looking at opencv2/core.hpp (version 2.4.8):
typedef Mat MatND;
Problem
I am trying to extract data from a binary mask. All goes well but changing to python will cause the data to shift a few pixels. It is enough so I cannot find the center. However saving the image will oldly enough display the pixels at the correct location Here is my code. I basically create a normal mat to use as output. However a matnd is outputed according to the docs Am I extracting the data properly? If so tell me. I am trying to find the center given points along the center. I kidda dont want my data to be shifted. ``` import cv2.cv as cv def main(): imgColor = cv.LoadImage(OPTICIMAGE, cv.CV_LOAD_IMAGE_COLOR) center, radius = centerandradus(imgColor) def centerandradus(cvImg, ColorLower=None,ColorUpper=None): lowerBound = cv.Scalar(130, 0, 130); upperBound = cv.Scalar(171, 80, 171); size = cv.GetSize(cvImg) output = cv.CreateMat(size[0],size[1],cv.CV_8UC1) cv.InRangeS(cvImg, lowerBound, upperBound,output) mask = np.asarray( output[:,:] ) x,y = np.nonzero(mask) x, y = np.array(x),np.array(y) h,k = centerEstimate(x,y) return np.array([h,k]), radius def centerEstimate(xList,yList): x_m = np.mean( np.r_[xList]) y_m = np.mean( np.r_[yList]) return x_m, y_m ``` Edit: I think it the problem with matND, since i notice the data is already shifted when I try to print out the data. If you need any more information please ask Thank You for your time