Get most accurate image using OpenCV
I wonder if someone give me a solution to this. How can I get most clear iplima开发者_运维技巧ge among rest , using OpenCV.? As a example there is a web cam input which move a hand. But when I stream this video ,I get 10 iplimages. But only 5th one is more clear. I want to filter that 5th one using openCV.
I hope kindness support from your all.
The simplest thing to try is to compare the variances (standard deviations of the image) -- since the image content is almost the same in all frames, the sharpest image will probably have the highest variance. Variance of the inter-frame prediction residual (differences between adjacent pixels) may also work -- look around for this paper.
Here are two images. An original is on the left. I simulated motion blur by Gaussian blur in the horizontal direction only. The blurred image is on the right.
Standard deviations (using imagej) : 42.5 and 41.1
If that doesn't work, then what you're after is called motion blur estimation (or just blur estimation in general). It's a pretty popular image quality assessment problem in academic circles, so there's definitely lots of material to help you.
Paul R got you started on the right track -- look at the edges in the image.
It's not necessarily the number of the edges that matters here -- it's their width. Blurry images will have wider edges (more distance between the rising and falling side). Read this paper -- it's very popular, and quite simple to implement. Note that that approach only measures blur horizontally and vertically, which wouldn't work in your case. However, it isn't hard to modify it taking edge direction into account, as some later papers have done.
There are more ways to deal with this problem, but the ones I've mentioned are the simpler ones that I know.
You could probably use some kind of edge detection. Out-of-focus or motion-blurred images will have fewer detectable edges than "sharper" images. Look at Canny et al.
精彩评论