Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ImageA1.png] [ImageA2.png] [ImageB1.png] [ImageB2.png] For the above four images, I have written the following Python code to detect and count the eyes in each image.

image text in transcribed

[ImageA1.png]

image text in transcribed

[ImageA2.png]

image text in transcribed

[ImageB1.png]

image text in transcribed

[ImageB2.png]

For the above four images, I have written the following Python code to detect and count the eyes in each image. For the images ImageA1.png and ImageA2.png the count of eyes are perfect i.e. "2". However, the count of eyes for ImageB1.png and ImageB2.png are "1" and "0" respectively. Kindly identify the issue and how to resolve this.

import cv2 import numpy as np img1 = cv2.imread('ImageA1.png') img2 = cv2.imread('ImageA2.png') img3 = cv2.imread('ImageB1.png') img4 = cv2.imread('ImageB2.png') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') eyes1 = eye_cascade.detectMultiScale(img1, scaleFactor=1.1, minNeighbors=5, minSize=(10, 10),flags=cv2.CASCADE_SCALE_IMAGE) print('Number of detected Eyes in Face1:', len(eyes1)) eyes2 = eye_cascade.detectMultiScale(img2, scaleFactor=1.1, minNeighbors=5, minSize=(10, 10),flags=cv2.CASCADE_SCALE_IMAGE) print('Number of detected Eyes in Face2:', len(eyes2)) eyes3 = eye_cascade.detectMultiScale(img3, scaleFactor=1.1, minNeighbors=5, minSize=(10, 10),flags=cv2.CASCADE_SCALE_IMAGE) print('Number of detected Eyes in Face3:', len(eyes3)) eyes4 = eye_cascade.detectMultiScale(img4, scaleFactor=1.1, minNeighbors=5, minSize=(10, 10),flags=cv2.CASCADE_SCALE_IMAGE) print('Number of detected Eyes in Face4:', len(eyes4))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions