Hi,
I manage to flip images with this short easy code:
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