Skip to content
Snippets Groups Projects
Commit a3604bd2 authored by Jean-Marie Favreau's avatar Jean-Marie Favreau
Browse files

Add a new output (control image)

parent 04934bf7
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,8 @@ Options:
--sizex=Y Size of the image (Y)
-m, --output-uv=FILE Save the unfolded mesh as an UV file (format PLY,
containing also the scalar values)
-c, --control-image=FILE Save an image that contains triangle distorsion,
for control
-h, --help Print this message and exit.
INPUT is a mesh file with associated scalar values (available formats: PLY)"""
......@@ -50,9 +52,9 @@ def usage():
def main():
try:
opts, args = my_getopt(sys.argv[1:], "x:y:z:r:i:m:h", ["x=", "y=", "z=",
opts, args = my_getopt(sys.argv[1:], "x:y:z:r:i:m:hc:", ["x=", "y=", "z=",
"radius=", "output-image=", "output-uv=", "help",
"sizex=", "sizey="])
"sizex=", "sizey=", "control-image="])
except getopt.GetoptError as msg:
# print help information and exit:
print("Error: " + msg)
......@@ -63,6 +65,7 @@ def main():
sizey=512
outputImage = ""
outputMapping = ""
controlImage = ""
x = 0
y = 0
z = 0
......@@ -79,9 +82,9 @@ def main():
if o in ("-z", "--z"):
z = float(a)
coords += 4
if o == "sizex":
if o == "--sizex":
sizex = int(a)
if o == "sizey":
if o == "--sizey":
sizey = int(a)
if o in ("-r", "--radius"):
r = float(a)
......@@ -89,6 +92,8 @@ def main():
outputImage = a
if o in ("-m", "--output-mapping"):
outputMapping = a
if o in ("-c", "--control-image"):
controlImage = a
if o in ("-h", "--help"):
usage()
sys.exit()
......@@ -142,6 +147,13 @@ def main():
result.fill(0)
mapping.toImageFromMap(result, discmap)
result.save(outputImage)
if controlImage != "":
print("Save control image (" + controlImage +")")
result = taglut.UCharCImg(sizey, sizey, 1, 1)
result.fill(0)
mapping.toImageDrawDistortions(result)
result.save(controlImage)
if nbIter < 0:
print("Abording.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment