- 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1467576/image.png)
댓글 수: 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!