[RS-ecology] Help on Image Merge Issues
Adebola Hassan
hassanadebola89 at gmail.com
Fri Jan 11 12:59:26 CET 2019
Hello.
I am trying to merge a few tiff images (each has 4 bands) in R and It was
partly successful.
However a look (in QGIS) at the merged output revealed some sort of
radiometric distortions in the output file.
I would appreciate help in this regard.
Please find below my source code in R.
I attached to this email also (for comparison) one of the image before
merging and the same image section in the merger output.
Thanks - Adebola Hassan
#Rcode
#list all tif files in working directory
all_tiff_list = list.files(".", pattern = "tif", full.names = T)
#plot first img only
all_tiff_imgs1 = stack(all_tiff_list[1])
plot(all_tiff_imgs1)
#merge and plot first and second tiff file
all_tiff_imgs2 = stack(all_tiff_list[2])
tiff_merge_1_2 = merge(all_tiff_imgs1, all_tiff_imgs2)
plot(tiff_merge_1_2)
#merge and plot all tiff files
img_list = list()
for (i in 1:length(all_tiff_list)) {
img_list[i] = stack(all_tiff_list[i])
}
img_list$filename <- 'test.tif'
img_list$overwrite <- T
all_img_merge = do.call(merge, img_list)
plot(all_img_merge)
ggRGB(all_img_merge, r = 1, g = 2, b = 3)
#image after merge
[image: Merged_Image.PNG]
#before merge
[image: Single_Image.PNG]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20190111/41087bc9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Merged_Image.PNG
Type: image/png
Size: 1548455 bytes
Desc: not available
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20190111/41087bc9/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Single_Image.PNG
Type: image/png
Size: 1534090 bytes
Desc: not available
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20190111/41087bc9/attachment-0003.png>
More information about the RS-ecology
mailing list