Treat me as a beginner.
I have this method, where the bandArray is the original image double[]
array
private double[] ApplyAverageSmoothingNxN(double[] bandArray, int width, int height, int n)
{
//logic inside here (not relevant)
}
This method returns me a double[]
array which is actually the raster file. After the methods returns I try to save the output using Gdal like so:
composedDs = drv.Create(path + "smoothed.tif", XSize, YSize, 1, DataType.GDT_Int16, null);
composedDs.SetGeoTransform(transform);
composedDs.WriteRaster(0, 0, band.XSize, band.YSize, result, band.XSize, band.YSize, 1, null, 0, 0, 0);
composedDs.Dispose();
Now, after I open the output tif image, I see everything black (all 0's). But if I try to run my code again, the raster has all it's values correct. However, if I try to assign all values of the output double[]
array like so:
for (int i = 0; i < array.Length; i++) {
array[i] = 10 //some value.. could be anything else
}
After I save it with Gdal.Create()
Arcmap displays pixel values correctly. What is happening ?
Also my input image is a ".jp2" file while the output is done with "GTiff" driver as ".tif".