How to specify nrows and ncols instead of latscale and lonscale in georesize?

2 次查看(过去 30 天)
I am trying to rescale geotiffs using georesize. I have a required size [1527,3164] and I am extracting the latscale and lonscale based on these numbers. However, the following line in the georesize function is returning slightly different values (i.e., 1526, 3163 etc)
[RB, xSample, ySample] = scaleSizeAndDensity(RA, double(latscale), double(lonscale));
For example, the parameters A = 1493x3093 single, latscale = 1.0228, lonscale = 1.0230 should result in the required size, but the execution of the scaleSizeAndDensity is causing xSample = 3163, ySample = 1527. While the change is minor, it is causing dimension mismatch. I believe zero padding B will create a mismatch with it's corresponding RB. What can I do in this regard? Is there a way to specify this required size when I call georesize instead of latscale and lonscale while can create error because of the smaller decimal numbers?
Thanks.
  4 个评论
Farshina Nazrul Shimim
Thanks for your response. I beleive size(RA, 1) is the same as RA.Rastersize(1). I've been doing that.
Thanks for your response. I added double(Latscale), double(Lonscale) it's not chaning anything unfortunately.
dpb
dpb 2022-7-14
编辑:dpb 2022-7-15
SHOW US THE EXACT CODE IN ITS ENTIRETY OF THE PERTINENT PART INSTEAD OF DESCRIBING IT.
Where you added double may or may not have any effect; you do not need an explicit double() statement at all; you'll probably be better off without. My comment above was only meant to ensure you hadn't created the variables as single() but were using (default) double precision in the calculations.
What we haven't seen is whether you actually computed the scaling factors or are still messing around trying to use constants as in your original...

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by