I have a C # application (Emgu CV), where I capture several images of the same scene with different focal lengths. Now I want to create a multifocus image similar to that described in this article http://blog.patdavid.net/2013/01/focus-stacking-macro-photos-enfuse.html
I could not find any approach to OpenCV. I was able to create definition maps for my images using this code.
private Image<Gray, float> GetFocusMask(string imgfile)
{
var img = new Image<Bgra,byte>(imgfile);
Image<Gray, byte> imgGray = img.Convert<Gray, byte>();
Image<Gray, float> roughSharpness = imgGray.Laplace(5);
roughSharpness = roughSharpness.Dilate(2);
roughSharpness._SmoothGaussian(3);
return roughSharpness;
}
Unfortunately, I’m stuck right now and don’t know how to use these masks to calculate one image of the depth of field of the original collection of focus images.
Simon source
share