DOI-USGS / knoten

Python Geospatial Sensor Exploitation Library
Other
3 stars 21 forks source link

Read ASP generated CSM json as a camera model and then use Knoten's functions #115

Closed ShashankBice closed 6 months ago

ShashankBice commented 10 months ago

Hi folks, Is there a way we can load the CSM camera model written by Ames Stereo Pipeline in .json format as camera models so that we can then make use of Knoten's function such as generate image boundary and others?

I am primarily interested in reading CSM model files which ASP can now generate for Earth orbiting satellites with Linescan cameras. In the knoten example notebooks I see many times the csm camera object is created from the image file itself. The CSM model files for the Earth satellites follow all specs of the USGS CSM model, so if there is a handy function which creates a csm camera object from the json file written by ASP for non-Earth cameras, that could be easily used for reading the same from Earth cameras. Please let me know if this possible :blush:

A disclaimer, I have very little familiarity with non-Earth data and the USGS CSM api in general, so apologies in advance if there is a basic resource somewhere which I am unaware of.

Thanks, Shashank

jlaura commented 10 months ago

@ShashankBice This is a great question. I am going to work up a tutorial today that shows how to do this using knoten/USGSCSM for ASP generated state files. Would you be up for posting an ASP generated terrestrial state file (the JSON file that ASP output)? I would be happy to test/use a terrestrial example.

ShashankBice commented 10 months ago

Hi Jay, Thank you so much:blush: In this folder, I have shared two sample CSM files for linescan and frame cameras generated using simulations.

Let me know how it goes, Cheers, Shashank

jlaura commented 10 months ago

Morning Shashank,

Here is a gist showing how to do the load from the state. I tested the line scan model that you sent.

https://gist.github.com/jlaura/2ea2924d26e9f8033c69270aab6355ce

Have a look at the last three cells. It appears that something is not correct with the sensor model. Perhaps that is expected as there is no distortion model supplied in the state file that you shared?

Best, Jay

ShashankBice commented 10 months ago

Hi Jay, Thank you so much for taking the time on working out an example :blush: I agree i2g and g2i should be equal. I quickly checked, if we provide a height above datum which is close to the approximate real height, the back and forth transformations become closer. I have seen this issue with other types of camera models as well (e.g., Rational Polynomial Cofficients). image

I will keep doing more checks and tests next week, and will get back to you on how those go, Thanks so much, Shashank

jlaura commented 6 months ago

This has been open for a while. I am going to close, just to clean up. If there is still an issue related to this, please reopen.

oleg-alexandrov commented 1 month ago

There is no such thing as "ASP generated CSM json". :) It is the usual model state file, as dumped by usgscsm.