1

enter image description here

I want to generate a JPEG from a GeoTIFF file which has a stack of RGB bands. Considering the JPEG won't necessarily have any geo-referencing information about any pixels, how do I get rid of the black borders? I want the data-pixels(the colored ones here) to fit the frame as a rectangle.

I have experimented that the angle of inclination increases as we go to the polar regions from equator.

4
  • Rotate the canvas gis.stackexchange.com/questions/104143/… then export the map docs.qgis.org/2.18/en/docs/user_manual/print_composer/… to JPEG. Commented Jul 20, 2020 at 1:47
  • That's new for me, thank you. But I wanted to do it with a Python Script, for example if I could calculate the degree of rotation with coordinates or (row/path) combination. Commented Jul 20, 2020 at 6:03
  • I'm sure that it would be possible, the orbit of the satellite is standard and you should be able to get that from somewhere.. NASA would be a place to start, they track lots of junk in orbit and are fairly good with open data. Intersect the orbit with your raster extent then calculate the degrees to rotate from the line. I can remember something like this coming up many years ago to auto mask the 0's around the outside without masking the valid 0's within the image area which ended up working, unfortunately it was a coworkers code so I only know a little bit about how he achieved it. Commented Jul 20, 2020 at 7:43
  • Right, I will keep searching, thank you for the input. For now, I can correct the generated 'JPEG' image with this link pyimagesearch.com/2017/02/20/text-skew-correction-opencv-python Commented Jul 20, 2020 at 14:14

1 Answer 1

1

https://www.pyimagesearch.com/2017/02/20/text-skew-correction-opencv-python/

^ one can follow the same algorithm to correct geotiff image's orientation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.