How ROI is selected?

asked 2018-04-25 09:40:43 -0500

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.

edit retag flag offensive close merge delete


hmm, it's cropping out a part of the image, based on the face coords found before, not the other way round.

detectMultiScale() finds the coords.

berak gravatar imageberak ( 2018-04-25 09:53:53 -0500 )edit