フィルターのクリア

I wish to crop the detected face from the image. Please help for the same.

5 ビュー (過去 30 日間)
harshita
harshita 2014 年 3 月 8 日
回答済み: Adnan Rasool 2016 年 8 月 9 日
% Create a detector object faceDetector = vision.CascadeObjectDetector;
% Read input image I = imread('visionteam.jpg'); This is the code given in Matlab hellp, can you suggest me how to crop the detected face and store it % Detect faces bbox = step(faceDetector, I);
% Create a shape inserter object to draw bounding boxes around detections shapeInserter = vision.ShapeInserter('BorderColor','Custom','CustomBorderColor',[255 255 0]);
% Draw boxes around detected faces and display results I_faces = step(shapeInserter, I, int32(bbox)); figure, imshow(I_faces), title('Detected faces');

採用された回答

Image Analyst
Image Analyst 2014 年 3 月 8 日
  2 件のコメント
harshita
harshita 2014 年 3 月 8 日
編集済み: harshita 2014 年 3 月 8 日
thank you. Sir, i wanted to ask you one more thing , is it possible to change the dimensions of the box used for detection?
Image Analyst
Image Analyst 2014 年 3 月 8 日
I don't have the computer vision toolbox so I don't know how the face detector works. Does it not say in the documentation anything about box size? If not, call them and ask them.

サインインしてコメントする。

その他の回答 (1 件)

Adnan Rasool
Adnan Rasool 2016 年 8 月 9 日
Asslam o Alikum
Here is the code for 1- select image from a Location 2- detect faces in the selected image 3- Find the Location of Detected Faces 4- crop all detected faces on one Figure
%Code start
clc; [filename, filepath] = uigetfile ({'*.jpg';'*.bmp';'*.png'}, 'File Selector'); img = strcat(filepath, filename); img = imread(img); figure(1),imshow(img); FaceDetect = vision.CascadeObjectDetector; FaceDetect.MergeThreshold = 7 ; BB = step(FaceDetect,img); figure(2),imshow(img); for i = 1:size(BB,1) rectangle('Position',BB(i,:),'LineWidth',3,'LineStyle','- ','EdgeColor','r'); end for i = 1:size(BB,1) J= imcrop(img,BB(i,:)); figure(3),subplot(6,6,i);imshow(J); end
%Code End
if this Helped: Remember me in your Prayers
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by