필터 지우기
필터 지우기

manipulating face detection code?

조회 수: 1 (최근 30일)
Newb
Newb 2016년 3월 19일
답변: Matthew Eicholtz 2016년 4월 6일
EyeDetect = vision.CascadeObjectDetector('EyePairBig'); I = imread('1.jpg'); BB=step(EyeDetect,I); figure,imshow(I); rectangle('Position',BB,'LineWidth',4,'LineStyle','-','EdgeColor','b');
if this is my code....i want to run this code for a series of pics and i want to increment a value=0 based on the number of times the eyes were found in the pics so i want to know which of the pics had their eyes detected
is there a way to put in the variable somewhere in the code that if on eyes being found will set to 1 which can then be read from my counter variable?
also as i said to run it in a series of pics i need to use a loop
if i initialise for i=1:1:say 10 (for 10 images) how do i poll the I=imread('1.png')? im guessing i cant use 'i.png' that wont work in quotes so how do i do it?
ty for any help

채택된 답변

Matthew Eicholtz
Matthew Eicholtz 2016년 4월 6일
Try this:
cnt = 0;
for ii=1:10
filename = sprintf('%d.jpg',ii);
I = imread(filename);
BB = step(EyeDetect,I);
if ~isempty(BB)
cnt = cnt+1;
end
end
This will count the number of images in which eyes were found. If you want to know which images contained eyes, you could do something like:
cnt = [];
for ii=1:10
... %same as before
if ~isempty(BB)
cnt = [cnt, ii];
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by