Forum

Author Topic: export original colors as rgb with exportRaster  (Read 1869 times)

Tori

  • Newbie
  • *
  • Posts: 2
    • View Profile
export original colors as rgb with exportRaster
« on: December 04, 2024, 11:06:54 AM »
Hi,

I am doing experiments about bed morphology in a movable bed flume and am specifically examining sediment sorting when using different sediment grading curves. The differently sized sediments have different colors to visualize those sorting processes. I already have a Python-skript from my predecessor that takes the pictures of the flume, applies them to a defined region and exports a DEM in Raster format (aka x-y-z Koordinates) which I then analyze and visualize with a Matlab skript.
I now want to add how to export the rgb colors of each raster point along with its coordinates in the phython skript but I haven't found any way to do so. Is that even possible and if so, how can I accomplish it? Any help would be appreciated, as I am quite new to both metashape and python.

Heres the code I'm using:

Code: [Select]

chunk.exportRaster(path = path_DEM_XYZ,image_format = Metashape.ImageFormatXYZ,raster_transform = Metashape.RasterTransformNone,source_data =  Metashape.DataSource.ElevationData, resolution_x=0.0005, resolution_y=0.0005)
chunk.exportRaster(path = path_DEM_ASC,image_format = Metashape.ImageFormatNone,raster_transform = Metashape.RasterTransformNone,source_data =  Metashape.DataSource.ElevationData, resolution_x=0.0005, resolution_y=0.0005)


Thank you in advance
Tori
« Last Edit: December 05, 2024, 03:19:03 PM by Tori »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: export original colors as rgb with exportRaster
« Reply #1 on: December 04, 2024, 05:23:10 PM »
Hello Tori,

What do you mean by the color of the DEM point? The original color of the modeled scene or the false color of DEM as it is displayed in Metashape?
In first case, probably you can just export orthomosaic using the same resolution as the exported DEM and then just compare XY coordinates and take Z from DEM export and color - from the orthomosaic?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Tori

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: export original colors as rgb with exportRaster
« Reply #2 on: December 05, 2024, 03:55:23 PM »
Hi,

yes, I am refering to the color of the orignial scene, so the first. And from my current understanding exporting an orthomosaic with the same resolution should work, thank you.
Would I export it like this then?

Code: [Select]
path_DEM_color    = os.path.join(path, filenameDEM_color)
chunk.exportRaster(path = path_DEM_color,image_format = Metashape.ImageFormatXYZ,raster_transform = Metashape.RasterTransformNone,source_data =  Metashape.DataSource.OrthomosaicData, resolution_x=0.0005, resolution_y=0.0005)