Closed jreyesr closed 3 years ago
Expected result: a file odm_orthophoto_small.png
will be created on flights/uuid/odm_orthophoto
. The file will have a 1080px (or thereabouts?) vertical resolution. Since the file will be smaller (and, more importantly, its size will be constant even if the input orthomosaic is huge) the annotated orthomosaic creation will succeed. The annotated orthomosaic will obviously have a 1080px vertical res too, but it is only used on the report, so it should be Good Enough (TM) to be rendered on a PDF.
This issue is linked to https://github.com/IS-AgroSmart/AgroSmart-Web/issues/100, but it's not the same.
When the original orthomosaic is too big (tested on a 1.1GB orthomosaic), the Django server crashes when creating the annotated orthomosaic (the one with the snapshot locations). Probably due to lack of memory or some obscure bug in Matplotlib/Pillow/Numpy/whatever.
Suggested fix: creating a smaller version of the orthomosaic (say, 1080px high and whatever width is required to match), call it
odm_orthophoto_small.png
and using that version to create the annotation. That code may be quite similar to thetry_create_thumbnail
method, only that the size will be different._create_png_orthomosaic(self, height, out_name)
that invokes the commandf"gdal_translate -of PNG -outsize 0 {height} {self.get_disk_path()}/odm_orthophoto/rgb.tif {out_name}"
try_create_thumbnail
to call_create_png_orthomosaic(512, self.get_thumbnail_path())
get_small_path(self)
with contentreturn self.get_disk_path() + "/odm_orthophoto/odm_orthophoto_small.png"
try_create_annotated_png_ortho
:_create_png_orthomosaic(1080, self.get_small_path())
im = plt.imread(self.get_png_ortho_path())
ontry_create_annotated_png_ortho
to instead beim = plt.imread(self.get_small_path())