Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - christopher.giesige@sjsu.

Pages: [1]
1
I am trying to solve this by importing the mid-wave IR images, navigation and camera orientation reference data for the images, and reference data from the long-wave IR camera to be used as markers. The thought is by importing the long-wave reference data as markers, those markers can be used to help align the mid-wave images according to the geolocation points where the long-wave was georeferenced to.

Since the "Identification" of the long-wave images does not match that of the mid-wave (different frame numbering system), I try to match each marker to a mid-wave camera by longitude and latitude. If the marker has the same longitude and latitude as a camera, attach it to that camera. However, it has not really helped much. Any thoughts or suggestions are well appreciated!

Here is the code I have so far:
chunk = doc.addChunk()
chunk.label = "pass_" + telops_reference_path[95:-4]

# add images to chunk
chunk.addPhotos(telops_images)

# import references for photos
chunk.crs = Metashape.CoordinateSystem("EPSG::4326")


chunk.importReference(path = telops_reference_path, format = Metashape.ReferenceFormatCSV, skip_rows=1,
                      columns = 'nxyzcbaXYZCBA', delimiter = "\t", crs = Metashape.CoordinateSystem('EPSG::4326'))

chunk.importReference(path = workswell_markers_path, format = Metashape.ReferenceFormatCSV, skip_rows=2, columns = 'nxyzabcXYZABC',
                        delimiter = "\t", items = Metashape.ReferenceItemsMarkers, create_markers = True)


for camera in chunk.cameras:
    camera.reference.enabled = True
    camera.reference.rotation_enabled = True

for marker in chunk.markers:
    marker.reference.enabled = True
   
    marker_lon = marker.reference.location.x
    marker_lat = marker.reference.location.y
   
    marker_lon_str = str(marker_lon)
    marker_lat_str = str(marker_lat)

    closest_camera = None
   
    for camera in chunk.cameras:
        camera_lon = camera.reference.location.x
        camera_lat = camera.reference.location.y
       
        camera_lon_str = str(camera_lon)
        camera_lat_str = str(camera_lat)
           
        if camera_lon_str[0:8] == marker_lon_str[0:8] and camera_lat_str[0:6] == marker_lat_str[0:6]:
            closest_camera = camera
            # print(closest_camera)
   
    if closest_camera is not None:
        marker.projections[closest_camera] = Metashape.Marker.Projection()
    else:
        print(f"Could not find a matching camera for marker {marker.label} within tolerance.")
           
           

chunk.matchPhotos(downscale=0, filter_stationary_points=False, generic_preselection = True,
                  reference_preselection=True, reference_preselection_mode = Metashape.ReferencePreselectionSequential,
                  keypoint_limit = 20000, tiepoint_limit = 5000)

chunk.alignCameras()

realign_list = list()
for camera in chunk.cameras:
    if not camera.transform:
        realign_list.append(camera)
if realign_list:
    chunk.alignCameras(cameras = realign_list)

chunk.optimizeCameras(fit_f=True, fit_cx=True, fit_cy=True, fit_b1=False, fit_b2=False, fit_k1=True,
                       fit_k2=True, fit_k3=True, fit_k4=True, fit_p1=True, fit_p2=True, adaptive_fitting=True)

# doc.save()

chunk.importRaster(path = dem_path, raster_type = Metashape.DataSource.ElevationData,
                            crs = Metashape.CoordinateSystem('EPSG::4326'), nodata_value = -999999)

chunk.buildOrthomosaic(surface_data=Metashape.DataSource.ElevationData, blending_mode=Metashape.BlendingMode.MosaicBlending,
                                projection = Metashape.OrthoProjection(crs = Metashape.CoordinateSystem('EPSG::4326')))

chunk.exportRaster(path = output_mosaic_folder + str(chunk.label) + "_ww_to_telops.tif", format=Metashape.RasterFormatTiles,
                            image_format=Metashape.ImageFormat.ImageFormatTIFF, source_data = Metashape.OrthomosaicData,
                            white_background = False, save_alpha = True)

print(f"Mosaic exported for chunk: {chunk.label}")
doc.save()

2
Hey Metashape,

I have thermal aerial imagery taken of wildland fire with two different cameras: a mid-wave IR bandpass and long-wave IR bandpass. After building the orthomosaics, the mosaics from the long-wave camera georeference nicely, however, the mid-wave camera mosaics can be shifted quite a bit from the long-wave mosaic. Ideally, the mosaics from both cameras captured during the same time frame overlap precisely.

The mid-wave images I know can be tougher to work with, but any suggestions on ways that I could use the data from the long-wave camera to essentially bring the mid-wave images to align with them?

I am currently building the mosaics from both cameras in Metashape and then running an affine transformation on them to re-georeference the mid-wave mosaics to match with the long-wave mosaics, but thought maybe there is a way to get them to match in Metashape during the georeferencing process.

Any suggestions would be helpful.
Thank you,
Chris     

3
General / Re: Image Alignment and Inertial Reference Data
« on: April 25, 2024, 11:16:32 PM »
Yeah sure here is a drive file with the images from one pass and the reference data used with it: https://drive.google.com/drive/u/1/folders/0AC1kS-K6xtOHUk9PVA
If the drive doesn't work let me know. The angle accuracy is in degrees, but all of the units and info should be on the reference file.

Let me know if you need anything else. Good luck playing around with it and let maybe you are able to catch something I am not.

Thanks again for your help, this is great!

Chris

4
General / Re: Image Alignment and Inertial Reference Data
« on: April 24, 2024, 10:21:15 PM »
Hi Paul,

Thank you for getting back to me.

1. The accuracy of my GPS/IMU data is: Lon acc - 0.042, Lat acc - 0.046, Alt acc - 0.084, Roll acc - 0.046, Pitch acc - 0.045, Yaw acc - 0.114

2. The plane takes the images in one line for each pass, so like Screenshot(542) attached.

3. Yeah I can share an example of one plane pass, do you need the images and reference data? There is about 100-200 images

Thank you,
Chris

5
General / Image Alignment and Inertial Reference Data
« on: April 22, 2024, 11:49:39 PM »
Hey Metashape,

I am still trying to understand exactly how the reference data that we can import to images is working during alignment. I am working with thermal infrared images that were taken from an aircraft during multiple passes over a wildfire. I am essentially trying to create an orthomosaic for each pass over the fire. Each of the passes occurs over the same position of the fire.

To start, let's say my general workflow is to import thermal images into a chunk, add inertial references to the images (lon, lat, alt, roll, pitch, yaw, and accuracies), and then run the image alignment with highest accuracy and sequential reference preselection, key point limit = 40,000 and tie point limit = 10,000. I noticed that I get some variable results such as: during the image alignment, it may align the images with the point cloud projected up in the air instead of on the basemap, so there is zero resolution when I go to create an orthomosaic, and I may have to rerun the alignment several times before it correctly aligns the images so it can build the mosaic. There are also times when I run the alignment and it works, but then I go to run the alignment with the same images and same reference data again and the images align, but are shifted in their projection. So I align a set of images and build an orthomosaic, then align the same images again with the same reference data and build another mosaic, but the second mosaic is shifted either west or east from the first one. I know there is going to be some error in the accuracy and precision when georeferencing, but I have to do a lot of re-alignments or deleting chunks and re-creating the chunks to get through several passes over the fire. I guess my question is, is it typical to see this type of variability or inconsistency when aligning the images?

Second is, how much weight is the reference data given when alining and projecting the images to build the mosaic? From my understanding metashape uses points across images to help align them and then kind of uses those points with the reference data to create the aligned end result, but does it give priority to the reference data to align the images and then make some corrections with the image points to achieve a final result? Or weight them equally more or less?

Sorry for the long questions, I am still just trying to understand exactly how the reference data is used with image points to align the images and eventually create an orthomosaic, and why I might get such variability in the alignment process or placement of the images in the orthomosaics.

Thanks again for the help,
Chris

6
Python and Java API / Re: Importing References
« on: February 16, 2024, 02:00:35 AM »
Thank you Paulo, that was it. Can't believe I missed that.

Chris

7
Python and Java API / Importing References
« on: February 15, 2024, 11:24:49 PM »
Hey Metashape team,

I am working with the python api and trying to import a data reference for the images in a chunk. The issue I am having is that when I import the reference data using the api the image points show up on the basemap as being over the ocean instead of at the correct coordinates (attached img 538). When I go into the Metashape Pro program and import the reference data manually the image points show up in the correct location. I noticed that when I import the references with the api and check the references in the program the coordinate system shows up as Easting and Northing (img 538), but when I import them manually the coordinate system shows up how the reference csv file has them stored as Longitude and Latitude. I have also attached screenshots of what my reference data csv file look like so you can see the output data and coordinate system it has (attached img 539) along with how the reference data file looks that I am trying to import (attached img 540).

This is the code I have so far for this process:
image_folder = 'path to images'
find_photos = find_files(image_folder, [".jpg"])
chunk = doc.addChunk()
chunk.addPhotos(find_photos)
chunk.crs = Metashape.CoordinateSystem("EPSG::32641")
chunk.importReference(path = "path to reference csv file", format = Metashape.ReferenceFormatCSV, columns = 'ncbayxzCBAYXZ', delimiter = "\t")

I hope this makes sense and let me know if any of this is not clear or I need to expand on the explanation. Any suggestions on fixing this issue?

Thank you,
Chris

Pages: [1]