- Use the "imread" function to read the original TIFF file and extract the first page's "GPSInfo" metadata using a library like the "Tiff" class.
- Apply the necessary normalization
- Use the imwrite function to create a new TIFF file for the normalized images.
- After writing each normalized image to the new TIFF file, use a custom function to add the "GPSInfo" metadata to the first page of the new TIFF file.
manipulating multipage TIFF file
10 次查看(过去 30 天)
显示 更早的评论
I have a geo-refenreced TIFF file with 14 pages corresponding to 14 wavelengths. I want to normalize the image at each wavelength and create a new TIFF file with the normalized images. So far no problem. My problem is that the first page in my original TIFF includes a field called "GPSInfo" that I need to pass along to the new TIFF file. Imwrite does not seem to support the inclusion of such information in a TIFF file. Any suggestions?
Thanks
0 个评论
回答(1 个)
Dheeraj
2023-9-6
Hi,
Writing custom metadata like "GPSInfo" you can use a combination of functions from the MATLAB File Exchange and the built-in functions as "imwrite" does not support the inclusion of such information in a TIFF file.
for i = 1:14 %Iterating through all pages
% Create a new file with normalised images, let it be newNormalisedPage
% Add "GPSInfo" metadata to the first page of the new TIFF file
if i == 1
new_tiff = Tiff( newNormalisedPage , 'r+');
new_tiff.setTag('GPSInfo', gps_info);
new_tiff.close();
end
end
Also refer to https://in.mathworks.com/help/matlab/ref/imwrite.html?searchHighlight=imwrite&s_tid=srchtitle_support_results_1_imwrite for better understanding of imwrite capabilities.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!