I'm trying to convert my MATLAB code to Python.
In MATLAB I have OP which is a 300x300 double array and mask which is 300x300 logical array.
t1 = mask(:) equals 90000x1 logical array.
How is it possible that the output of t2 = OP(mask(:)) equals to a 57664x1 double array?
Here my MATLAB code :
OP=repmat(Ph,size(image,1),1).*repmat(Pv,1,size(image,2));
t1 = mask(:)
t2 = OP(mask(:))
data=sort(OP(mask(:)),'descend');
Also, in Python I use Numpy to implement my MATLAB code but OP[mask] which is MATLAB converted OP(mask(:)) is a 90000x1x300 ndarray. I don't know how to fix it.
Here my python code:
OP = np.matlib.repmat(Ph, image.shape[0], 1) * np.matlib.repmat(Pv, 1, image.shape[1])
t2 = OP[mask]
data = -np.sort(-OP[mask], axis=0)
I know that t1, OP and mask have the same size as its similar variable in MATLAB.
I would be appreciative if anybody could help me.