From 1fa7fc25585a1d045a6ce2696aa7e6dddce637a5 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Feb 2023 10:46:34 +0100 Subject: [PATCH] Face detection + RGB chanels --- ProgrammingForFaceDetection.py | 11 +++++++++++ RGB_Chanels.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 RGB_Chanels.py diff --git a/ProgrammingForFaceDetection.py b/ProgrammingForFaceDetection.py index 83e9afc..f981c0b 100644 --- a/ProgrammingForFaceDetection.py +++ b/ProgrammingForFaceDetection.py @@ -1,6 +1,7 @@ # Programmin for Face detection # Haar Cascade import cv2 +import numpy as np # Charger le classificateur Haar Cascade face_cascade = cv2.CascadeClassifier("Haar_Cascade.xml") @@ -24,3 +25,13 @@ for x, y, w, h in faces: # Afficher l'image cv2.imshow("Faces", img) cv2.waitKey(0) + +# Split the image into its RGB channels +b, g, r = cv2.split(img) + +# Display the individual channels +cv2.imshow('Red channel', r) +cv2.imshow('Green channel', g) +cv2.imshow('Blue channel', b) +cv2.waitKey(0) +cv2.destroyAllWindows() diff --git a/RGB_Chanels.py b/RGB_Chanels.py new file mode 100644 index 0000000..834f7a7 --- /dev/null +++ b/RGB_Chanels.py @@ -0,0 +1,15 @@ +import cv2 +import numpy as np + +# Load the image +img = cv2.imread('Image.jpg') + +# Split the image into its RGB channels +b, g, r = cv2.split(img) + +# Display the individual channels +cv2.imshow('Red channel', r) +cv2.imshow('Green channel', g) +cv2.imshow('Blue channel', b) +cv2.waitKey(0) +cv2.destroyAllWindows()