There seems to be a bug in the metadata output of WaggleExportPipeline.prepare_export() in wdd/export.py. The metadata fiels roi_coordinates and roi_center incrorectly apply a pad_size offset even though the coordinates already reflect a padded region around the ROI center.
Here, the offset is applied correctly to create a padded ROI:
|
roi_x0, roi_x1 = center_x - self.pad_size, center_x + self.pad_size |
|
roi_y0, roi_y1 = center_y - self.pad_size, center_y + self.pad_size |
Here, pad_size is subtracted again causing a shift of the ROI to the left and up:
|
metadata = { |
|
"roi_coordinates": [[roi_x0 - self.pad_size, roi_y0 - self.pad_size], [roi_x1 - self.pad_size, roi_y1 - self.pad_size]], |
|
"roi_center": [center_x - self.pad_size, center_y - self.pad_size], |
Example (waggle_id: 11722893616117486698):
"roi_coordinates": [[458, -132], [708, 118]]
"roi_center": [583, -7]
"x_coordinates": [716.0, 716.0, 714.0, 714.56, ...]
"y_coordinates": [123.25966850828729, 123.25966850828729, ...]
The values x_coordinates and y_coordinates are not within the ROI as described by roi_coordinates.
This image shows the visible region in the video snippet:

This image shows the ROI as given by roi_coordinates (labeled "Original") and the ROI with pad_size added to the coordinates to neutralize the problematic subtraction (labeled "Fixed"):

There seems to be a bug in the metadata output of
WaggleExportPipeline.prepare_export()inwdd/export.py. The metadata fielsroi_coordinatesandroi_centerincrorectly apply apad_sizeoffset even though the coordinates already reflect a padded region around the ROI center.Here, the offset is applied correctly to create a padded ROI:
bb_wdd2/wdd/export.py
Lines 289 to 290 in 0d25954
Here,
pad_sizeis subtracted again causing a shift of the ROI to the left and up:bb_wdd2/wdd/export.py
Lines 321 to 323 in 0d25954
Example (waggle_id: 11722893616117486698):
"roi_coordinates": [[458, -132], [708, 118]]"roi_center": [583, -7]"x_coordinates": [716.0, 716.0, 714.0, 714.56, ...]"y_coordinates": [123.25966850828729, 123.25966850828729, ...]The values
x_coordinatesandy_coordinatesare not within the ROI as described byroi_coordinates.This image shows the visible region in the video snippet:

This image shows the ROI as given by

roi_coordinates(labeled "Original") and the ROI withpad_sizeadded to the coordinates to neutralize the problematic subtraction (labeled "Fixed"):