I am working on images that are partially blur on some sections. These are noises that should be taken care of, but here is the problem:
Are there methods to detect whether an image is blur or partially blur at some sections of an image? For instance, take a look at sample image below:
You can see in the image that there are 3 sections that are visually blur: bottom-left, near center region and top-right. Now, is it possible to detect that any portion of an image is blur programming-wise or mathematically?
As lain_b pointed out, with an image like this you can use an edge detector and look for an absence of edges. I tried it on your image and it seems to work pretty well. First I used the kernel
[0,1,0,
1,-4,1,
0,1,0]
Which is a simple edge detector. Its result was
Then I used a threshold to get
Then I closed the image and opened it to get
This is obviously not a finished version, the top right portion did not recognize well at all. Perhaps you could improve it by blurring before performing thresholding, or by choosing better values for the threshold and the radii of the opening and closing operations. A lot of the decisions you will need to make depend on the constraints you can put on your problem. I think this technique will work for you though.
Edit
If you are looking for blur detection of arbitrary images you are going to have to investigate a wide variety of techniques. Things are much easier if you can make assumptions about your set of input images. Without any assumptions I don't know what will work best for you. Here is some reading on the topic
Image Blur Metrics
Reserach paper on using the Harr wavelet transform
Similar SO Question and look at the question that question links to
Blur detection is a very active research field, there is no one answer. You will just need to try all the methods you can find (these were found by googling detect blur in image).
This paper may be of some help. It does blur estimation (mostly for out of focus, but I think it also does blur) to recreate a similarly blurred object in the image.
I think you should be able to use it to detect the blurred areas, and how blurred they are. It should be especially relevent to your problem as it is designed to work with real-world images.
Related
I have been stuck on attempting to remove the background from a borehole log image for a week or so (new to image processing). I want to eventually develop a code which can automatically detect the horizontal sinusoidal features in the image (attached). I think for this I can use a Hough transform. However, all of the algorithms I have used (Hough transform, edge detections, thresholding) do not work because of the background of the image which has this 'wood grain' appearance. I also tried recreating a mask through finding the image gradient, but because the color values of the features I want (horizontal sinusiodal shapes) are so similar to the background I want to remove I am having a difficult time. The ultimate goal is to take two images taken at different times (before and after a scientific experiment) and to subtract them to see where the sinusoidal patterns differ. If I can get rid of this background that should be easier.
I so far have worked the image to better quality through taking the FFT and applying a high-pass filter. This at least homogenizes the image and leaves me with the attached result. However, I am not having much luck to remove this vertical 'wood grain'. Does anyone have a thought about how it could be done? This is driving me a little crazy.
Thank you so much!
I have a bunch of low contrast images of white LEGO parts and pieces as shown. Since it has very low contrast and most of the edge detection algorithm does not perform well. The particular edge I need is the outermost circumference.
I tried applying some filters, but these images clearly need some pre-processing. Could you please suggest what I could do to get better results. I tried searching online but the solutions I found either don't work or sound like magic to me.
LEGO PARTS IMAGE
THE EDGE I NEED
Doing contrast stretching could help in low contrast images. see the opencv documentation for more information from here.
I am trying to do segmentation of book spines stacked both horizontal and vertically. I have came across a problem when the picture is too big.
Only part of the image can be seen in the whole window, meaning it does not process the original image it is suppose to process:
The image it processed
The image it should process instead
I cannot even view the whole image which is suppose to be processed. Hence, I tried to minimise the window just for this picture using=>
cv::resize(image, image, cv::Size2i(image.cols/6, image.rows/6) ); // resize to 1/6 of the image
which lead to another problem, when the picture is small, it become too small that the straight lines cannot even be detected.
Hence, I tried =>
cv::resize(image, image, cv::Size2i(750, 400) );
this lead to another problem. While the image above is above to display the whole window, for smaller pictures, my houghline detection becomes more unstable.
Do anybody have an idea on how to solve this sizing problem? And also how to improve my Hough Line detection which is pretty unstable now to separate the books? I wish to draw a line in between the stack of books.
Hope to hear from you guys soon. Thanks!!!
It looks like you're resizing the image before you perform the Hough Transform, I think what you want to do it afterwards. This allows you to get enough resolution in your picture to get decent lines detected, and you can still view it on your monitor.
Secondly you want to improve detecting the separation between the books. My advice would be to perform a bit of pre-processing to the image. There are plenty of methods to do this. Mean Shift Segmentation to separate the picture by colours is one for example.
Filtering the results of the transform is another approach. Only keeping lines passing through dark areas - since it is more likely to be dark between the books - is one such way. There are plenty more methods.
Also don't forget to tweak the parameters of the Hough Transform to see what works best with your test set. It may reveal some interesting results!
Good luck!
IMO first you have to improve edge detected output.It consists of very less edges.You can use cvCanny or cvSobel for the same.Also use Probabilistic Hough lines, that will give better results.You can tweak into the parameters of cvHoughLines such as threshold, minLinLength, maxLineGap as in the fig the lines are coming too close.
Please check the details here:
http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html
I have a problem very similar but very much simple than this.
To begin with I have a small image:
Then I take a screenshot and I want to detect if my small house is in the screenshot.
The problem is that my house can be different in size and slightly different in color.
I've found so far the OpenCV library but it seem quite oversized for my need.
Do you know any simpler library to achieve this task?
Tx
Edit: I've found this about SURF algorithm
Judging by your question, there will be no sheer or skew to your image as it will be on screen, whereas the problem you referenced is a much more difficult situation. Your image will not experience any distortion, but only an increase/decrease in size.
To match regardless of color, I recommend computing the gradient image (using sobel kernels) for both your template image and your screen shot. Now you're matching based on visible edges and take color out of the mix.
To match regardless of size, create multiple versions of your template (the more versions you make the more precise, but the longer the processing) and slide your template across the image until you find an acceptable match.
OpenCV is a beast that has a steep learning curve. If my assumptions are correct, then you are correctly stating that OpenCV is oversized when simple image processing techniques can be applied :).
I need to sort a huge number of photos, and remove the blurry images (due to camera shake), the over/under exposed ones and detect whether the image was shot in the landscape or portrait orientation. Can these things be done on an image using an image processing library or are they still beyond the realms of an algorithmic solution ?
Let's look at your question as three separate question.
Can I find blurry images?
There are some methods for finding blurry images either from :
Sharpening an image and comparing it to the original
Using wavelets to detect blurring ( Link1 )
Hough Transform ( Link )
Can I find images that are under or over exposed?
The only way I can think of this is that your overall brightness is either really high or really low. But the problem is that you would have know if the picture was taken at night or day. You could create a histogram of your image and see if it is really skewed one way or the other and that might be some indication of over/under exposure.
Can I determine the orientation of the image?
There are techniques that have been used such as SVM, Color Moments, Edge Direction Histograms, Bayesian Framework using cues.
Can I find images that are under or over exposed?
here histograms is recommended.