Ask Your Question

Revision history [back]

How ROI is selected?

Hi, I have doubts regarding how the co ordinates of ROI are selected . For example in the below code snippet

//Code Snippet in Python

  1. ret , img # video is gettiing read

  2. gray = cv2.cvtColor(img , cv2.COLOR_BGR2GRAY) ## gray contains the pixel density not the coordinates of each pixel

    3.frontal_face= frontalface_cascade.detectMultiScale(gray,1.3,5)

  3. for (x, y, w, h) in frontal_face: # x,y are coordinates not the pixel density

    cv2.rectangle(gray, (x, y), (x+w, y+h), (255, 0, 0), 2)

    //how we are slicing array having pixel densities to get the coordinates of part of a face? 5.roi_mouth=gray[y:y+h,x:x+w]

    //Code Snippet Ends

I am not getting in line 5. how the array called "gray" which stores pixel densities is sliced to get coordinates of part of face .

Please suggest.