Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.
-
Upload
lesley-freeman -
Category
Documents
-
view
217 -
download
5
Transcript of Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.
![Page 1: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/1.jpg)
Rolando V. Raqueño Friday, April 21, 202311
Mystery Images
![Page 2: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/2.jpg)
Rolando V. Raqueño Friday, April 21, 202322
Given an image of unknown origin
• Dimensions of the image?– Most importantly the number of samples
• Aspect ratio of the image? • Number of bytes per pixel?• Number of bands of the image?• Number of bits per pixel?• External or internal compression applied
– gzip– tiff or jpeg
![Page 3: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/3.jpg)
Rolando V. Raqueño Friday, April 21, 202333
Know the imaging instrument
• Find out what kind of image capture device– Framing Camera with filters
• Band Sequential Images (BSQ)
– Flatbed of Pushbroom scanner• Band interleaved by line (BIL)
– Line Scanner• Band interleaved by pixel (BIP)
![Page 4: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/4.jpg)
Rolando V. Raqueño Friday, April 21, 202344
Tools at your disposal for dissecting the image
% file% anytopnm % more% ls -l% bc -l% od% dd% strings% rawtopgm or cat% xv
![Page 5: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/5.jpg)
Rolando V. Raqueño Friday, April 21, 202355
file
• Uses information in /etc/magic to determine the type of a file.
• Common outputs from the file command% file irod.img.gz
irod.img.gz: gzip compressed data - deflate method , original file name , max compression
% file readme
readme: ascii text
![Page 6: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/6.jpg)
Rolando V. Raqueño Friday, April 21, 202366
File (more examples)
% file RIT_bip.imgRIT_bip.img: data
% file modtran4.batmodtran4.bat: executable c-shell script
bean% file maincode.exemaincode.exe: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped
![Page 7: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/7.jpg)
Rolando V. Raqueño Friday, April 21, 202377
File (image examples)Don’t always believe the extensions
bean% file feep.tif
feep.tif: TIFF file, big-endian
bean% file feep.pgm
feep.pgm: PGM ascii file
bean% file AVIRIS_RIT.jpg
AVIRIS_RIT.jpg: JPEG file
bean% file rotate.pbm
rotate.pbm: PGM raw file
![Page 8: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/8.jpg)
Rolando V. Raqueño Friday, April 21, 202388
anytopnm
• Shell script that does a brute force test on images and converts to pnm format
% anytopnm mystery_file > mystery_file.pnm
![Page 9: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/9.jpg)
Rolando V. Raqueño Friday, April 21, 202399
od
• Can be used to quickly check the minimum and maximum values in a file
• Stupid UNIX Trick% od –d –v image.raw | cut –c10- | tr –s “ “ “\012” | sort –nu | head
![Page 10: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/10.jpg)
Rolando V. Raqueño Friday, April 21, 20231010
Xv and NetPBM
• Xv want multi-byte NetPBM files in little-endian form
• N.B. NetPBM utilities behave inconsistently for multi-byte data
![Page 11: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/11.jpg)
Rolando V. Raqueño Friday, April 21, 20231111
Can you guess the dimensions of the image?
• Try to guess the number of rows (width) first.– Possible guesses
•256•512•2^n•2^n+2^(n-1)
![Page 12: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/12.jpg)
Rolando V. Raqueño Friday, April 21, 20231212
Can you guess the aspect ratio of the image?
• wc -c or ls -l – determine how many bytes are in the image
• Square root of the image size – Multiple of a perfect square
• Assume that the image is greyscale & square– use rawtopgm
% rawtopgm 512 512 image.raw > image.pgm
![Page 13: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/13.jpg)
Rolando V. Raqueño Friday, April 21, 20231313
Square Gray Scale Image
• Used rawtopgm to create a pgm file and then use xv to display
![Page 14: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/14.jpg)
Rolando V. Raqueño Friday, April 21, 20231414
A convenient little trick
• If you are just experimenting with a mystery image
% rawtopgm 512 512 image.raw | xv -
![Page 15: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/15.jpg)
Rolando V. Raqueño Friday, April 21, 20231515
Does it have a header?
• Not a perfect square– go ahead and try to display it as if it were a
square image to see if it has a header.
![Page 16: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/16.jpg)
Rolando V. Raqueño Friday, April 21, 20231616
Square Grey Scale image with a header
• This structure means you have a header in the file that is causing a uniform shift
• You can fix this by using dd
![Page 17: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/17.jpg)
Rolando V. Raqueño Friday, April 21, 20231717
Square image no header
• Your guess on the width of the image is short by one pixel
![Page 18: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/18.jpg)
Rolando V. Raqueño Friday, April 21, 20231818
Square image no header
• Your guess on the width of the image is long by one pixel
![Page 19: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/19.jpg)
Rolando V. Raqueño Friday, April 21, 20231919
Square image no header
• You probably guessed a little too low on the width of this image
• (off by 6 pixels)
![Page 20: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/20.jpg)
Rolando V. Raqueño Friday, April 21, 20232020
Square Image with no header
• Your probably guessed a little too high on the width of the image
• (off by 6 pixels)
![Page 21: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/21.jpg)
Rolando V. Raqueño Friday, April 21, 20232121
A color image displayed as greyscale image
• Correct dimensions– 256x256x3 BIP
• Incorrectly assumed– 443x443 image with
header
• N.B. 196608/3=256^2
• Indicates a multiband image
![Page 22: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/22.jpg)
Rolando V. Raqueño Friday, April 21, 20232222
Multiband Assumption
• Once multiband image is assumed– Need to determine interleaving– Can be deduced by displaying first band– This assumes you have a guess of image
dimension
• Extract the first band out using dd
![Page 23: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/23.jpg)
Rolando V. Raqueño Friday, April 21, 20232323
First band of color image file assumed to be BSQ
• Assume a square image for first band
• Color image file obviously not BSQ
![Page 24: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/24.jpg)
Rolando V. Raqueño Friday, April 21, 20232424
Square color image displayed as a greyscale (3:1 aspect ratio)
• Original image 3x256x256
• Displayed it as a greyscale 768x256
• To get insight into interleaving structure.
• BIP file would look like the left image
![Page 25: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/25.jpg)
Rolando V. Raqueño Friday, April 21, 20232525
Square color image displayed as greyscale( 3:1 aspect ratio)
• This is how a BIL image would behave• What we have here is the individual bands
side by side
![Page 26: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/26.jpg)
Rolando V. Raqueño Friday, April 21, 20232626
• This is how a BSQ file would behave
Square color image displayed as greyscale( 3:1 aspect ratio)
![Page 27: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/27.jpg)
Rolando V. Raqueño Friday, April 21, 20232727
Multibyte pixel image
• Need to be careful about the endian of the machine on which the image was written
• Can use dd to swap bytes for short integer images (2-bytes per pixel) or the swap_endian function in IDL
![Page 28: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/28.jpg)
Rolando V. Raqueño Friday, April 21, 20232828
Useful IDL command for image dimension analysis
• Key goal is to find integer dimensions
• Example– You know a given size (pixels, bytes, lines)– Need to find an integer number that “fits”
with the sizes you are observing
• Minimize trial and error using the following IDL commands
![Page 29: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/29.jpg)
Rolando V. Raqueño Friday, April 21, 20232929
You know one dimension…
• One dimension is 384 lines/samples• You have 588640 pixels• Find candidate integer dimension
IDL> a=findgen(384)IDL> b=588640 mod aIDL> c=where(b eq 0)IDL> print,a(c) 1.00000 2.00000 4.00000 5.00000 8.00000 10.0000 13.0000 16.0000 20.0000 26.0000 32.0000 40.0000 52.0000 65.0000 80.0000 104.000 130.000 160.000 208.000 260.000 283.000
![Page 30: Rolando V. RaqueñoSunday, December 20, 2015 1 Mystery Images.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfd41a28abf838cacbe6/html5/thumbnails/30.jpg)
Rolando V. Raqueño Friday, April 21, 20233030
Mystery Image Examples
• Check Wiki for sources of examples.– Keyword: mystery image