PBL4_2
Loading...
Searching...
No Matches
main.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4
8
9import cv2 as cv
10from imageBlender import ImageBlender
11from gammaCorrector import GammaCorrector
12
13
18 # ˅
19
20 # ˄
21
22
28 def __init__(self, gamma, blend_ratio=0.21):
29 # ˅
31 self.image_blender = ImageBlender(self.gamma_corrector, blend_ratio)
32 # ˄
33
34
41 def adjust_images(self, left_image_path, right_image_path):
42 # ˅
43 adjusted_left, adjusted_right, blended_image = self.image_blender.process_images(left_image_path, right_image_path)
44 return adjusted_left, adjusted_right, blended_image
45 # ˄
46
47# Script-level code to demonstrate the use of ImageProcessor
48# ...
49
50left_image_path = 'Imageleft0.png'
51right_image_path = 'Imageright0.png'
52
53gamma_value = 1.05
54processor = ImageProcessor(gamma_value)
55
56adjusted_left, adjusted_right, blended_image = processor.adjust_images(left_image_path, right_image_path)
57
58cv.imwrite('adjusted_left.jpg', adjusted_left)
59cv.imwrite('adjusted_right.jpg', adjusted_right)
60cv.imwrite('blended_image.jpg', blended_image)
61
62cv.imshow('Adjusted Left Image', adjusted_left)
63cv.imshow('Adjusted Right Image', adjusted_right)
64cv.imshow('Blended Image', blended_image)
65cv.waitKey(0)
66cv.destroyAllWindows()
A class for performing gamma correction on images.
A class for blending two images using a specified blend ratio and gamma correction.
A class for processing images using gamma correction and blending.
Definition main.py:17
adjust_images(self, left_image_path, right_image_path)
Adjusts and blends two images.
Definition main.py:41
__init__(self, gamma, blend_ratio=0.21)
Constructor for ImageProcessor.
Definition main.py:28