numpyHDR/makehdr.py

50 lines
1.2 KiB
Python
Raw Normal View History

2023-03-24 18:57:44 +01:00
#!//usr/bin/python3
import file_utility as file
2023-03-24 19:16:41 +01:00
import numpyHDR as hdr
2023-03-24 18:57:44 +01:00
'''CLI application for HDR experiments'''
stack = []
select = input("Select Image Source: 1 - Raspicam, 2 - From File, 3 - Image sequence, 4 debug: ")
if int(select) == 1:
import picamburst as pcb
#Get sequence from raspicam
stack = pcb.get_exposure_stack()
if int(select) == 2:
path_list = []
i= 0
nr = input("How many images? :")
for image in range(int(nr)):
i += 1
image = input(f"Enter filename {i}: ")
path_list.append(image)
2023-03-24 19:33:28 +01:00
stack = file.openImageList(path_list, True)
2023-03-24 18:57:44 +01:00
if int(select) == 3:
path_list = []
i = 0
nr = input("How many images? :")
image = input(f"Enter first filename without seq Nr and .jpg {i}: ")
for i in range(int(nr)):
filename = f"{image}{i}.jpg"
path_list.append(filename)
2023-03-24 19:33:28 +01:00
stack = file.openImageList(path_list, True)
2023-03-24 18:57:44 +01:00
if int(select) == 4:
path_list = ['test_hdr0.jpg', 'test_hdr1.jpg', 'test_hdr2.jpg']
2023-03-24 19:33:28 +01:00
stack = file.openImageList(path_list, True)
2023-03-24 18:57:44 +01:00
print(path_list)
#Process HDR with mertens fusion and post effects
result = hdr.process(stack, 1, 1, 1, True)
#Save Result to File
file = file.saveResultToFile(result, 'hdr/result', 75)