Matlab Image FFT - image-processing

AFter calculating FFT for 2-D matrix. I want to plot the spectrum.
I used the command imshow for displaying image.
But i also want to display the frequncy values on X and Y axis.
I'm unable to use linspace command.
Can someone help in plotting the frequency values on Axis.
%imshow(FF,[]) is my command for 256*256 image.
Now I want to keep the tick labels on putput image. say 1,50,100,150,200 on both axis.
please write the code for it.that could be really helpful

It is a bit unclear what you want to achieve, but here is a code snippet for plotting the Fourier transform of an image.
% Compute Fourier transform
f = imread(X); % Reading some image X
F = fft2(double(f)); % Taking Fourier transform to the input image
% Show transform image using imshow (by scaling to range 0-255)
imshow(F./max(max(F))*255);

Related

How find the peek value of a image plot? (Plot Digitizer)

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

How to get back the co-ordinate points corresponding to the intensity points obtained from a faster r-cnn object detection process?

As a result of the faster r-cnn method of object detection, I have obtained a set of boxes of intensity values(each bounding box can be thought of as a 3D matrix with depth of 3 for rgb intensity, a width and a height which can then be converted into a 2D matrix by taking gray scale) corresponding to the region containing the object. What I want to do is to obtain the corresponding co-ordinate points in the original image for each cell of intensity inside of the bounding box. Any ideas how to do so?
From what I understand, you got an R-CNN model that outputs cropped pieces of the input image and you now want to trace those output crops back to their coordinates in the original image.
What you can do is simply use a patch-similarity-measure to find the original position.
Since the output crop should look exactly like itself in the original image, just use Pixel-based distance:
Find the place in the image with the smallest distance (should be zero) and from that you can find your desired coordinates.
In python:
d_min = 10**6
crop_size = crop.shape
for x in range(org_image.shape[0]-crop_size[0]):
for y in range(org_image.shape[1]-crop_size[1]):
d = np.abs(np.sum(np.sum(org_image[x:x+crop_size[0],y:y+crop_size[0]]-crop)))
if d <= d_min:
d_min = d
coord = [x,y]
However, your model should have that info available in it (after all, it crops the output based on some coordinates). Maybe if you add some info on your implementation.

Take pixels from input image (subsampling of image pixels)

How to take pixels from an input image by using Gaussian sub-sampling (shotgun pattern like)?
I want to take the locations of pixels that are to be taken like in a shotgun pattern concentrated in the middle of the image. Because I do not want to extract features of all pixels in an image. The output should be the coordinates of sampled pixels. I will be thankful if you guide me.
Is there any function or code that I can get help from that.
Your help is appreciated.
If you are looking for a method to define a Region of Interest (ROI) of an image in Matlab in order to perform some operation in a restricted are, remembering that x coordinates represent column and y is on the rows (matlab reads images as matrices):
For cut an image from x1 to x2 and from y1 to y2 try something like
ROI = image[y1:y2,x1:x2]
but how to determine these 4 values without a specific example is up to you

image transformations

So I've been using gnu-gsl and CImg to implement some of the fundamental projective space techniques for affine and metric rectification.
I've completed computing an affine rectification but, I'm having a hard time figuring out how to apply the affine rectification matrix to the original (input) image.
My current thought process is to iterate across the input image for each pixel coordinate. Then multiply the original pixel coordinate (converted to a homogeneous coordinate) by the affine rectification matrix to get the output pixel coordinate.
Then access the output image using the output pixel coordinate and conduct a blend (addition) operation on the output image's pixel location with the pixel color from the original image.
Does that sound right? I'm getting a lot of really weird values after multiplying the original pixel coordinate by the affine rectification matrix.
No, your values should not be weird. Why don't you make a simple example, a small scale with a small translation; e.g.
x' = 1.01*x + 0.0*y + 5;
y' = 0.0*x + 0.98*y + 10;
Now the pixel at (10,10) should map to (15.1,19.8), right ?
If you want to make a nice output image, you should find the forward projection and then back project to the input image and interpolate there rather than try to blend into the output image. Otherwise you will end up with gaps in the output.
You need to be careful with your terminology here; it sounds to me like you are doing projections, sometimes called warping in the computer graphics community. Rectification is something else, but it depends on what you are doing.

wind filter in opencv

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

Resources