"irregular channel geometry" error joining files

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
jkimble
Posts: 12
Joined: 2012-05-04T10:45:03-07:00
Authentication code: 13

"irregular channel geometry" error joining files

Post by jkimble »

I've got two 1920x540 (1080p) j2k (JPEG 2000) images that are the upper and lower halves of a full 1080p frame. I need to stitch or join these two images into a single 1080p frame within a C program (reading raw data from a camera and doing some preprocessing). I have two issues (at least...)

1) I have no example or guide as to how to do this with Image Magic. I've done it with other image formats in Java using the imageIO classes (Image Magick too?) but if I could get an example or outline of how to do this with the MagickWand C API I would very much appreciate it.

2) Using the "convert" routine to do this from the command line I always get the error: "irregular channel geometry not supported" for both input files. I'm just doing: "convert file1.j2k file2.j2k +append joined.j2k" from the command line (Fedora 17, 64 bit). I'm pretty sure I'm going to get the same error working with the Wand C API so I really need to get to the bottom of this.

Any help or suggestions would be GREATLY appreciate.

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "irregular channel geometry" error joining files

Post by fmw42 »

I am not sure IM supports .j2k.

convert -list format

J2C* JP2 rw- JPEG-2000 Code Stream Syntax
JNG* PNG rw- JPEG Network Graphics
See http://www.libpng.org/pub/mng/ for details about the JNG
format.
JP2* JP2 rw- JPEG-2000 File Format Syntax
JPC* JP2 rw- JPEG-2000 Code Stream Syntax


try .jp2 in your command

convert file1.jp2 file2.jp2 +append joined.jp2

or

convert JP2:file1.jp2 JP2:file2.jp2 +append JP2:joined.jp2

Before you do that, do you know that you have the Jasper delegate library installed.

Try

convert -list format

and see if you have those file formats listed above.

Or try

convert -list configure

and look at the line starting with DELEGATES and see if it includes jp2
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: "irregular channel geometry" error joining files

Post by el_supremo »

Give this a try:

Code: Select all

#include <windows.h>
#include <wand/MagickWand.h>
void test_wand(void)
{
	MagickWand *mw = NULL,*mwa;

	MagickWandGenesis();
	mw = NewMagickWand();
	MagickReadImage(mw,"logo:");
	MagickReadImage(mw,"logo:");

	MagickResetIterator(mw);
	// Append the second image to the bottom (MagickTrue) of the original image
	mwa = MagickAppendImages(mw,MagickTrue);

	// and save the result
	MagickWriteImage(mwa,"logo_append.png");
	if(mw) mw = DestroyMagickWand(mw);
	if(mwa) mwa = DestroyMagickWand(mwa);
	MagickWandTerminus();
}
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
jkimble
Posts: 12
Joined: 2012-05-04T10:45:03-07:00
Authentication code: 13

Re: "irregular channel geometry" error joining files

Post by jkimble »

Thanks to both of your replies. I do have the IM libs installed but there's no j2k support. It's odd because there is j2c support which is the other JPEG2000 streaming format. I'm not sure what the difference is.

The other thing I take from this is that jp2 is supported. I can convert my j2k images to jp2's because these are simple files with unform color and bit depth so adding a header is easy. I can then do the stitching as Joe described (thanks again!) and then strip the header back off the new image (I need the j2k's to create a motion JPEG). It's clunky and maybe too slow but it'll work which is more than I have right now.

I've another suggestion from another board describing how to join the two files manually. It's tricky and I'll have to understand more about the file format than I wanted to but if the above is too slow I'll just have to do it.

Thank you both again!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "irregular channel geometry" error joining files

Post by fmw42 »

See http://www.eprintdriver.com/help/v5.0/A ... JPGFmt.htm for some info about j2k vs jp2

You might inquire in the Developers forum about support for j2k. IM uses the Jasper delegate library for jp2, but I do not know if it supports j2k. So you might inquire.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: "irregular channel geometry" error joining files

Post by anthony »

C programming in IM Examples, is quite straight forward. Anything that you see done on the command line is available in the MagickWand API, or you have the lower level Core library.

However by joining do you mean just appending, or actually aligning and 'stitching' together, to match up shared parts.
As you talk about a camera probably the latter.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply