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 - fabvin

Pages: [1] 2
1
Python and Java API / Transformation type in fiducials marks
« on: November 23, 2023, 11:10:00 AM »
Dear all,
I would like to change the transformation type [Affine, Conformal, Projective] before fiducial calibration, but I didn't find the corresponding command in the metashape (2.0.3) python reference guide.
Do you have an idea?
Best regards
Fabrice

2
Python and Java API / Re: Enable fiducial search
« on: November 21, 2023, 11:50:01 AM »
Thank you Alexey, it works perfectly!
The complete code:

Code: [Select]
def detect_fiducials():
    doc =scan.app.document
    for chk_sel in doc.chunks:
      for sensor in chk_sel.sensors:
        sensor.film_camera = True
      if chk.enabled != True:
        chk_sel.detectFiducials(generate_masks=True,generic_detector=True)
      else:
        chk_sel.detectFiducials(generate_masks=True, generic_detector=False, right_angle_detector=False,fiducials_position_corners=False,fiducials_position_sides=False)


I have two other questions:

Is it necessary to indicate the real size of the physical support of the scan (I have no idea...) or having the exact position of the fiducial marks is sufficient for resampling?

The detectFiducials algorithm detects systematically 8 fiducials marks (auto_0 to auto_7) that figurate in the table but the (auto_4,..., auto_7) marks are not present in the images. I manually delete the 4 last marks but I wonder if it's really necessary?

Best regards, and thanks again for your quick answer!

3
Python and Java API / Enable fiducial search
« on: November 17, 2023, 03:12:13 PM »
Dear all,
I wanted to create a code to detect fiducials in scanned images on all chunks of a metashape project, but I need to know the python code to enable the detection of fiducials (as in tools, Camera calibration, Film camera with fiducial marks):

def detect_fiducials():
    doc =scan.app.document
    for chk_sel in doc.chunks:
       code to enable fiducial detection
      chk_sel.detectFiducials(generate_masks=True,generic_detector=True)

Best regards

4
General / Re: Error Empty pairs list
« on: December 21, 2021, 10:11:13 AM »
Dear Alexey
Both key points are present in the two chunks I am trying to align before merging, then when I merge the two chunks, I got the error message "Empty pairs list". Metashape creates a merged chunk nonetheless, but the key points disappeared from the second chunk.

I am only interested in having key points in the images of the second chunk, in order to align the new frames to the chunk 1. I don't know exactly the purpose of the Merge Tie Points option? I resumes, frame by frame, the alignment on the chunk 1?

Best regards
Fabrice

5
General / Error Empty pairs list
« on: December 19, 2021, 02:07:22 PM »
Hello,
Running on version 1.7.5 build 13229, I get the error message "Empty pairs list" when trying to merge two aligned chunks. Reading the topics https://www.agisoft.com/forum/index.php?topic=13261.0 and https://www.agisoft.com/forum/index.php?topic=12867.msg57033#msg57033 did not allow me to find the answer to the problem.

My goal seems to be quite simple: I need to add a new set of images to an already aligned chunk.
Here is my process:
* select Keep Key point in the Preference/advanced
* align the chunk 1
* add new cameras to a new chunk: chunk 2
* align the chunk 2
* merge the two chunks (Here is the problem: Error Empty pairs list)
Consequently, I have no key points in the pictures of the chunk 2 in the merged chunk.

Unfortunately, when I add directy the new pictures to the chunk 1 and I select Align Photos with  the box "reset current alignment" unchecked, it doesn't work because I haven't any stored key points in the new pictures.

Best regards
Fab

6
Bug Reports / Re: Display of additionnal chunk in Classic Theme
« on: December 07, 2020, 02:13:26 PM »
Yes sorry Alexey
It is finally a problem from my script. I need to run it after downloading the images, unless it did not work.
I can delete my post if necessary. Sorry for the inconvenience.
Best regards

7
Bug Reports / Display of additionnal chunk in Classic Theme
« on: December 07, 2020, 12:21:52 PM »
Dear all
I observed that the display of an additionnal chunk created using the python script mergeChunk appeared in the Dark Theme of the console, but not in the classical theme (Metashape version 1.6).
Best regards

8
Python and Java API / Import camera GPS position
« on: December 02, 2020, 07:59:25 PM »
Dear all
I wanted to know how to properly import GPS positioning of a set of images using a csv file with, in columns: label, East, North?
Thank you in advance for your answer.
Best regards
Fab

9
Python and Java API / Re: Pixel to 3D code very slow
« on: November 20, 2020, 07:03:41 PM »
Thank you Alexey for the usefull advices.
Unfortunately, replacing camera.transform.mulp(sensor.calibration.unproject(point2D)) in your function with camera.unproject(point2D) and commenting the writing block of the code did not improve its speed.

But trying to test dense_cloud.pickpoint instead of model.pickpoint was the solution! 10 s instead of 1 hour, thank you Alexey!

Best regards

10
Python and Java API / Re: Problem with mergeChunks on list of chunks
« on: November 20, 2020, 03:22:02 PM »
Thank you Alexey
It works fine, providing the code:

Code: [Select]
doc = Metashape.app.document
doc.mergeChunks(chunks=[chunk.key for chunk in doc.chunks])

Best regards
Fabrice

11
Python and Java API / Pixel to 3D code very slow
« on: November 20, 2020, 03:20:25 PM »
Dear all
I proposed a code (below) to extract world 3D coordinates from image pixels of each image of an already aligned chunk.

The code works well, but is extremly long, even if I sample the pixels of the images (about 2 hours/image). Have you an idea on how to speed it up?
Best regards
FabVin


Code: [Select]
import Metashape, math, os, csv

# Pixel coordinates to 3D coordinates
def pixel_to_point3D(imX,imY):
    point2D = PhotoScan.Vector([imX, imY])
    sensor = camera.sensor
    v = chunk.model.pickPoint(camera.center, camera.transform.mulp(sensor.calibration.unproject(point2D)))
    if(v==None):return None
    v_t = chunk.transform.matrix.mulp(v)
    v_t.size = 3
    v_out_world = chunk.crs.project(v_t)
    return v_out_world

# Create a sequence of numbers
def seq(start,stop,increment):
    n=list()
    for num in range(start,stop):
        if num % increment == 0:
            n.append(num)
            continue
        pass
    return n

doc=PhotoScan.app.document

shift=PhotoScan.Vector([727290,6265210,70])

for chunk in doc.chunks:
    for camera in chunk.cameras:
        with open(path+'OUT/COORDS/'+chunk.label+'/'+camera.label.split(".")[0]+'.csv', 'wt') as csvfile:
            spamwriter=csv.writer(csvfile,delimiter=',',quotechar='|',quoting=csv.QUOTE_NONE,lineterminator='\n')
            for y in seq(0,6016,50):
                for x in seq(0,4000,50):
                    result=pixel_to_point3D(x,y)
                    if(result != None):
                        result=result-shift
                        spamwriter.writerow([x]+[y]+[round(result[0],3)]+[round(result[1],3)]+[round(result[2],3)])


12
General / Re: Add new images to an already aligned chunk
« on: November 20, 2020, 11:47:40 AM »
Finally, it works, but the time to align the new images to an already aligned chunk is extremely long... It takes 12 hours to add 50 supplementary images whereas the time necessary to align those 50 images by themselves didn't exceed one hour.

I consider the following parameters for alignment:

Accuracy: High
Generic, Reference and Reset current alignment: unchecked
Key point limit: 200 000
Tie point limit: 20 000
Guided image matching: unchecked
Adaptive camera model fitting: checked

Maybe the scrolling list: Source/Estimated/Sequential is the key of the problem. I select Sequential but maybe it was the wrong option?

Best regards
Fab


13
Python and Java API / Problem with mergeChunks on list of chunks
« on: November 08, 2020, 12:48:43 AM »
Dear all
I get an error message : « Error : Empty chunk list » when I tried to use the command Metashape.app.document.mergeChunks(chunks=list_chunks_valid) where list_chunks_valid is a list of chunks defined above.

Event when I tried :
Metashape.app.document.mergeChunks(chunks=Metashape.app.document.chunks())

I get the same error message.

Did anyone try the mergeChunks command to a specified list of chunks ?
Best regards
Fabrice

14
General / Re: Add new images to an already aligned chunk
« on: November 08, 2020, 12:47:24 AM »
Thank you very much, Alexey, it works perfectly!

15
General / Add new images to an already aligned chunk
« on: October 26, 2020, 12:59:39 AM »
Dear all,
I wanted to know if it is possible to add new images to an already aligned chunk, for example, when we process a chunk with a lot of images that took many times for alignment, then we took new pictures in the field to complete some parts of the chunk, and we want to keep the aligned images during the new alignment procedure.
Is there a way to do that, without considering the merging chunk options as we wanted to use the SIFT algorithm for aligning the new images on the existing chunk?
Best regards
FabVin


Pages: [1] 2