Commit c172d0cc authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Fix cropping

parent de560cfb
Pipeline #14534 passed with stages
in 19 minutes and 16 seconds
......@@ -49,7 +49,11 @@ class Database(FileListPadDatabase):
# crop frames to 720 x 1024
h, w = numpy.shape(frame)[-2:]
dh, dw = (h - 720) // 2, (w - 1024) // 2
frame = frame[:, dh:-dh, dw:-dw]
if dh != 0:
frame = frame[:, dh:-dh, :]
if dw != 0:
frame = frame[:, :, dw:-dw]
assert frame.shape == self.frame_shape, frame.shape
yield frame
def number_of_frames(self, padfile):
......
......@@ -38,3 +38,5 @@ def test_frames():
"way we can test more features of the database interface.")
padfile = db.all_files(('train', 'dev'))[0][0]
assert db.number_of_frames(padfile) == 270, db.number_of_frames(padfile)
frame = next(db.frames(padfile))
assert db.frame_shape == frame.shape, frame.shape
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