Skip to content

Commit

Permalink
Add back in the code that saves the 16bit grayscale png (#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezward authored Mar 6, 2023
1 parent 08adc76 commit 41b326d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions donkeycar/parts/tub_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def write_record(self, record=None):
image_path = os.path.join(self.images_base_path, name)
image.save(image_path)
contents[key] = name
elif input_type == 'gray16_array':
# save np.uint16 as a 16bit png
image = Image.fromarray(np.uint16(value))
name = Tub._image_file_name(self.manifest.current_index, key, ext='.png')
image_path = os.path.join(self.images_base_path, name)
image.save(image_path)
contents[key]=name

# Private properties
contents['_timestamp_ms'] = int(round(time.time() * 1000))
Expand Down

1 comment on commit 41b326d

@Ahrovan
Copy link

@Ahrovan Ahrovan commented on 41b326d Mar 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ezward

    def write_record(self, record=None):
        ...
        name = Tub._image_file_name(self.manifest.current_index, key, ext='.png')
        ...

    def _image_file_name(cls, index, key, extension='.jpg'):
        ...

I think ext='.png' need to change extension='.png'. just check. i see error when check this one

Please sign in to comment.