-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Description
Hi,
when trying to retrieve the data from a depth map via PyMat.get_data(), the return data type is derived incorrectly. I've traced it down to these lines in pyzed/core.pyx:
391: if self.mat.getDataType() == MAT_TYPE_8U_C1 or MAT_TYPE_8U_C2 or MAT_TYPE_8U_C3 or MAT_TYPE_8U_C4:
392: size = self.mat.getHeight()*self.mat.getWidth()*self.mat.getChannels()
393: dtype = np.uint8
394: elif self.mat.getDataType() == MAT_TYPE_32F_C1 or MAT_TYPE_32F_C2 or MAT_TYPE_32F_C3 or MAT_TYPE_32F_C4:
395: size = self.mat.getHeight()*self.mat.getWidth()*self.mat.getChannels()*sizeof(float)
396: dtype = np.float32
The comparison on line 391 always evaluate to True (the same holds for line 394, but that one is never executed). As a result, the size and type are calculated incorrectly for floating point data.
I suppose that was was really meant, is something like this:
391: if self.mat.getDataType() in (MAT_TYPE_8U_C1, MAT_TYPE_8U_C2, MAT_TYPE_8U_C3, MAT_TYPE_8U_C4):
...
394: elif self.mat.getDataType() in (MAT_TYPE_32F_C1, MAT_TYPE_32F_C2, MAT_TYPE_32F_C3, MAT_TYPE_32F_C4):
...
With this fix, I can retrieve the floating point depth map data correctly.
Best regards,
Eddy
Metadata
Metadata
Assignees
Labels
No labels