[OpenJPEG] Re: Does any tutorials, quick start guids on OpenJpegforVS2008 avaliable?

91 views
Skip to first unread message

szuk...@arcor.de

unread,
Mar 18, 2013, 9:03:15 PM3/18/13
to open...@googlegroups.com
On Mon, 18 Mar 2013 14:00:47 -0700 (PDT), destroytheworld wrote:

>i want to decode image tile by tile or decode small group of tiles,
>but when i set parameters.nb_tile_to_decode it doesn't change
>anything,
>maybe i need to use opj_set_decode_area(...) ? but i don't know the
>size of tiles.... umfff can somebody help with it?
>i need to decode a group of tiles which are standing in horisontal
>line and get their bitmap, and then again and again. images will be
>large, i can't decode them at once

Now has come the time where all brave men must confess:

Which version of OpenJPEG do you use?

The BRANCH (version 1.5.2) or the TRUNK ( version 2.0.0)?

winfried

Волынский А.В. (zombaine)

unread,
Mar 19, 2013, 1:30:41 AM3/19/13
to OpenJPEG
2.0.0

szuk...@arcor.de

unread,
Mar 19, 2013, 7:51:28 AM3/19/13
to open...@googlegroups.com
The code in 'opj_decompress.c' - in short - runs:

----------------------------------------------------------
opj_set_default_decoder_parameters(&parameters);

parse_cmdline_decoder(argc, argv,
&parameters,&img_fol, indexfilename);

l_stream =
opj_stream_create_default_file_stream_v3(parameters.infile,1);

l_codec =
opj_create_decompress(OPJ_CODEC_[J2K|JP2|JPT]);

/* Optional */
opj_set_info_handler(l_codec, info_callback,00);
opj_set_warning_handler(l_codec, warning_callback,00);
opj_set_error_handler(l_codec, error_callback,00);

opj_setup_decoder(l_codec, &parameters);

opj_read_header(l_stream, l_codec, &image);

opj_get_decoded_tile(l_codec, l_stream, image,
parameters.tile_index);

opj_stream_destroy_v3(l_stream);
----------------------------------------------------------

And when I use an image with severeal tiles
and call

./opj_decompress -i image.jp2 -o tile.5 -t 5

then I get tile 5.

Why?

You wrote

>but when i set parameters.nb_tile_to_decode it doesn't change
>anything,

As the code above shows in the function

parse_cmdline_decoder()

you must set

parameters->tile_index = your_tile_number;
parameters->nb_tile_to_decode = 1;

------------------------------------------
case 't': /* Input tile index */
{
sscanf(opj_optarg, "%d", &parameters->tile_index);
parameters->nb_tile_to_decode = 1;
}
------------------------------------------

Now it must work.

winfried

Волынский А.В. (zombaine)

unread,
Mar 21, 2013, 5:09:30 PM3/21/13
to OpenJPEG
Thanks a lot. now the last problem (i hope)
i need to decode image part by part (cause its too big)
and write in a file these parts to get one image on the output
So, the problem is that a cannot decode parts in a cycle , i need to
reopen file every time.
with function
opj_get_decoded_tile(l_codec, l_stream, image,
parameters.tile_index);
i get only 1 tile decoded, but i need a bunch of tiles at once.
if i set
parameters->nb_tile_to_decode = 5;
i get 1 tile decoded (((
with opj_set_decode_area i can set an area to decode , it is
absolutely what i need.
But it changes image class object and codec class object and on the
second iteration i get exception
So now my working project is closing-opening-initializing image every
iteration in a cycle
i believe that there are some better ways to solve this problem
i tried to have a copy of image class object and make memcpy every
iteration but thats not working
Reply all
Reply to author
Forward
0 new messages