Remove the background of an image

조회 수: 1 (최근 30일)
Sa rah
Sa rah 2015년 10월 26일
편집: Aj_ti 2016년 10월 9일
How can I remove the background of this image including the shadow? Actually I want to work with only the face and without the illumination conditions.
  댓글 수: 2
Image Analyst
Image Analyst 2015년 10월 27일
편집: Image Analyst 2015년 10월 27일
For just this image specifically (fairly easy)? Or for any image of a head against any varying or cluttered background (ranges from easy to difficult/impossible)? And exactly what does removal mean to you? Set to black? Crop out? Something else?
Sa rah
Sa rah 2015년 10월 27일
All my images are like this one, I don't have any varying or cluttered background. I want to remove the background, so the illumination conditions will disappear. I think I can set it to black, or just extract only the face to work with for a face recognition project.

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2015년 10월 27일
First of all, fix your horrible image capture conditions. I mean, why have a strong light coming in from the side that creates huge dynamic range and strong deep shadows. Get a uniform background. This is an easy thing to do photographically. Secondly, use a color camera - it will be easier to find the uniform background in that case. Post an image like that once you have it and then we can proceed.
  댓글 수: 1
Sa rah
Sa rah 2015년 10월 27일
I didn't create this image, I have downloaded the Yale Database which contains these images and in fact, I have to work with this database. If I will remove that background photographically, it will take me a long time to do it, since the database contains 90 images!! That's why I need to do it automatically. So isn't there any solution to remove the illumination conditions with a Matlab code?

댓글을 달려면 로그인하십시오.


Aj_ti
Aj_ti 2016년 10월 9일
편집: Aj_ti 2016년 10월 9일
I can't say this is the best way, but I'm currently apply this to crop the face images, removing the background and hair part as shown in the picture below:
This my reference image.
What I did is I crop (manually, using photo editor) 1 face image as a reference. Then, I apply feature point detection on the face and make 6 points as reference points (I'm using the points on eyes). Doing the same for other face images that you want to process to get the 6 points. Lastly, perform/calculate the geometric transformation as the code below and perform image warp.
[tform,inlierPtsDistorted,inlierPtsOriginal] = estimateGeometricTransform(matchedPtsDistorted,matchedPtsOriginal,'similarity');
showMatchedFeatures(ori,img,inlierPtsOriginal,inlierPtsDistorted);
outputView = imref2d(size(ori));
Ir = imwarp(img,tform,'OutputView',outputView);
This image shows points matching between reference image and probe image.
The result is as follow:
Regarding the illumination issue, histogram equalization or Retinex able to solve it. There are a lot of algorithm for illumination normalization.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by