38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
import cv2
|
|
from video_loader import VideoLoader
|
|
from background_heatmap import BackgroundHeatmap
|
|
|
|
if __name__ == '__main__':
|
|
|
|
projects_path = "C:\\UntrackedGit\\opencv_test\\him_projects"
|
|
loader = VideoLoader(projects_path)
|
|
groups = loader.get_recordings_grouped()
|
|
# out = cv2.VideoWriter('outpy.avi',cv2.VideoWriter_fourc\c('M','J','P','G'), 30, (512, 424), isColor=False)
|
|
for group in groups:
|
|
heatmaps = []
|
|
for recording in group[1]:
|
|
first = True
|
|
frames = VideoLoader.extract_frames(recording)
|
|
bgh = BackgroundHeatmap(VideoLoader.extract_frames(recording))
|
|
for frame in frames:
|
|
bgh.update(frame)
|
|
cv2.imshow("IR", frame)
|
|
# out.write(converted)
|
|
# cv2.imshow("Heatmap", heatmap.heatmap)
|
|
cv2.imshow("Background filter", bgh.lastframe)
|
|
cv2.moveWindow("Background filter", 600, 100)
|
|
if cv2.waitKey(1) & 0xFF == ord('q'):
|
|
break
|
|
heatmaps.append(bgh.heatmap)
|
|
cv2.destroyAllWindows()
|
|
|
|
for i, bgh in enumerate(heatmaps):
|
|
imname = "Heatmap " + str(i)
|
|
cv2.imshow(imname, bgh)
|
|
cv2.moveWindow(imname, 500 * i, 0)
|
|
cv2.waitKey(2000)
|
|
cv2.destroyAllWindows()
|
|
|
|
# out.release()
|
|
cv2.destroyAllWindows()
|