how to write matrix into geotiff format

4 次查看(过去 30 天)
Hello, I have an image made in ArcGIS. its format is Geotiff. I raed it with below command in matlab:
[X, cmap, R] = geotiffread('sarea.tif')
Then I made some changes in matrix X. finally I decided to convert it to previous format (Geotiff) to read in ArcGIS. Therefore I used the below code:
geotiffwrite('aa.tif',X,cmap,R)
But I got the error:
??? Error using ==> geotiffwrite
Expected input number 2, X, to be one of these types:
uint8, uint16
Instead its type was single.
Error in ==> geotiffwrite>validateImage at 395
validateattributes(A, {'uint8','uint16'}, {'nonempty'}, ...
Error in ==> geotiffwrite>validateInputs at 343
[A, cmap] = validateImage(A, cmap);
Error in ==> geotiffwrite at 233
[filename, A, cmap, R, Params] = validateInputs( ...
I convert X to uint8 using
X=uint8(X)
But again I got the error:
geotiffwrite('aa.tif',X,cmap,R)
??? Error using ==> checkcmap at 16
Function GEOTIFFWRITE expected its third input argument CMAP to be a valid colormap. Valid
colormaps must be nonempty, double, 2-D matrices with 3 columns.
Error in ==> geotiffwrite>validateImage at 397
internal.map.checkcmap(cmap, mfilename, 'CMAP', 3)
Error in ==> geotiffwrite>validateInputs at 343
[A, cmap] = validateImage(A, cmap);
Error in ==> geotiffwrite at 233
[filename, A, cmap, R, Params] = validateInputs( ...
Why I got the error? What is problem? Thank you

回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by