Commit 30bb23ed authored by kulvait's avatar kulvait

writeFrame correction

parent cddf4ff6
......@@ -85,13 +85,14 @@ def writeFrame(fileName, k, data, force=False):
shape = data.shape
if len(shape) != 2:
raise ValueError('Dimension of data should be 2 %d.' % len(shape))
header = np.fromfile(file, np.dtype('<i2'), 3)
header = np.fromfile(fileName, np.dtype('<i2'), 3)
rows = np.uint32(header[0])
columns = np.uint32(header[1])
k = np.uint32(k)
if shape[0] != rows or shape[1] != columns:
raise ValueError('There is dimension mismatch between frame (%d, %d) and expected (rows, cols) = (%d, %d) according to header.' %
(rows, columns, shape[0], shape[1]))
f = open(file, "wb+")
f = open(file, "r+b")
data = np.array(data, np.dtype('<f4'))
data = data.reshape((rows * columns, ))
f.seek(6 + rows * columns * k * 4, os.SEEK_SET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment