Forum

Author Topic: Images flipped during video import  (Read 1486 times)

neavrys

  • Newbie
  • *
  • Posts: 18
    • View Profile
Images flipped during video import
« on: October 09, 2019, 07:18:13 PM »
Hi,

I proceed an area survey with Metashape and the results are flipped, upside down, parse and dense, DEM, etc. Z is inverted, Reset view is the other side of the landscape. Also, the cameras are “buried underground.” GCP coordinates are not inverted. The camera positions are computed, not inserted. Same for the camera calibration.

I thought that drone camera was 180 rotated and Metashape would deal easily with this. Further analysis of the problem brings me to believe that the drone camera is not rotated. But images are flipped during the video import inside Metashape.

Reading the video VideoLan shown that I’m right. Metashape video import flip imported images from the original.

Images wroth 1000 words:
In attachments:
ok_orientation_bad Z.jpg ==> View of tie points with reset view, show good orientation,with a bad Z axis. Tree make stalactites...
Bad_orientation_OK_Z.jpg ==> View of other side of the tie points show bad orientation, with a good Z axis. Tree tower, etc. are good. But flipped based on the X axis.

There is a way to deal with this inside current project? Without losing GCP flags, etc.

How do I deal with this for future project?

Many thanks,

Alex
« Last Edit: October 09, 2019, 08:08:13 PM by neavrys »

neavrys

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Images flipped during video import
« Reply #1 on: October 09, 2019, 08:37:33 PM »
Attachment show clear flipped import. Video do not have GPS, EXIF ,etc.

At left : import video module from Metashape (OK orientation)
At Right : Exported images, opened with Windows photos (Flipped)


?!?!?

Alex
« Last Edit: October 10, 2019, 04:32:35 PM by neavrys »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13210
    • View Profile
Re: Images flipped during video import
« Reply #2 on: October 10, 2019, 05:39:17 PM »
Hello Alex,

Can you please send the example of the video file that gets flipped on import and also the PSZ project file with the alignment results only (and markers) to support@agisoft.com, so that we could reproduce the problem with the video and check, if anything could be done with the project.
Best regards,
Alexey Pasumansky,
Agisoft LLC

neavrys

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Images flipped during video import
« Reply #3 on: October 10, 2019, 10:05:56 PM »
The package has been sent to support.

I hope that I won't trowed to the garbage, my thousand of GCP points mouse clicks...  :-\

Many thanks,

Alex

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13210
    • View Profile
Re: Images flipped during video import
« Reply #4 on: October 11, 2019, 05:30:57 PM »
Hello Alex,

Thank you for sending the email, we will check the provided data.

I'll get back to you as soon as have more information regarding the issue.
Best regards,
Alexey Pasumansky,
Agisoft LLC

neavrys

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Images flipped during video import
« Reply #5 on: October 28, 2019, 05:34:28 PM »
Hi,

I manage to flip images with this short easy code:

Code: [Select]
import cv2
from os import listdir, makedirs
from os.path import isfile, join, exists


def verifyPath(path):
    """
    Evaluate the existance of the path, and if not exist, the path will be created.
    :param path: The path to verified.
    :return: None
    """
    if not exists(path):
        print("The path {} do not exist!".format(path))
        print("It has been created for your comfort.".format(path))
        makedirs(path)

    return path

# Paths
inputPath = r""
outputPath = r""
flag_show = False

# Get all image filenames
fileNameList = [f for f in listdir(inputPath) if isfile(join(inputPath, f))]
verifyPath(outputPath)

# Showing parameters
if flag_show is True:
    cv2.namedWindow('Original image', cv2.WINDOW_NORMAL)
    cv2.resizeWindow('Original image', 600, 600)
    cv2.namedWindow('Flipped vertical image', cv2.WINDOW_NORMAL)
    cv2.resizeWindow('Flipped vertical image', 600, 600)

# Pass and flip all images
for fl in fileNameList:
    print(fl)
    img = cv2.imread(inputPath + r"/" + fl)
    flipVertical = cv2.flip(img, 0)
    cv2.imwrite(outputPath + r"/" + fl, flipVertical)
    if flag_show is True:
        cv2.imshow('Original image', img)
        cv2.imshow('Flipped vertical image', flipVertical)
        cv2.waitKey(0)

if flag_show is True:
    cv2.destroyAllWindows()


Unfortunately, GCP Target that I identify does't fit anymore. There are 19 targets with more then a 1000 images..... So, how I can flip the image plane coordinates of these GCP too? That would be greatly appreciated!

Many thanks,

Alex
« Last Edit: October 28, 2019, 05:44:30 PM by neavrys »