Inverse filtering a blurred image - Python - python

For an assignment, The image corrupted by atmospheric turbulence. I want to deblur an image using inverse image filtering. I have done some research and it seems I need the original image for this procedure but I only have the blurred image. How can I construct the degrading function that was used to blur this image? I am not allowed to use the original image. Thank you in advance.
This is the image:

Related

change from colored to grayscale in image processing

today I treid a python filtering code that supposes to increase the noise in the image(de-noising) for a gray-scale image(medical image) and it's for a skull, the problem is i keep getting colored pixels, i mean the noise increased in terms of colored image, not in grayscale so please help me to make the code filter in gray-scale mode, extra details :
the code :
enter link description to see the filter code
original image :
the de-noised image after applying noise filter :
you can see the problem clearly that when i zoom into the picture i can see the colored pixels, while it supposes to be a gray-scale form
colored pixels in the filtered image :
partial zoom in
full zoom in
so please guess does anybody knows how to edit that code so that it can increase the noise in form of grayscale mode.
Your input image is a 3-channel JPEG. Make it greyscale (1 channel) before applying noise then it won't be able to treat the channels differently because there will only be one.
img.transform_colorspace('gray')

Dash blurred part of the image

Is it possible to dash the blurred part of the image?
Right now I am using python with OpenCV. I know only how to load images and display if the image is blurred.
My input is a blurred image:
I would like to get:
I do not have:
original/unblurred image.
Output can have still blurred parts but dashed.
Thanks a lot for help!
You could try by computing the "Variance of the Laplacian" on parts of the image to detect the regions that have a low variation in greyscales (= assumed blurry) and which regions have a high variation in greyscale (= assumed non-blurry).
There is a nice tutorial on how to check if an image is blurry, it can be found here
There is also a post here that explains the theory behind it.
It ain't a complete solution, but it might be a way to start.

Why opencv distort the image by undistort()?

I am following the OpenCV Camera Calibration tutorial, I have used about 100 images for the calibration. After getting camera matrix and distance matrix, I use them to undistort other set of images. What I realized is the undistorted image is highly distorted on both sides.
One of the example imgs for camera matrix:
Using the camera matrix to undistort my experimental img gave me very unreasonable results.
Original image:
After applying undistor():
Clearly, the undistortion process only paid attention to the center of the image. How can I make it undistort the image properly?
Thank you very much!
UPDATE:
Using images to cover the Filed of View as much as possible helps. Here is the new result of the same image:
I have one more question: How to know if the calibration returns satisfying calibration results? RMS is a parameter. However, it is not very robust.

Binarization of image in opencv

I'm having a problem with binarization of image (perhaps blurry in general)
I have this image:
and after I've done binarization I get
How can I do better binarization? My goal is to have just black background and white letters and nothing else. I used adaptive threshold binarization
cv2.adaptiveThreshold(image_gs,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY ,41,3)
and I also have
kernel=np.ones(1,1)
Does anyone have idea how to do that?
You should try deblurring methods, see these:
Deblurring image by deconvolution using opencv
Experiments with deblurring using OpenCV
Try out the following:
1.De-noise your image,first, by using either a Median,Bilateral,Gaussian or Adaptive Smooth Filter (Gaussian filter works pretty well when it comes to images with textual content).
2.De-blur the image by referring to http://www.pyimagesearch.com/2015/09/07/blur-detection-with-opencv/ or https://github.com/tvganesh/deconv
3.Check out Adaptive Gaussian thresholding,instead.In case its a scene text image,you can use Otsu's algorithm after shadow removal.
The 'Image Processing in OpenCV' tutorials have a detailed documentation on Image Thresholding.
The Image Filtering — OpenCV 3.0.0-dev documentation explains the implementation of the Median Blur, applied to an image.

Opencv Blur just within Circle

How does one blur a circular portion of an image in the python bindings of Open CV. Can one apply blurring on images without making new images?
It doesn't look like the OpenCV's blurring and filtering functions allow masking the input. I suggest applying the filter on a Rect around the circular portion, then assign the elements of the blurred sub matrix to the original image while masking the elements that do not correspond to the circle.

Categories

Resources