Could someone suggest me how to go about getting the wind filter effect in opencv similar to the one available in photoshop and gimp?
Here is an image of text with wind styled filter applied on it.
Thanks
I suggest the following steps:
Use the original text image as a mask. White pixels are '1', blacks are '0'.
Smooth the image in X direction (like in the example image you added)
You can do the smoothing by
horizontal vector filter
or use distance transform where
distance is calculated only along x
axis.
I think that distance transform will
run faster
Multiply the result by (1-mask) so smoothing will occur only outside the text.
Multiply each row of the result by random number in range [0.1 ..1]. This will make smoothing uneven.
Add to the result the original image of the text to get the final image
Related
I'm trying to blindly detect signals in a spectra.
one way that came to my mind is to detect rectangles in the waterfall (a 2D matrix that can be interpret as an image) .
Is there any fast way (in the order of 0.1 second) to find center and width of all of the horizontal rectangles in an image? (heights of rectangles are not considered for me).
an example image will be uploaded (Note I know that all rectangles are horizontal.
I would appreciate it if you give me any other suggestion for this purpose.
e.g. I want the algorithm to give me 9 center and 9 coordinates for the above image.
Since the rectangle are aligned, you can do that quite easily and efficiently (this is not the case with unaligned rectangles since they are not clearly separated). The idea is first to compute the average color of each line and for each column. You should get something like that:
Then, you can subtract the background color (blue), compute the luminance and then compute a threshold. You can remove some artefact using a median/blur before.
Then, you can just scan the resulting 1D array filled with binary values so to locate where each rectangle start/stop. The center of each rectangle is ((x_start+x_end)/2, (y_start+y_end)/2).
I want to extract the peek value from a plot automatically.
I searched web plot digitizer and other programs and packages, however none of them gives points on the plot automatically. Is there any way to achieve this by using image processing such as CNN ?
I am thinking to make custom filters to find peek point.
Thanks in advance.
Sample plot
Algorithm
convert to gray-scale and binarize
find coorditates of a white pixel (x,y) where y is minimal nonzero values
add to y the blob radius y=y+r
make the scale transformation from range [0,image_height] to your range [0,25]
calculate new value of y under the transformation
I'm trying to detect the border of the scanned documents because it will help increase my OCR extraction rate. Borders are considered marginal noise so I have to get rid of them. Borders usually have the highest density in an image.
I had examine every column of pixels in an image and the column which has the highest density is probably a border, if and only if, it is a line. And that's where my problem arises. I don't know how to detect if the column of pixel is a line or not.
Any help would be very much appreciated.Thanks.
You use Hough line transform, but it will give lines for the data on which you need to do OCR.
The simplest solution based on your question i can think of is this.
Since its border, you can reduce the search space based on some threshold in width and height.
For example, if your image is 'w x h' and your search space width 's' your search space will be '0 to s' 'w-s to w' '0 to s' 'h-s to h'.
There is in Opencv a line detection algorithm based on Hough transform :Tutorial on Hough transform
This will detect the line existing in your image, you just have to see after if the pixel you detect as border belong to one of the detected lines.
I'm required to create a map of galaxies based on the following image,
http://www.nasa.gov/images/content/690958main_p1237a1.jpg
Basically I need to smooth the image first using a mean filter then apply thresholding to the image.
However, I'm also asked to detect only large galaxies in the image. So what should I adjust the smoothing mask or thresholding in order to achieve that goal?
Both: by smoothing the picture first, the pixels around smaller galaxies will "blend" with the black space and, thus, shift to a lower intensity value. This lower intensity can then be thresholded, leaving only the white centres of bigger galaxies.
I have an image with free-form curved lines (actually lists of small line-segments) overlayed onto it, and I want to generate some kind of image-warp that will deform the image in such a way that these curves are deformed into horizontal straight lines.
I already have the coordinates of all the line-segment points stored separately so they don't have to be extracted from the image. What I'm looking for is an appropriate method of warping the image such that these lines are warped into straight ones.
thanks
You can use methods similar to those developed here:
http://www-ui.is.s.u-tokyo.ac.jp/~takeo/research/rigid/
What you do, is you define an MxN grid of control points which covers your source image.
You then need to determine how to modify each of your control points so that the final image will minimize some energy function (minimum curvature or something of this sort).
The final image is a linear warp determined by your control points (think of it as a 2D mesh whose texture is your source image and whose vertices' positions you're about to modify).
As long as your energy function can be expressed using linear equations, you can globally solve your problem (figuring out where to send each control point) using linear equations solver.
You express each of your source points (those which lie on your curved lines) using bi-linear interpolation weights of their surrounding grid points, then you express your restriction on the target by writing equations for these points.
After solving these linear equations you end up with destination grid points, then you just render your 2D mesh with the new vertices' positions.
You need to start out with a mapping formula that given an output coordinate will provide the corresponding coordinate from the input image. Depending on the distortion you're trying to correct for, this can get exceedingly complex; your question doesn't specify the problem in enough detail. For example, are the curves at the top of the image the same as the curves on the bottom and the same as those in the middle? Do horizontal distances compress based on the angle of the line? Let's assume the simplest case where the horizontal coordinate doesn't need any correction at all, and the vertical simply needs a constant correction based on the horizontal. Here x,y are the coordinates on the input image, x',y' are the coordinates on the output image, and f() is the difference between the drawn line segment and your ideal straight line.
x = x'
y = y' + f(x')
Now you simply go through all the pixels of your output image, calculate the corresponding point in the input image, and copy the pixel. The wrinkle here is that your formula is likely to give you points that lie between input pixels, such as y=4.37. In that case you'll need to interpolate to get an intermediate value from the input; there are many interpolation methods for images and I won't try to get into that here. The simplest would be "nearest neighbor", where you simply round the coordinate to the nearest integer.