Opened 10 years ago

Closed 10 years ago

#3742 closed enhancement (fixed)

[PATCH] GDALSuggestedWarpOutput2 more accurate output

Reported by: bishop Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: Algorithms Version: svn-trunk
Severity: normal Keywords: GDALSuggestedWarpOutput2
Cc:

Description

In GDALSuggestedWarpOutput2 the function only uses 20 points from each side of image. For more accurate suggest of warp output I increase point count. Its worth thinking to provide the step count in parameters (like SAMPLE_STEPS does). This is important while ortocorrecting tiled images without overlaps.

Attachments (2)

gdal_SuggestedWarpOutput2.patch (11.5 KB) - added by bishop 10 years ago.
GDALSuggestedWarpOutput2 patch
tiles_error.jpg (96.5 KB) - added by bishop 10 years ago.
example of error in output image size of two tiles

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by bishop

Summary: {PATCH} GDALSuggestedWarpOutput2 more accurate output[PATCH] GDALSuggestedWarpOutput2 more accurate output

comment:2 Changed 10 years ago by Even Rouault

Do you have a link to source images and the command line used that could show the benefits that the patch brings ? Also, there's a little part of the patch I don't understand : the "+15" at the end of the line *pnPixels = (int) ((dfMaxXOut - dfMinXOut) / dfPixelSize + 0.5) + 15;

comment:3 in reply to:  2 Changed 10 years ago by bishop

Unfortunately I have tested this patch on real commerce (single use license) geoeye-1 imagery. The feature of such imagery is that the scene divided on 2Gb tiles without overlaps. Each tile have it's own rpc file. While ortocorrecting with 20 points the result tiles have holes at the junction with the other tiles (about 1-2 pixels wide). I used patched gdal library from my program (not from command line), see http://code.google.com/p/wxgis/ so I have no examples of command line used (but if needed I can provide C++ code of such using). According the "+15" at the end of the line *pnPixels = (int) ((dfMaxXOut - dfMinXOut) / dfPixelSize + 0.5) + 15; - this is my mistake. I have overlapped the incorrect patch with fixed one.

Changed 10 years ago by bishop

GDALSuggestedWarpOutput2 patch

Changed 10 years ago by bishop

Attachment: tiles_error.jpg added

example of error in output image size of two tiles

comment:4 Changed 10 years ago by Even Rouault

Milestone: 1.8.0
Resolution: fixed
Status: newclosed

I've incorporated a variation of your patch with small adjustements into trunk (r20537).

  • If memory allocations fail with nSteps > 20, retry with nSteps = 20
  • Avoid using the dfRatio as the increment in the for() as it is unreliable. Use iStep instead
  • The CPLAssert( nSamplePoints == nSize ); line didn't compile. Replaced by CPLAssert( nSamplePoints == nSampleMax );

Thanks

Note: See TracTickets for help on using tickets.