G'MIC Image Alignment Problem

Hi,
I am encountering a problem with G’MIC (2.5.5) and am wondering if anyone else has experienced this. Following is the command that I run:

gmic SOURCE_RGB.tif SOURCE_LUM.tif div 257 rgb2lab8[0] j[0] [1] rm[1] lab82srgb mul 257 cut 0,65535 round o SOURCE_RGB8-TESTOUT.tif

The two input files are the same size: 15221 X 15441

The following image shows the output. On the right is what G’MIC creates and on the left is what the same two files create when I use Photoshop to merge the luminosity image with the RGB image in LAB mode.

In seems clear to me that the merging of the two files in G’MIC is not clean and that there is a multiple pixel lateral offset when the two images are merged.

Does anyone have any insight on this? Thanks.

Photoshop does alignment, then merging. Not sure what GMIC does, but it doesn’t look aligned. Try hugin or hugin’s align_image_stack then feed the files to GMIC.

Wow. Going in to Photoshop and zooming well into both the RGB and L images I can see that they are off by about 6 pixels horizontally- which evidently Photoshop recognizes and auto corrects for.

Rather than having to install and learn yet another program (Hugin), is there any way to do this offset correction in G’MIC?

I second @paperdigits’s recommendation. There are some quirks with range and colour space but alignment is easy and robust.

If the images differ horizontally only, without other distortions, then all you need to do is trim or frame the edges until they align.

Thanks Afre. Until this experience I had no idea that Photoshop (and GIMP as well apparently) was doing anything other than a straight forward copy from 0,0… to paste 0.0… Can’t say as I like that.

What I need to find out is whether or not there is a consistent offset from one image set to the next. If all image sets have the same displacement then I could try to use the G’MIC crop function as a solution. One wrinkle is that not all the image sets have the same x,y dimensions so that may kill the cropping approach.

One way to go at it is to do gradient_norms of the sets to see how much the nonalignment is. E.g.,

tiger_pair

NB The post clips the right and bottom sides of the GIF, which doesn’t happen in the original file.

Would it be possible to have access to these two images to see what is happening ?

Yes, examples are always useful. I see that they are rather large images. Filebin is your friend.