Repository navigation
Expand file tree
/
Copy pathStackingMain.py
More file actions
56 lines (51 loc) · 1.57 KB
/
Copy pathStackingMain.py
File metadata and controls
56 lines (51 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 18 15:33:10 2018
@author: amolsingh
"""
import cv2
#help(cv2.xfeatures2d)
import os, time
import sys
from PIL import Image
from Stacking import stack
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#import glob
#%%
def stacker(folder):
# time1 = time.time()
images = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder,filename))
if img is not None:
images.append(img)
stacked = stack(images)
# time2 = time.time()
# fintime = time2 - time1
# print("Time: " + str(fintime))
return stacked
# newpath = folder
# os.chdir(newpath)
# cv2.imwrite("Stacked.png", stacked)
def stacker1(imgList):
time1 = time.time()
images = []
for imageFile in imgList:
img = cv2.imread(imageFile)
if img is not None:
images.append(img)
stacked = stack(images)
time2 = time.time()
fintime = time2 - time1
print("Time: " + str(fintime))
return stacked
#
#imgs = ['/Users/amolsingh/Documents/OhgamiLab/Images/Stacking Images/Q1.png', '/Users/amolsingh/Documents/OhgamiLab/Images/Stacking Images/Q1a.png', '/Users/amolsingh/Documents/OhgamiLab/Images/Stacking Images/Q1b.png']
#img = stacker1(imgs)
#cv2.imwrite('/Users/amolsingh/Documents/OhgamiLab/Images/Stacking Images/Stackedarray.png', img)
#%%
#img = stacker("/Users/amolsingh/Documents/OhgamiLab/Videos/FramesStackNStitch/OutputFrames28")
#cv2.imwrite("/Users/amolsingh/Documents/OhgamiLab/Videos/Stackedlmao.png", img)