Page 1 of 2

ortho-imagery

Posted: 2013-12-27T11:16:29-07:00
by EthanWilliams
Hello,
I am working with ortho-imagery and I need to work with .jp2 files. I Have converted the .jp2 file into a .tif file, but the image seems to have something weird going on. There seem to be two images that appear at different zoom levels. One with the color and information I need, but the one that appears when zoomed in all the way seems to be some sort of a mask. When I simply use the image to chop it up into separate 1024x1024 squares it uses the lower zoom level without any of the imagery that I need. How can I use the top zoom layer? I want to upload the image, but can't find a way on this forum. Can someone point me in the direction to upload it so you can see what I mean?

Re: ortho-imagery

Posted: 2013-12-27T11:57:55-07:00
by fmw42
upload your image to a free image hosting service such as dropbox.com and then put a link here to it.

also please identify your version of IM and platform and also your exact command lines for conversion and chopping it up

Re: ortho-imagery

Posted: 2013-12-27T12:06:15-07:00
by EthanWilliams
Thanks for the quick reply.
I'm using windows and the version is listed as ImageMagick-6.8.7-Q16. The conversion was not done in imagemagick, it was done in gdal (as it is a referenced image)
convert -crop 1024x1024 northisland.tif tiled_%d.tif

https://dl.dropboxusercontent.com/u/441 ... island.tif

Re: ortho-imagery

Posted: 2013-12-27T13:10:46-07:00
by fmw42
I only see one layer from IM -verbose information. The following command seems to work fine for me in IM 6.8.8.0 Q16 Mac OSX


convert northisland.tif -channel rgba -crop 1024x1024 +repage tiled_%d.tif

Proper IM 6 syntax is to read a raster image first before any subsequent commands such as -crop. I have specifically enabled the alpha channel which seems to be in your image and used +repage to reset the virtual canvas on each tile.

If this is not what you are trying to do, please clarify further.

Re: ortho-imagery

Posted: 2013-12-27T13:14:45-07:00
by fmw42
Perhaps you are seeing the alpha channel as the second image. If you want to disable the alpha channel and just use the underlying image, then do

convert northisland.tif -alpha off -crop 1024x1024 +repage tiled_%d.tif

If you need to keep the virtual canvas information, then leave +repage off


What tool are you using to zoom that is apparently giving you two images?

Re: ortho-imagery

Posted: 2013-12-27T13:19:33-07:00
by EthanWilliams
ah weird. I don't know why it still is not displaying correctly. What I want is a full color image like this: https://dl.dropboxusercontent.com/u/441 ... lcolor.PNG

But, what it is giving me is something like this (this is me zooming in on the image): https://dl.dropboxusercontent.com/u/441 ... tiwant.PNG

when I preform the convert command i get something like the latter.

Re: ortho-imagery

Posted: 2013-12-27T13:23:22-07:00
by EthanWilliams
I don't know if this helps, but from the .jp2 wiki it states the color space of the format is ycbcr. But, When I use the identify -verbose on the resultant tif it lists the color space as sRGB. And I am using the standard image preview program on windows 8, Windows Photo Viewer.

Re: ortho-imagery

Posted: 2013-12-27T14:42:35-07:00
by fmw42
I suspect that the conversion from jp2 to tiff is losing the ycbcr and just writing it as if the channels were sRGB or tiff does not support ycbcr colorspace. can you provide the original jp2 image?

EXIFTOOL says the photometric interpretation is 2 (RGB). It would need to say 6 (YCbCr). So it is getting lost in the conversion to tiff by whatever tool is converting from jp2 to tiff.

see
http://www.awaresystems.be/imaging/tiff ... ation.html

Re: ortho-imagery

Posted: 2013-12-27T14:44:38-07:00
by EthanWilliams
Yeah, here it is: https://dl.dropboxusercontent.com/u/441 ... island.jp2
I have tried converting that .jp2 with imagemagic, but I receive the error: identify.exe: unable to decode image file `.\b7.jp2' @ error/jp2.c/ReadJP2Image/403. (roughly that, Not my exact error as I am not at the computer that I work on)

Re: ortho-imagery

Posted: 2013-12-27T14:46:37-07:00
by fmw42
Never mind. I have downloaded it.

Re: ortho-imagery

Posted: 2013-12-27T14:48:01-07:00
by EthanWilliams

Re: ortho-imagery

Posted: 2013-12-27T14:58:39-07:00
by fmw42
I do not think your image is in a standard jp2 format. At least IM cannot validate it. I get verbose information with lots of warnings and then a grayscale image.
warning: not enough tile data (2 bytes)
...
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
warning: not enough tile data (2 bytes)
Image: northisland.jp2
Format: JP2 (JPEG-2000 File Format Syntax)
Mime type: image/jp2
Class: DirectClass
Geometry: 6270x7680+0+0
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Gray:
min: 0 (0)
max: 254 (0.996078)
mean: 49.2411 (0.193103)
standard deviation: 65.4672 (0.256734)
kurtosis: 1.36393
skewness: 1.74638
Colors: 255
Histogram:
106: ( 0, 0, 0) #000000 gray(0)
57: ( 1, 1, 1) #010101 gray(1)
64: ( 2, 2, 2) #020202 gray(2)
62: ( 3, 3, 3) #030303 gray(3)
71: ( 4, 4, 4) #040404 gray(4)
77: ( 5, 5, 5) #050505 gray(5)
143: ( 6, 6, 6) #060606 gray(6)
309: ( 7, 7, 7) #070707 gray(7)
586: ( 8, 8, 8) #080808 gray(8)
1817: ( 9, 9, 9) #090909 gray(9)
5926: ( 10, 10, 10) #0A0A0A gray(10)
30724: ( 11, 11, 11) #0B0B0B gray(11)
298404: ( 12, 12, 12) #0C0C0C gray(12)
1634906: ( 13, 13, 13) #0D0D0D gray(13)
3803520: ( 14, 14, 14) #0E0E0E gray(14)
8025222: ( 15, 15, 15) #0F0F0F gray(15)
9436658: ( 16, 16, 16) #101010 gray(16)
3950748: ( 17, 17, 17) #111111 gray(17)
1916936: ( 18, 18, 18) #121212 gray(18)
1693910: ( 19, 19, 19) #131313 gray(19)
1308022: ( 20, 20, 20) #141414 gray(20)
946959: ( 21, 21, 21) #151515 gray(21)
800826: ( 22, 22, 22) #161616 gray(22)
653431: ( 23, 23, 23) #171717 gray(23)
474725: ( 24, 24, 24) #181818 gray(24)
350189: ( 25, 25, 25) #191919 gray(25)
277699: ( 26, 26, 26) #1A1A1A gray(26)
231796: ( 27, 27, 27) #1B1B1B gray(27)
196709: ( 28, 28, 28) #1C1C1C gray(28)
172171: ( 29, 29, 29) #1D1D1D gray(29)
158120: ( 30, 30, 30) #1E1E1E gray(30)
145596: ( 31, 31, 31) #1F1F1F gray(31)
132300: ( 32, 32, 32) #202020 gray(32)
124148: ( 33, 33, 33) #212121 gray(33)
115156: ( 34, 34, 34) #222222 gray(34)
104323: ( 35, 35, 35) #232323 gray(35)
93893: ( 36, 36, 36) #242424 gray(36)
87714: ( 37, 37, 37) #252525 gray(37)
81499: ( 38, 38, 38) #262626 gray(38)
77869: ( 39, 39, 39) #272727 gray(39)
73122: ( 40, 40, 40) #282828 gray(40)
70045: ( 41, 41, 41) #292929 gray(41)
66643: ( 42, 42, 42) #2A2A2A gray(42)
63950: ( 43, 43, 43) #2B2B2B gray(43)
61070: ( 44, 44, 44) #2C2C2C gray(44)
58082: ( 45, 45, 45) #2D2D2D gray(45)
56948: ( 46, 46, 46) #2E2E2E gray(46)
55528: ( 47, 47, 47) #2F2F2F gray(47)
53219: ( 48, 48, 48) #303030 gray(48)
52258: ( 49, 49, 49) #313131 gray(49)
51385: ( 50, 50, 50) #323232 gray(50)
50522: ( 51, 51, 51) #333333 gray(51)
49754: ( 52, 52, 52) #343434 gray(52)
49059: ( 53, 53, 53) #353535 gray(53)
47222: ( 54, 54, 54) #363636 gray(54)
45904: ( 55, 55, 55) #373737 gray(55)
44449: ( 56, 56, 56) #383838 gray(56)
42624: ( 57, 57, 57) #393939 gray(57)
40983: ( 58, 58, 58) #3A3A3A gray(58)
40021: ( 59, 59, 59) #3B3B3B gray(59)
39173: ( 60, 60, 60) #3C3C3C gray(60)
38533: ( 61, 61, 61) #3D3D3D gray(61)
37776: ( 62, 62, 62) #3E3E3E gray(62)
37755: ( 63, 63, 63) #3F3F3F gray(63)
37515: ( 64, 64, 64) #404040 gray(64)
36656: ( 65, 65, 65) #414141 gray(65)
35643: ( 66, 66, 66) #424242 gray(66)
34602: ( 67, 67, 67) #434343 gray(67)
34561: ( 68, 68, 68) #444444 gray(68)
33577: ( 69, 69, 69) #454545 gray(69)
32676: ( 70, 70, 70) #464646 gray(70)
32327: ( 71, 71, 71) #474747 gray(71)
31623: ( 72, 72, 72) #484848 gray(72)
30993: ( 73, 73, 73) #494949 gray(73)
30242: ( 74, 74, 74) #4A4A4A gray(74)
29206: ( 75, 75, 75) #4B4B4B gray(75)
28795: ( 76, 76, 76) #4C4C4C gray(76)
27997: ( 77, 77, 77) #4D4D4D gray(77)
27775: ( 78, 78, 78) #4E4E4E gray(78)
27542: ( 79, 79, 79) #4F4F4F gray(79)
27159: ( 80, 80, 80) #505050 gray(80)
26484: ( 81, 81, 81) #515151 gray(81)
25913: ( 82, 82, 82) #525252 gray(82)
25596: ( 83, 83, 83) #535353 gray(83)
25338: ( 84, 84, 84) #545454 gray(84)
24914: ( 85, 85, 85) #555555 gray(85)
24477: ( 86, 86, 86) #565656 gray(86)
23903: ( 87, 87, 87) #575757 gray(87)
23847: ( 88, 88, 88) #585858 gray(88)
23586: ( 89, 89, 89) #595959 gray(89)
23583: ( 90, 90, 90) #5A5A5A gray(90)
23129: ( 91, 91, 91) #5B5B5B gray(91)
22690: ( 92, 92, 92) #5C5C5C gray(92)
22295: ( 93, 93, 93) #5D5D5D gray(93)
21755: ( 94, 94, 94) #5E5E5E gray(94)
21556: ( 95, 95, 95) #5F5F5F gray(95)
21268: ( 96, 96, 96) #606060 gray(96)
21070: ( 97, 97, 97) #616161 gray(97)
21143: ( 98, 98, 98) #626262 gray(98)
21019: ( 99, 99, 99) #636363 gray(99)
21181: (100,100,100) #646464 gray(100)
21077: (101,101,101) #656565 gray(101)
20964: (102,102,102) #666666 gray(102)
20701: (103,103,103) #676767 gray(103)
20396: (104,104,104) #686868 gray(104)
20371: (105,105,105) #696969 gray(105)
20400: (106,106,106) #6A6A6A gray(106)
20177: (107,107,107) #6B6B6B gray(107)
20404: (108,108,108) #6C6C6C gray(108)
20197: (109,109,109) #6D6D6D gray(109)
20166: (110,110,110) #6E6E6E gray(110)
20289: (111,111,111) #6F6F6F gray(111)
20181: (112,112,112) #707070 gray(112)
20386: (113,113,113) #717171 gray(113)
20369: (114,114,114) #727272 gray(114)
20808: (115,115,115) #737373 gray(115)
21065: (116,116,116) #747474 gray(116)
21642: (117,117,117) #757575 gray(117)
21938: (118,118,118) #767676 gray(118)
22397: (119,119,119) #777777 gray(119)
23109: (120,120,120) #787878 gray(120)
23643: (121,121,121) #797979 gray(121)
24492: (122,122,122) #7A7A7A gray(122)
25337: (123,123,123) #7B7B7B gray(123)
25879: (124,124,124) #7C7C7C gray(124)
26779: (125,125,125) #7D7D7D gray(125)
27981: (126,126,126) #7E7E7E gray(126)
28847: (127,127,127) #7F7F7F gray(127)
29289: (128,128,128) #808080 gray(128)
30579: (129,129,129) #818181 gray(129)
31246: (130,130,130) #828282 gray(130)
32604: (131,131,131) #838383 gray(131)
33798: (132,132,132) #848484 gray(132)
34401: (133,133,133) #858585 gray(133)
35179: (134,134,134) #868686 gray(134)
35876: (135,135,135) #878787 gray(135)
36523: (136,136,136) #888888 gray(136)
37248: (137,137,137) #898989 gray(137)
38214: (138,138,138) #8A8A8A gray(138)
39146: (139,139,139) #8B8B8B gray(139)
39923: (140,140,140) #8C8C8C gray(140)
41141: (141,141,141) #8D8D8D gray(141)
41857: (142,142,142) #8E8E8E gray(142)
43226: (143,143,143) #8F8F8F gray(143)
44400: (144,144,144) #909090 gray(144)
44986: (145,145,145) #919191 gray(145)
46515: (146,146,146) #929292 gray(146)
47728: (147,147,147) #939393 gray(147)
48977: (148,148,148) #949494 gray(148)
50688: (149,149,149) #959595 gray(149)
51364: (150,150,150) #969696 gray(150)
52690: (151,151,151) #979797 gray(151)
53678: (152,152,152) #989898 gray(152)
55224: (153,153,153) #999999 gray(153)
56012: (154,154,154) #9A9A9A gray(154)
57634: (155,155,155) #9B9B9B gray(155)
58380: (156,156,156) #9C9C9C gray(156)
59598: (157,157,157) #9D9D9D gray(157)
60434: (158,158,158) #9E9E9E gray(158)
61221: (159,159,159) #9F9F9F gray(159)
62135: (160,160,160) #A0A0A0 gray(160)
62645: (161,161,161) #A1A1A1 gray(161)
63344: (162,162,162) #A2A2A2 gray(162)
64376: (163,163,163) #A3A3A3 gray(163)
65169: (164,164,164) #A4A4A4 gray(164)
65763: (165,165,165) #A5A5A5 gray(165)
66602: (166,166,166) #A6A6A6 gray(166)
67132: (167,167,167) #A7A7A7 gray(167)
68362: (168,168,168) #A8A8A8 gray(168)
68938: (169,169,169) #A9A9A9 gray(169)
69420: (170,170,170) #AAAAAA gray(170)
70613: (171,171,171) #ABABAB gray(171)
71490: (172,172,172) #ACACAC gray(172)
72285: (173,173,173) #ADADAD gray(173)
72666: (174,174,174) #AEAEAE gray(174)
73687: (175,175,175) #AFAFAF gray(175)
74330: (176,176,176) #B0B0B0 gray(176)
75214: (177,177,177) #B1B1B1 gray(177)
76189: (178,178,178) #B2B2B2 gray(178)
76783: (179,179,179) #B3B3B3 gray(179)
77400: (180,180,180) #B4B4B4 gray(180)
77769: (181,181,181) #B5B5B5 gray(181)
78275: (182,182,182) #B6B6B6 gray(182)
78114: (183,183,183) #B7B7B7 gray(183)
78234: (184,184,184) #B8B8B8 gray(184)
79280: (185,185,185) #B9B9B9 gray(185)
79323: (186,186,186) #BABABA gray(186)
79550: (187,187,187) #BBBBBB gray(187)
80525: (188,188,188) #BCBCBC gray(188)
80847: (189,189,189) #BDBDBD gray(189)
81161: (190,190,190) #BEBEBE gray(190)
81850: (191,191,191) #BFBFBF gray(191)
81767: (192,192,192) #C0C0C0 gray(192)
82736: (193,193,193) #C1C1C1 gray(193)
83527: (194,194,194) #C2C2C2 gray(194)
83894: (195,195,195) #C3C3C3 gray(195)
84496: (196,196,196) #C4C4C4 gray(196)
84953: (197,197,197) #C5C5C5 gray(197)
85352: (198,198,198) #C6C6C6 gray(198)
86793: (199,199,199) #C7C7C7 gray(199)
86980: (200,200,200) #C8C8C8 gray(200)
87824: (201,201,201) #C9C9C9 gray(201)
88949: (202,202,202) #CACACA gray(202)
90252: (203,203,203) #CBCBCB gray(203)
91849: (204,204,204) #CCCCCC gray(204)
93007: (205,205,205) #CDCDCD gray(205)
94803: (206,206,206) #CECECE gray(206)
96712: (207,207,207) #CFCFCF gray(207)
98743: (208,208,208) #D0D0D0 gray(208)
100821: (209,209,209) #D1D1D1 gray(209)
102286: (210,210,210) #D2D2D2 gray(210)
105903: (211,211,211) #D3D3D3 gray(211)
110718: (212,212,212) #D4D4D4 gray(212)
117495: (213,213,213) #D5D5D5 gray(213)
125958: (214,214,214) #D6D6D6 gray(214)
140210: (215,215,215) #D7D7D7 gray(215)
157586: (216,216,216) #D8D8D8 gray(216)
179161: (217,217,217) #D9D9D9 gray(217)
201290: (218,218,218) #DADADA gray(218)
221335: (219,219,219) #DBDBDB gray(219)
223190: (220,220,220) #DCDCDC gray(220)
201749: (221,221,221) #DDDDDD gray(221)
166555: (222,222,222) #DEDEDE gray(222)
126990: (223,223,223) #DFDFDF gray(223)
94594: (224,224,224) #E0E0E0 gray(224)
69410: (225,225,225) #E1E1E1 gray(225)
52093: (226,226,226) #E2E2E2 gray(226)
38886: (227,227,227) #E3E3E3 gray(227)
29618: (228,228,228) #E4E4E4 gray(228)
22213: (229,229,229) #E5E5E5 gray(229)
17143: (230,230,230) #E6E6E6 gray(230)
13792: (231,231,231) #E7E7E7 gray(231)
11989: (232,232,232) #E8E8E8 gray(232)
10928: (233,233,233) #E9E9E9 gray(233)
10478: (234,234,234) #EAEAEA gray(234)
10276: (235,235,235) #EBEBEB gray(235)
10838: (236,236,236) #ECECEC gray(236)
11707: (237,237,237) #EDEDED gray(237)
10805: (238,238,238) #EEEEEE gray(238)
8588: (239,239,239) #EFEFEF gray(239)
7217: (240,240,240) #F0F0F0 gray(240)
4180: (241,241,241) #F1F1F1 gray(241)
1719: (242,242,242) #F2F2F2 gray(242)
583: (243,243,243) #F3F3F3 gray(243)
133: (244,244,244) #F4F4F4 gray(244)
70: (245,245,245) #F5F5F5 gray(245)
41: (246,246,246) #F6F6F6 gray(246)
43: (247,247,247) #F7F7F7 gray(247)
24: (248,248,248) #F8F8F8 gray(248)
22: (249,249,249) #F9F9F9 gray(249)
19: (250,250,250) #FAFAFA gray(250)
7: (251,251,251) #FBFBFB gray(251)
1: (252,252,252) #FCFCFC gray(252)
1: (253,253,253) #FDFDFD gray(253)
1: (254,254,254) #FEFEFE gray(254)
Rendering intent: Undefined
Gamma: 0.454545
Background color: gray(255)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 6270x7680+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG2000
Orientation: Undefined
Properties:
date:create: 2013-12-27T13:47:11-08:00
date:modify: 2013-12-27T13:47:11-08:00
signature: 88ec2c9d44e501970e39dc0726a0ec1854bfbb865546c4eaf5110c145e921db5
Profiles:
Profile-icc: 394 bytes
Description: Restricted ICC profile describing sRGB-grey
Manufacturer: Restricted ICC profile describing sRGB-grey
Model: Restricted ICC profile describing sRGB-grey
Copyright: Copyright 2003 sRGB-grey Reference
Artifacts:
filename: northisland.jp2
verbose: true
Tainted: True
Filesize: 19.66MB
Number pixels: 48.15M
Pixels per second: 2.511MB
User time: 18.560u
Elapsed time: 0:20.180
Version: ImageMagick 6.8.8-0 Q16 x86_64 2013-12-26 http://www.imagemagick.org

This may be a bug in IM or more likely the jasper JP2 delegate library, which does not work on all JP2 formats. In this case, perhaps because it is YCbCr?

PS CS won't open it. Mac PREVIEW shows it as grayscale. But my GraphicConverter tool does open it and it looks properly colored and I can save it again as tiff, which then displays fine in IM and other viewers.

You could try posting this to the Bugs forum and see what the developers say. (Also put a link back to this topic for reference).

Re: ortho-imagery

Posted: 2013-12-27T15:00:46-07:00
by EthanWilliams
Ah okay, well perhaps it is improperly coded. The USGS likes to do that. I've had a hell of a time working with their data on this project. Can you provide me to a link with the tool that you have had success with?
Thanks, by the way for all the help thus far.

Re: ortho-imagery

Posted: 2013-12-27T15:24:28-07:00
by fmw42
It is possible that the this is just an odd JP2 format that many tools like Jasper and whatever you are using to convert it will not handle. There are other tools for converting JP2 files. You also can try using jasper by itself outside of IM. Perhaps it has more features that IM is not using. Or try one of the other tools.

see
http://en.wikipedia.org/wiki/JPEG_2000 for tools and libraries that handle the Advance Format. Jasper, which is used by IM does not handle the more advanced formats. Try OpenJPEG. There was some talk a while back about IM switching to OpenJPEG, but it was low on the totem pole with respect to ugency and has not been done. You could try downloading OpenJPEG and use it standalone.

The tool I used was GraphicConvert. It is a Mac only tool. If you still want it, go to http://www.lemkesoft.de/en/products/graphicconverter/

Re: ortho-imagery

Posted: 2013-12-27T15:40:25-07:00
by EthanWilliams
Okay thanks. I've tried the stand alone jasper and received the same error. Could you possibly upload the image you converted to make sure that it runs through the whole process on my end?