Merge single tif grayscale images to a unique RGB while applying x,y offsets?
Posted: 2016-11-29T13:25:20-07:00
Hi,
I have 3 questions.
1.
I have 3 separate tif images (16-bit pixel depth each) representing data acquired with a scanner.
Every single file is a grayscale image corresponding to only one of three R, G and B channels: RED.tif, GRN.tif, BLU.tif (in fact there is a 4th image acquired within near infra-red; NIR.tif).
I'd like to "reassemble" or "merge" them in a single RGB tif image with no data loss, i.e. = 3*16=48-bit total.
By doing :
The resulting RGB merged.tif image does have some "flat regions" (i.e. single color for area where the color details were not high, like the image was segmented) where I feel like there was some strong compression like we can somehow see on JPEG images.
Adding the -compress none flag doesn't affect the result at all.
How could I avoid this quality loss?
2nd question:
The 3 original images are not perfectly aligned. There are some pixels shift.
What I would achieved is that the first image taken is the reference (top-left corner = [0,0]) and the two others may have some shift.
For example let's say we want a shift along x (horizontal axis) and y (vertical axis):
GRN.tif: +5px along x and +3px along y, thus, top-left corner would be [5,3] in the reference axis of the first image (RED.tif)
BLU.tif: -7px along x and -4px along y, thus, top-left corner would be [-7,-4] in the reference axis of the first image (RED.tif). Here I want to lose a 7 pixels band on the left of the BLU.tif and a 4 pixels band on top.
Here are the images dimensions in pixels (width x height):
NIR.tif: 693 x 6820
RED.tif: 693 x 6825
GRN.tif: 693 x 6825
BLU.tif: 693 x 6823
They are by chance here the same in some cases, but It's not always the case.
No matter what append and the bottom and the right side (but I would probably have to manage that after having solved these first issues).
3rd question:
Remember I also have a 4th image taken with an infra-red sensor:
NIR.tif
Is there something special to know to achieve some other combinations of channels?
For example, a NRG false color image, i.e. N stands for near infrared, R for red and G for green original channels.
So, what I call a NRG image is an image where these 3 original channels are set, or "projected" into the RGB "color representation" needed for display on a screen monitor.
Thus, N becomes R in RGB "color representation", R->G and G->B.
All other thinkable combinations are also possible, like GNB or whatever, but the first image use would always be the reference for geometric alignment as presented before.
Thanks a lot for your precious advices.
Best Regards.
picture sample normally available here
I also dropped an image processed with Photoshop so that you can see the difference in green regions of what I called "flat region". Zoom 100% required to clearly see that.
I have 3 questions.
1.
I have 3 separate tif images (16-bit pixel depth each) representing data acquired with a scanner.
Every single file is a grayscale image corresponding to only one of three R, G and B channels: RED.tif, GRN.tif, BLU.tif (in fact there is a 4th image acquired within near infra-red; NIR.tif).
I'd like to "reassemble" or "merge" them in a single RGB tif image with no data loss, i.e. = 3*16=48-bit total.
By doing :
Code: Select all
convert "RED.tif" "GRN.tif" "BLU.tif" -combine "merged.tif"
Adding the -compress none flag doesn't affect the result at all.
How could I avoid this quality loss?
2nd question:
The 3 original images are not perfectly aligned. There are some pixels shift.
What I would achieved is that the first image taken is the reference (top-left corner = [0,0]) and the two others may have some shift.
For example let's say we want a shift along x (horizontal axis) and y (vertical axis):
GRN.tif: +5px along x and +3px along y, thus, top-left corner would be [5,3] in the reference axis of the first image (RED.tif)
BLU.tif: -7px along x and -4px along y, thus, top-left corner would be [-7,-4] in the reference axis of the first image (RED.tif). Here I want to lose a 7 pixels band on the left of the BLU.tif and a 4 pixels band on top.
Here are the images dimensions in pixels (width x height):
NIR.tif: 693 x 6820
RED.tif: 693 x 6825
GRN.tif: 693 x 6825
BLU.tif: 693 x 6823
They are by chance here the same in some cases, but It's not always the case.
No matter what append and the bottom and the right side (but I would probably have to manage that after having solved these first issues).
3rd question:
Remember I also have a 4th image taken with an infra-red sensor:
NIR.tif
Is there something special to know to achieve some other combinations of channels?
For example, a NRG false color image, i.e. N stands for near infrared, R for red and G for green original channels.
So, what I call a NRG image is an image where these 3 original channels are set, or "projected" into the RGB "color representation" needed for display on a screen monitor.
Thus, N becomes R in RGB "color representation", R->G and G->B.
All other thinkable combinations are also possible, like GNB or whatever, but the first image use would always be the reference for geometric alignment as presented before.
Thanks a lot for your precious advices.
Best Regards.
picture sample normally available here
I also dropped an image processed with Photoshop so that you can see the difference in green regions of what I called "flat region". Zoom 100% required to clearly see that.