Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the way multiple images are loaded #814

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions ExposureFusion/exposureFusion.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
import cv2
import numpy as np
import sys
import os


def readImagesAndTimes():
def readImagesAndTimes(dir_path):

filenames = [
"images/memorial0061.jpg",
"images/memorial0062.jpg",
"images/memorial0063.jpg",
"images/memorial0064.jpg",
"images/memorial0065.jpg",
"images/memorial0066.jpg",
"images/memorial0067.jpg",
"images/memorial0068.jpg",
"images/memorial0069.jpg",
"images/memorial0070.jpg",
"images/memorial0071.jpg",
"images/memorial0072.jpg",
"images/memorial0073.jpg",
"images/memorial0074.jpg",
"images/memorial0075.jpg",
"images/memorial0076.jpg"
]

#load images with os
filenames = [os.path.join(dir_path, f) for f in os.listdir(dir_path) if f.endswith('.jpg')]
images = []
for filename in filenames:
im = cv2.imread(filename)
im = cv2.resize(im, (500, 500))
images.append(im)

return images
Expand All @@ -36,6 +20,8 @@ def readImagesAndTimes():
# Read images
print("Reading images ... ")

dir_path = '' #path to images

if len(sys.argv) > 1:
# Read images from the command line
images = []
Expand All @@ -45,7 +31,7 @@ def readImagesAndTimes():
needsAlignment = False
else :
# Read example images
images = readImagesAndTimes()
images = readImagesAndTimes(dir_path=dir_path)
needsAlignment = False

# Align input images
Expand Down
17 changes: 8 additions & 9 deletions hdr/hdr.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import cv2
import numpy as np
import os


def readImagesAndTimes():

times = np.array([ 1/30.0, 0.25, 2.5, 15.0 ], dtype=np.float32)
def readImagesAndTimes(dir_path):

filenames = ["img_0.033.jpg", "img_0.25.jpg", "img_2.5.jpg", "img_15.jpg"]

#load images with os
filenames = [os.path.join(dir_path, f) for f in os.listdir(dir_path) if f.endswith('.jpg')]
images = []
for filename in filenames:
im = cv2.imread(filename)
im = cv2.resize(im, (500, 500))
images.append(im)

return images, times
return images

if __name__ == '__main__':
# Read images and exposure times
print("Reading images ... ")

images, times = readImagesAndTimes()

dir_path = '' #path to images
images, times = readImagesAndTimes(dir_path=dir_path)

# Align input images
print("Aligning images ... ")
Expand Down