I have four .j2k files (loseless) of known identical size and I want to combine them into one bigger .j2k file. Now of course the simple and working way is to decompress them into bitmap and compress the larger bitmap to .j2k file - but that is performance costly. Is there a simpler way ? And if so can you highlight it in pseudocode ?
UPDATE
Based on @malat suggestion I tried following (see my github repo for full sources and image examples):
<your-b2d-ip>:8080
Which works (in terms of image having correct size and being filled with image data). It looks OK only for first tile, but other tiles are screwed up. I though the tiles are encoded separately - am I wrong ? I also tried copying COD and QCC markers from main header to tile header - but that didn't helped either.
答案 0 :(得分:0)
我将如何做到这一点。只需向后开始。假设您的目标图像是512x512,并且您的4个图块(J2K输入)中的每一个都是256x256。在这种情况下,让我们创建一个假的(但有效的)JP2文件等效:
$ wget http://www.ece.rice.edu/~wakin/images/lena512color.tiff
$ kdu_compress -i lena512color.tif -o out.jp2 Stiles="{256,256}" Clevels:T0C1=0 Cuse_sop:T3=yes Cycc:T2=no
不要过于担心Clevels:T0C1=0 Cuse_sop:T3=yes Cycc:T2=no
,它们只对确保COC
和QCC
之后生成COD
和QCD
非常有用。主标题。
现在你有了一个有效的JP2容器(格式),你只需要用你的(应该有4个)替换每个单独的tile(有效的J2K码流)。
另一个重要的事情是检查所有码流是否具有正确的SOT length
。请记住,只有最后一个图块的SOT长度为零(未定义长度)才是合法的。
如果你想更进一步,你需要确保:
QCD
和COD
TLM
标记