IS-AgroSmart / AgroSmart-Web

1 stars 1 forks source link

Creating annotated orthomosaic fails when orthomosaic is too big #121

Closed jreyesr closed 3 years ago

jreyesr commented 3 years ago

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 the try_create_thumbnail method, only that the size will be different.

jreyesr commented 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.