Skip to content
Snippets Groups Projects
Commit d54bcaf3 authored by LexvanGastel's avatar LexvanGastel
Browse files

vraag 21

parent 46c5b83e
Branches
No related tags found
No related merge requests found
......@@ -16,13 +16,14 @@ class ImageProcessor:
return red_channel, green_channel, blue_channel
def convert_to_hsv(self):
return hsv_image
hsv_image =cv2.cv2.cvtColor(self.image, cv2.COLOR_BGR2HSV)
class Plotter:
@staticmethod
def __init__(self):
pass
@staticmethod
def plot_image_channels(image, red, green, blue):
fig, axes = plt.subplots(2, 2, figsize=(12,8))
......@@ -43,12 +44,31 @@ class Plotter:
axes[1,1].axis("off")
plt.show()
def plot_histograms(self, image):
return None
@staticmethod
def plot_histograms(red, green ,blue):
fig, axes = plt.subplots(1,3, figsize =(15,5))
axes[0].hist(red.ravel(), bins=256, color="red", alpha= 0.7)
axes[0].set_title('Red Channel Histogram')
axes[0].set_xlabel('Pixel Intensity')
axes[0].set_ylabel('Frequency')
axes[1].hist(green.ravel(), bins=256, color="green", alpha= 0.7)
axes[1].set_title('Green Channel Histogram')
axes[1].set_xlabel('Pixel Intensity')
axes[1].set_ylabel('Frequency')
axes[2].hist(blue.ravel(), bins=256, color="blue", alpha= 0.7)
axes[2].set_title('Blue Channel Histogram')
axes[2].set_xlabel('Pixel Intensity')
axes[2].set_ylabel('Frequency')
plt.show()
image_path = "traffic_light_image_1.png"
processor = ImageProcessor(image_path)
red, green, blue = processor.get_color_channels()
Plotter.plot_image_channels(processor.image_rgb,red,green,blue)
\ No newline at end of file
Plotter.plot_image_channels(processor.image_rgb,red,green,blue)
Plotter.plot_histograms(red, green, blue)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment