IPB

Welcome Guest ( Log In | Register )

9 Pages V  « < 2 3 4 5 6 > »   
Reply to this topicStart new topic
IMG2PNG, PDS/FITS to PNG conversion
Bjorn Jonsson
post Feb 21 2011, 10:46 PM
Post #46


IMG to PNG GOD
****

Group: Moderator
Posts: 2250
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



QUOTE (elakdawalla @ Feb 10 2011, 05:29 PM) *
A couple of data sets that I have tried to work with recently that have been challenging are the NEAR MSI images and the LCROSS images

The old version of IMG2PNG doesn't correctly convert the LCROSS data. I actually wasn't 100% sure if the images were distorted 'by design' (I hadn't taken a look at technical details on the LCROSS data set) or if it was a problem with IMG2PNG. Now that I have seen LCROSS images from the new version (which converts them correctly) I know the answer: The old version is buggy.

I haven't tried converting NEAR MSI images yet.
Go to the top of the page
 
+Quote Post
elakdawalla
post Feb 21 2011, 10:55 PM
Post #47


Administrator
****

Group: Admin
Posts: 5172
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



The NEAR MSI images have non-square pixels, which is a challenge. It would be lovely to have an option to output files that were resampled to the smaller pixel dimension and had square pixels, but I know that IMG2PNG is a file format conversion/calibration application, not a resampling one. As an alternative, it'd be helpful to have the pixel dimensions of each image written to the log file or to a file metadata summary table so that it's easy to look up the pixel dimensions of the converted images when I want to resize them myself.


--------------------
My website - My Patreon - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post Feb 21 2011, 11:10 PM
Post #48


IMG to PNG GOD
****

Group: Moderator
Posts: 2250
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



Actually it's fairly trivial to add resampling code. I have it in another application already so it doesn't reqire a lot of new code. One of the goals when rewriting IMG2PNG was to make it fairly simple to add new processing steps so adding resampling isn't complicated.

Are you using NEAR images in FITS format or PDS format? When I looked at this data ages ago only FITS was available. I think I saw it in PDS format somewhere but I may be confusing it with something else.
Go to the top of the page
 
+Quote Post
elakdawalla
post Feb 22 2011, 01:37 AM
Post #49


Administrator
****

Group: Admin
Posts: 5172
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



It's FITS format: http://pdssbn.astro.umd.edu/NEARdb/msi/


--------------------
My website - My Patreon - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post Mar 21 2011, 06:52 PM
Post #50


IMG to PNG GOD
****

Group: Moderator
Posts: 2250
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



I'm now very close to finishing the new version of IMG2PNG. A beta version is now available here:

http://www.mmedia.is/bjj/utils/img2png/img2png_new.zip

This is an 'unofficial' version so there's no mention of it yet on the IMG2PNG page.
There are lots of improvements and even though this is a beta version I'm pretty sure it has fewer bugs than the old version. With the exception of a few new command line options the new version has the same user interface as the old one.

Some improvements:

(1) LRO WAC and NAC data is now correctly converted. The WAC framelets are automatically 'rearranged'. However, the distortion described in Fig. 3 at http://www.moonposter.ie/waced-moon.htm is not corrected but I may add that correction in a future version. To automatically correct the orientation of the images (flip horizontally and/or vertically) you need to download a recent version of the cumindex.tab (or index.tab for a subset of the data) file that comes together with the LRO imaging data and add a line to img2png.ini telling IMG2PNG where to find it, for example this:

lroc_index_file=P:\lro\index\CUMINDEX.TAB

(2) LCROSS data is now correctly converted. Some of the LCROSS images are actually tricolor images. Since IMG2PNG always outputs only grayscale images the resulting PNG image contains three images with channel 1 at the top, channel 2 in the middle and channel 3 at bottom.

(3) Doug 'discovered' that SMART-1 images couldn't be converted in the old version (see http://www.unmannedspaceflight.com/index.p...t&p=167207). The new version correctly converts this data. The bug mentioned by Ian in the message above Doug's message is also absent in the new version.

(4) The new version correctly handles a far greater number of 'variants' of PDS files than the old version. In particular files containing 4 byte floating numbers frequently didn't get correctly converted in the old version. IMG2PNG doesn't handle all possible variants of PDS files though.

(5) The black horizontal stripes that are sometimes present in Cassini and Voyager images can now be removed using a new command line option, -destripe. They are removed using linear interpolation. Linear interpolation is not optimal; in a future version a better (and more complex) algorithm will probably be used.

(6) Images with non-square pixels can now be resampled to square pixels using the -resample command line option. At present the NEAR MSI images are the only images that get resampled (this is because at present these are the only images I know of with non-square pixels).

(7) The filter name(s) can now be included in the output filename using the -fnamefilter command line option and the observation id using the -fnameobs command line options.

(8) Calibration files can now be specified using the new command line option -calib. This is implemented as suggested in machi's post: http://www.unmannedspaceflight.com/index.p...st&p=170463
So if you have a file named flat.txt (as in machi's example) use "-calibflat.txt". If this option is used the bias and darkframe are subtracted from the image and the result then divided by the flatfield. Individual calibration files are optional so you can for example omit bias correction by omitting the "b=" line (or commenting it out by prefixing the line with ; or #). If the input image is 8 bit it is converted to 16 bits before calibrating.

(9) I corrected a very minor bug in the Cassini calibration. The effects of the bug were extremely small so I don't think this is of any importance for the the typical users of IMG2PNG.


And that's it.

But - as mentioned previously - this new version is far easier to maintain and modify than the old version. So I will probably be adding new features. In particular, in a future version it will be possible to remove reseau marks from Mariner 9/10, Viking and Voyager images and correction for geometric distortion in the Voyager images is something that may appear in a future version.
Go to the top of the page
 
+Quote Post
S_Walker
post May 24 2011, 04:10 PM
Post #51


Junior Member
**

Group: Members
Posts: 94
Joined: 15-October 09
Member No.: 4979



QUOTE (elakdawalla @ May 23 2011, 11:15 PM) *
Speaking of which, that data is now public (part of the last PDS release) and is much better in that format than the raw JPEG format, but no one has yet stepped forward to redo that awesome group effort version of the image....


Sorry if this is a newbie question, but is the IMG files on the latest PDS release 8 or 16-bit? I try using IMG2PNG with all the cassini calibration files in place, yet running N1652854565_1.IMG through IMG2PNG produces an 8-bit PNG file that is still loaded with cosmic ray hits and banding... I must be doing something wrong. I also downloaded N1652854565_1.LBL, but am unsure what to do with it.

Again, sorry for the noob questions...
Go to the top of the page
 
+Quote Post
Juramike
post May 24 2011, 05:12 PM
Post #52


Senior Member
****

Group: Moderator
Posts: 2785
Joined: 10-November 06
From: Pasadena, CA
Member No.: 1345



If you use OPUS, are those already "scrubbed" and recalibrated?




--------------------
Some higher resolution images available at my photostream: http://www.flickr.com/photos/31678681@N07/
Go to the top of the page
 
+Quote Post
S_Walker
post May 24 2011, 05:46 PM
Post #53


Junior Member
**

Group: Members
Posts: 94
Joined: 15-October 09
Member No.: 4979



QUOTE (Juramike @ May 24 2011, 01:12 PM) *
If you use OPUS, are those already "scrubbed" and recalibrated?

What is OPUS? But perhaps you are right, they could be already calibrated. I was hoping to get the raw 16-bit data; is there somewhere else besides here that I should look?:
http://pds-imaging.jpl.nasa.gov/search/search.html#Results
Go to the top of the page
 
+Quote Post
ugordan
post May 24 2011, 05:55 PM
Post #54


Senior Member
****

Group: Members
Posts: 3648
Joined: 1-October 05
From: Croatia
Member No.: 523



No online data archive that I know of keeps calibrated Cassini imagery. If there were, the data certainly wouldn't be stored in 8 bit format.

You're probably just getting a PNG dump of the uncalibrated raw data that was stored in 8bit LUT format in the IMG (file size about 1MB).


--------------------
Go to the top of the page
 
+Quote Post
S_Walker
post May 24 2011, 06:02 PM
Post #55


Junior Member
**

Group: Members
Posts: 94
Joined: 15-October 09
Member No.: 4979



QUOTE (ugordan @ May 24 2011, 12:55 PM) *
No online data archive that I know of keeps calibrated Cassini imagery. If there were, the data certainly wouldn't be stored in 8 bit format.

You're probably just getting a PNG dump of the uncalibrated raw data that was stored in 8bit LUT format in the IMG (file size about 1MB).


Ok, that makes sense; N1652854565_1.IMG is definitely 1 MB. So am I simply looking in the wrong place? I'd love to have a go at the raw data for Enceladus and Titan. Really can't do much with the 8-bit data. I downloaded the data here:
http://pds-imaging.jpl.nasa.gov/data/cassi...815_1652951881/

Sorry for the thread-jack.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post May 24 2011, 06:08 PM
Post #56


IMG to PNG GOD
****

Group: Moderator
Posts: 2250
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



QUOTE (S_Walker @ May 24 2011, 04:10 PM) *
Sorry if this is a newbie question, but is the IMG files on the latest PDS release 8 or 16-bit? I try using IMG2PNG with all the cassini calibration files in place, yet running N1652854565_1.IMG through IMG2PNG produces an 8-bit PNG file that is still loaded with cosmic ray hits and banding... I must be doing something wrong. I also downloaded N1652854565_1.LBL, but am unsure what to do with it.

Again, sorry for the noob questions...

Calibrated Cassini PNG image files output by IMG2PNG are always 16 bit regardless of the bit depth of the source images. Do you get any warning about not finding the Cassini calibration files when you start IMG2PNG?
Go to the top of the page
 
+Quote Post
S_Walker
post May 24 2011, 06:15 PM
Post #57


Junior Member
**

Group: Members
Posts: 94
Joined: 15-October 09
Member No.: 4979



QUOTE (Bjorn Jonsson @ May 24 2011, 02:08 PM) *
Calibrated Cassini PNG image files output by IMG2PNG are always 16 bit regardless of the bit depth of the source images. Do you get any warning about not finding the Cassini calibration files when you start IMG2PNG?

Not sure; I can only run the program by dragging and dropping the file directly into IMG2PNG. It opens and closes far too fast for me to read what it's doing. If I simply double-click img2png.exe (or img2png_new.exe) it opens and closes in a fraction of a second on my win7 machine. Any suggestions on how to open it so I can type commands?
Go to the top of the page
 
+Quote Post
machi
post May 24 2011, 07:29 PM
Post #58


Member
***

Group: Members
Posts: 796
Joined: 27-February 08
From: Heart of Europe
Member No.: 4057



It's possible via start menu, possibly (I don't know exactly, because I have czech version) in this order: start menu -> all programs -> accessories
Then you must find this icon
Attached image(s)
Attached Image
 


--------------------
Go to the top of the page
 
+Quote Post
elakdawalla
post May 24 2011, 07:47 PM
Post #59


Administrator
****

Group: Admin
Posts: 5172
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



QUOTE (S_Walker @ May 24 2011, 10:15 AM) *
Not sure; I can only run the program by dragging and dropping the file directly into IMG2PNG. It opens and closes far too fast for me to read what it's doing. If I simply double-click img2png.exe (or img2png_new.exe) it opens and closes in a fraction of a second on my win7 machine. Any suggestions on how to open it so I can type commands?

IMG2PNG is a command-line program. You have to run it from a command prompt window (Start > All Programs > Accessories > Command Prompt) in order to access its various switches and do calibration. There's limited documentation on Bjorn's website -- go to http://www.mmedia.is/bjj/utils/img2png/ and skip down to the heading that says "How to use". To calibrate Cassini images, you'll need to follow the instructions in the section just above that. I was able to figure out how to do this from Bjorn's instructions on that page. I know Bjorn has it in his head to eventually write more thorough documentation, but that is one of the least fun things for a programmer to do, especially if English is not your first language!

By the way, calibration will never fix cosmic ray hits. It will only fix systematic, predictable issues like dark current, flat field, etc.


--------------------
My website - My Patreon - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post May 24 2011, 07:54 PM
Post #60


IMG to PNG GOD
****

Group: Moderator
Posts: 2250
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



I have 'moved' this discussion to private email correspondence and will probably be posting a summary here once the issue is resolved.

As Emily mentioned, the plan is to improve the documentation but yes, it's not exactly fun and also I was too busy finishing the Voyager 1 Jupiter approach movie (and now I'm working on a global DEM of Enceladus that is more fun too than writing manuals ;-).
Go to the top of the page
 
+Quote Post

9 Pages V  « < 2 3 4 5 6 > » 
Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 19th April 2024 - 09:54 AM
RULES AND GUIDELINES
Please read the Forum Rules and Guidelines before posting.

IMAGE COPYRIGHT
Images posted on UnmannedSpaceflight.com may be copyrighted. Do not reproduce without permission. Read here for further information on space images and copyright.

OPINIONS AND MODERATION
Opinions expressed on UnmannedSpaceflight.com are those of the individual posters and do not necessarily reflect the opinions of UnmannedSpaceflight.com or The Planetary Society. The all-volunteer UnmannedSpaceflight.com moderation team is wholly independent of The Planetary Society. The Planetary Society has no influence over decisions made by the UnmannedSpaceflight.com moderators.
SUPPORT THE FORUM
Unmannedspaceflight.com is funded by the Planetary Society. Please consider supporting our work and many other projects by donating to the Society or becoming a member.