-
Hello, This may be a general GDAL question, but I'll give it a shot here. My initial goal is to be able to combine RGB bands from a Landsat 9 image. Here's is my generic test code. Having general issues with the striping, and color. `
My thoughts, something going on with the block size, something going on with my access point to the strided vector, or some kind of scaling in the TIFF. Does anybody have any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It's because of your index computation. The way you're doing it now, pixels (0, 10) and (10, 0) will map to the same So here you need to think about the pixel order. Since they're laid out in rows (first row, then the second row etc.), pixel (x, y) will be at Finally, it won't affect the result but, unless the compiler is being very smart, it will be faster if you access the pixels in a sequential pattern. You're looping by x, then by y, which means you're iterating odero columns. You should switch the two for loops, so that the x varies faster. |
Beta Was this translation helpful? Give feedback.
It's because of your index computation. The way you're doing it now, pixels (0, 10) and (10, 0) will map to the same
access_point
, 10. This causes the diagonal lines -- the diagonals have the same values because they're actually filled with the same pixel.So here you need to think about the pixel order. Since they're laid out in rows (first row, then the second row etc.), pixel (x, y) will be at
y * width + x
. Note, though, that some language and libraries will store 2D arrays by columns instead of rows.Finally, it won't affect the result but, unless the compiler is being very smart, it will be faster if you access the pixels in a sequential pattern. You're looping by x, then by y, whic…