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

Pages: [1] 2 3 ... 13
1
General / Re: Rename source images by date and time when images were taken
« on: December 24, 2024, 10:39:02 PM »
Hi CheeseAndJamSandwich.

Thanks for your advice. If you satisfied with this software, then it should be good enough for me, hopefully.
Unfortunatelly, for this project I can't to much. It would good that some drones 'automatically' saves photos like they are saved in modern day smartphones with date and time clearly visible within image name. For example if picture was taken in 23:59 on 24.12.2024. then image name would be 20241224_235900...not like, i mean instead of like DJI Mavic Mini 1 stores images from DJI_0001 to image DJI_0999 and when it reaches those DJI_0999 then creates new folder starting again from DJI_0001 to DJI_0999.

Thanks bro and merry Christmas to you!

J.K.

2
General / Rename source images by date and time when images were taken
« on: December 22, 2024, 12:14:12 PM »
Hi to everyone,
Does someone know to write a script which would replace original image name of each photo in chunk with their date and time of capture?
Here's the thing, I have multiple photos with same name, but also I want to order images on the way how I took them in the field. Unfortunatelly project is very large and time consuming will be if I decide to process everything again. I think that the best option to solve this is to rename source images with captured date and time in reference tab. Of course pictures have date and time when referring to photos tab. (Check picture in attachments)

For example for image DJI_0001 rename name would be 20230513_133840 (Check for image in attachments)

Have a nice day!

J.K.

3
Hi Paulo,

Thanks for your time and effort to make this script that works properly.
I'm sorry cause my feedback to you is bit late.
Best regards!

J.K.

4
Hi to everyone,
Does someone know to write a script which would replace original image name of each photo in chunk with their date and time of capture?
Here's the thing, I have multiple photos with same name, but also I want to order images on the way how I took them in the field. Unfortunatelly project is very large and time consuming will be if I decide to process everything again. I think that the best option to solve this is to rename source images with captured date and time in reference tab. Of course pictures have date and time when referring to photos tab. (Check picture in attachments)

For example for image DJI_0001 rename name would be 20230513_133840 (Check for image in attachments)

Have a nice day!

J.K.

5
Feature Requests / Re: Add Scale bar option during ortophoto export
« on: December 21, 2024, 09:01:28 AM »
Hi Alex and others,
Is there a maybe written Python script which will add scale bar, mentioned in tittle of this conversation, to the exported orthomosaic?
I would also like to have built in that feature, instead of opening GIS software...like someone said "it's time consuming"...apsolutely right.
Have a nice day!
J.K.

6
Hi Paulo,
If everything I entered well this is what I get from MY previous code,
check for the image.
I get this error message: "name 'location_ecef' is not defined"

Have a nice day!

J.K.


7
Hi Paulo,
Well, I'm getting strange error while placing your code into my script so I suppose that I put your code wrongly to initial script.
Here's how now look script, which in fact DOES NOT WORK but anyways.
If you know better please point on my errors.

Code: [Select]
import Metashape
import math

def matrix_to_euler(matrix):
    """Pretvara 3x3 rotacijsku matricu u Eulerove kutove (yaw, pitch, roll)."""
    yaw = math.degrees(math.atan2(matrix[1, 0], matrix[0, 0]))
    pitch = math.degrees(math.atan2(-matrix[2, 0], math.sqrt(matrix[2, 1]**2 + matrix[2, 2]**2)))
    roll = math.degrees(math.atan2(matrix[2, 1], matrix[2, 2]))
    return yaw, pitch, roll

chunk = Metashape.app.document.chunk
cameras = [c for c in chunk.cameras if c.type == Metashape.Camera.Type.Regular]
crs = chunk.crs
T = chunk.transform.matrix

for c in cameras:
    if not c.transform:
        c.reference.location = None
        c.reference.rotation = None
        continue

    # Postavljanje referentne lokacije
    coord = crs.project(T.mulp(c.center))
    c.reference.location = coord

    ecef_crs = crs.geoccs
    rotation_ecef = (T * c.transform).rotation() * Metashape.Matrix.Diag((1, -1, -1))
    if chunk.euler_angles == Metashape.EulerAnglesOPK or chunk.euler_angles == Metashape.EulerAnglesPOK:
        localframe = crs.localframe(location_ecef)
    else:
        localframe = ecef_crs.localframe(location_ecef)
    R = localframe.rotation() * rotation_ecef  # Rotacijski dio transformacijske matrice kamere
    c.reference.rotation = Metashape.utils.mat2euler(R, chunk.euler_angles)

print("Script finished")

Have a nice day!!
Bye :)
J.K.

8
Hi Paulo,
Thanks for participation,
Can you please tell on which place should i put your code to mine?
Have a nice day!
J.K.

9
Well,
Source code does not work for me.
Please help me.
Thanks:)
BYE;
J.K.

10
Hi to everybody,
If someone is here, can someone tell me is this script good enough to replace source values in reference tab with estimated ones, for cameras, including rotations (yaw, pitch, roll)

Here's the code...
Code: [Select]
import Metashape
import math

def matrix_to_euler(matrix):
    """Pretvara 3x3 rotacijsku matricu u Eulerove kutove (yaw, pitch, roll)."""
    yaw = math.degrees(math.atan2(matrix[1, 0], matrix[0, 0]))
    pitch = math.degrees(math.atan2(-matrix[2, 0], math.sqrt(matrix[2, 1]**2 + matrix[2, 2]**2)))
    roll = math.degrees(math.atan2(matrix[2, 1], matrix[2, 2]))
    return yaw, pitch, roll

chunk = Metashape.app.document.chunk
cameras = [c for c in chunk.cameras if c.type == Metashape.Camera.Type.Regular]
crs = chunk.crs
T = chunk.transform.matrix

for c in cameras:
    if not c.transform:
        c.reference.location = None
        c.reference.rotation = None
        continue

    # Postavljanje referentne lokacije
    coord = crs.project(T.mulp(c.center))
    c.reference.location = coord

    # Postavljanje referentne rotacije
    R = c.transform.rotation()  # Rotacijski dio transformacijske matrice kamere
    yaw, pitch, roll = matrix_to_euler(R)
    c.reference.rotation = Metashape.Vector([yaw, pitch, roll])

print("Script finished")



Thank you very much.
For reason, I'll explain later.

Have a nice day!

J.K.

11
Hi, Alexey again,
I found that source values for Pitch, Roll and Yaw did not replaced with estimated ones cause there's huge errors?
Why's that?

Best regards!

J.K.

12
Hi Alexey,
Thank you so much!
I'm sorry cause I did not response to you earlier.
This script work so fast, I mean...Almost that I did not noticed what happened when I run script.
By the way, if you interested (or if you not) but. without script, I was doing on my own...with Excel approach...check this link..if you're interested: https://drive.google.com/drive/folders/1vC2atEArMEUOEAkka3nxXQn7LWrrwSSF?usp=sharing
But, I need intervals from every part of exported cameras from reference tab and also initial row when changing image intervals.
Later, I clear values from reference pane on selected images and then import values from Excel to these cameras.
Have a nice day :)

J.K.
   

 

13
General / Replace source values with estimated values in reference tab/pane
« on: December 16, 2024, 02:04:48 PM »
Hi to everyone,
So here's the thing. I have one huge project with more than 1000 photos included for sure and one big trouble....well, I have multiple images with same names but they were shoot from different locations. One thing is clear, I can't go to that site anymore. These images was stored on different directories on my pc. Problem is that I want to enter, somehow automatically estimated values instead source values to minimize camera errors in report (cause source values are wrong, cause I did not use GPS RTK (or PPK) while capturing photos...)

My 'expected' workflow to replace source values with estimated was:
1.) Export reference values within reference pane tab. I choose 'cameras' when exporting and estimated values as well.
2.) Then I (re)import these estimated values as source values within import reference dialog...

Well, result is duplicate or even triple source values on same photo(s) name(s) (or even more than that). There's option to enter values manually but there's a tone of photos that needs to be edited...and that would took a while. 

I made a list of how many photos are duplicated or,  shows on more than that (in attachments you have screenshots of that too)

List of Photo names intervals and their repeating
DJI_0001 - DJI_0019 (IMG) 3X
DJI_0020 - DJI_0041 (IMG) 4X
DJI_0042 (IMG) 3X
DJI_0043 - DJI_0071 (IMG) 4X
DJI_0072 - DJI_0128 (IMG) 3X
DJI_0129 - DJI_0139 (IMG) 2X
DJI_0140 - DJI_0266 (IMG) 3X
DJI_0267 - DJI_0400 (IMG) 2X
DJI_0401 - DJI_0404 (IMG) 1X
DJI_0405 - DJI_0412 (IMG) 2X
DJI_0413 - DJI_0418 (IMG) 1X
DJI_0419 - DJI_0474 (IMG) 2X
DJI_0475 - DJI_0526 (IMG) 3X
DJI_0527 - DJI_0538 (IMG) 2X
DJI_0539 - DJI_0548 (IMG) 3X
DJI_0549 - DJI_0754 (IMG) 4X
DJI_0755 - DJI_0850 (IMG) 3X
DJI_0851 - DJI_0860 (IMG) 2X
DJI_0861 - DJI_0904 (IMG) 3X
DJI_0905 - DJI_0965 (IMG) 2X
DJI_0966 - DJI_0999 (IMG) 3X

Well, that's really big problem when you have older drone, in my case DJI Mavic Mini 1, and when Image number reaches 0999 then drone creates new folder with images starting from 0001, well that's the reason why I'm asking this. If someone know how to modify, on DJI Mavic Mini 1, that photos name use some conventional 'image name' format like year-month-day-hours-minutes-seconds (for example like phones have...for example: 20241216_115300.jpg) I will appreciate that also.

Please can you help me with this... I'll leave (in attachments) few images if you did not understand me what I want to accomplish, and what problem is...and of course link with the file exported from reference tab containing all stuff like (#label, X,Y,Z, Yaw,Pitch,Roll...etc)

Link to txt file with cameras positions informations: https://drive.google.com/file/d/1605LVauQniXbotASR8LMFArewXktCMk_/view?usp=drivesdk

Thank you very much for each suggestion or maybe solution to this issue.

Have a nice day!

J.K.

14
General / Re: Key Points Meaning
« on: December 12, 2024, 03:28:54 PM »
Hi Paulo,
Do you mean scale is 1/2.8 multiplied by 1/2.8 cause pixels are squared?
Thanks:)
J.K.

15
General / Re: Key Points Meaning
« on: December 08, 2024, 08:59:43 PM »
Hi Paulo,

Thanks for participating.
To be honest with you, I did not quite understand what those 2 (suppose Mean Key Point size) and why is it measured in pixels on my report. In fact my Mean Key Point Size, from Agisoft Report was not 2, instead of 2 it is 2.28938 pix.

I see that you maybe understand what is told in the article, but I quite don't know what you actually calculate (cause you used micrometers) and how you came to that conclusion? What situation/calculation would be if, for example, if is hypoteticaly Image Keypoint Scale > 1/5?

To be honest, still I don't understand how did you get these numbers...that's a point.

Have a nice day:)

J.K.

Pages: [1] 2 3 ... 13