detectMultiScale MAT conversions
kernelgurumeditation opened this issue · 1 comments
kernelgurumeditation commented
Hi,
I'm trying to add eye detection to a simple face detection demo, but I not able take a section from a MAT object.
local faces = face_cascade:detectMultiScale{image=im2, scaleFactor=1.2,minNeighbors=2, flags=2 , minSize={150,150}, maxSize={200,200}}
for i=1,faces.size do
local f = faces.data[i]
local x = f.x/fx
local y = f.y/fx
local w = f.width/fx
local h = f.height/fx
local facegray= im2[f] --- >How to do this in lua????
.....
local eyes = eye_cascade:detectMultiScale{image=facegray, scaleFactor=1.2,minNeighbors=2,flags=2 , minSize={50,50}, maxSize={0,0}}
Any help will be very appreciated
shrubb commented
See my answer in szagoruyko/torch-opencv-demos#23.
I would do:
cv.getRectSubPix{im2, {w-2, h-2}, {x + w/2, y + h/2}}