calculating frequency of jitter/wave distortion in an image - image-processing

Is there a way to calculate the frequency of the jitter/wave distortion in the below image?
and how can I measure the distortion so I can correct it?
I tried to calculate the frequency on a part of the image (the horn) by creating a line plot profile where the x pixels are the intensity and y pixels the distance
here is the plot profile
and I am thinking of extracting the local minimas/maximas per certaing number of pixels, I don't know if this approach is correct, or is there a better way to calculate it

Related

Calculate focus to map world point on imageplane

I try to calculate the focus value to map a world point on to image plane.
I use raspberry pi camera v2. I did get the camera matrix from opencv it gives me for fx and fy 204. Got nearly the same value by measuring at known distance and size of object.
But when I use a formular I get wrong values.
My formular is
Fpix=sensorsize_pix * focus_mm/sensorsize_mm=1pix*focus_mm/pixsize_mm
I'm using as values:
320x240 image.
Image is taken with 640x480 resolution and then binned 2x2 in Software.
Because the image is already binned by driver I would have a total binning of 4x4.
The original pixel size 1.4um and focus 3.00mm
Which would give me a binned pixelsize of 5.6um.
So I would calculate
Fpix=1pix*3.0mm/0.0056mm=536pix
which is a huge difference to 204pix
The specification for the sensor can be found herelink
As I would consider opencv and measurements as correct. Something must be wrong with my formular.

how to get the real distance between two points in image?

HI I am using opencv to detect two objects in frame and calculate the distance between them in pixel but I need to calculate the distance between them in meter can you give the realtionship between the meter and pixel
This is generally impossible: From a single image the scale of reconstructed 3d points is unknown.
Your options are either to
Add more views, and calculate the depth using stereo vision algorithms.
Use knowledge about the size of the objects to determine the distance.
Edit
Given the depth z, camera calibration matrix K and image point x we can get the corresponding 3D-point Xas:
X = z * inv(K) * x
with x is in homogeneous coordinates.
When you have the two 3D points on the object, calculating the distance is trivial.
"thank you I try to use the size but I need the relationship between the real size in meter and the size in pixel with known distance between camera and the object"
What you need to do is have the object is question at a certain distance from the camera and measure the pixels. Then, move this object further or closer from/to the camera and measure the change pixels again.
From this you can ascertain the ratio of the change in pixels which is equivalent to the change in distance, thus the distance of the object from the camera. It's just a simple differential equation.
Assuming the size of the object in question is fixed or scaled to the object used to calculate the ratio, this approach should provide a rough estimate of the distance of the objects to the camera.
You then need to use this ratio to help with calculating the distance between the objects as it would be somewhat inverse proportional to the distance between the objects when their distance to the camera increases.
However this method is very messy and can be inefficient. A better approach would be using two different cameras and looking at the disparity between both as mentioned by Hannes

Determining pixel coordinates across display resolutions

If a program displays a pixel at X,Y on a display with resolution A, can I precisely predict at what coordinates the same pixel will display at resolution B?
MORE INFORMATION
The 2 display resolutions are:
A-->1366 x 768
B-->1600 x 900
Dividing the max resolutions in each direction yields:
X-direction scaling factor = 1600/1366 = 1.171303075
Y-direction scaling factor = 900/768 = 1.171875
Say for example that the only red pixel on display A occurs at pixel (1,1). If I merely scale up using these factors, then on display B, that red pixel will be displayed at pixel (1.171303075, 1.171875). I'm not sure how to interpret that, as I'm used to thinking of pixels as integer values. It might help if I knew the exact geometry of pixel coordinates/placement on a screen. e.g., do pixel coordinates (1,1) mean that the center of the pixel is at (1,1)? Or a particular corner of the pixel is at (1,1)? I'm sure diagrams would assist in visualizing this--if anyone can post a link to helpful resources, I'd appreciate it. And finally, I may be approaching this all wrong.
Thanks in advance.
I think, your problem is related to the field of scaling/resampling images. Bitmap-, or raster images are digital photographs, so they are the most common form to represent natural images that are rich in detail. The term bitmap refers to how a given pattern (bits in a pixel) maps to a specific color. A bitmap images take the form of an array, where the value of each element, called a pixel picture element, correspond to the color of that region of the image.
Sampling
When measuring the value for a pixel, one takes the average color of an area around the location of the pixel. A simplistic model is sampling a square, and a more accurate measurement is to calculate a weighted Gaussian average. When perceiving a bitmap image the human eye should blend the pixel values together, recreating an illusion of the continuous image it represents.
Raster dimensions
The number of horizontal and vertical samples in the pixel grid is called raster dimensions, it is specified as width x height.
Resolution
Resolution is a measurement of sampling density, resolution of bitmap images give a relationship between pixel dimensions and physical dimensions. The most often used measurement is ppi, pixels per inch.
Scaling / Resampling
Image scaling is the name of the process when we need to create an image with different dimensions from what we have. A different name for scaling is resampling. When resampling algorithms try to reconstruct the original continuous image and create a new sample grid. There are two kind of scaling: up and down.
Scaling image down
The process of reducing the raster dimensions is called decimation, this can be done by averaging the values of source pixels contributing to each output pixel.
Scaling image up
When we increase the image size we actually want to create sample points between the original sample points in the original raster, this is done by interpolation the values in the sample grid, effectively guessing the values of the unknown pixels. This interpolation can be done by nearest-neighbor interpolation, bilinear interpolation, bicubic interpolation, etc. But the scaled up/down image must be also represented over discrete grid.

corner detection using Chris Harris & Mike Stephens

I am not able to under stand the formula ,
What is W (window) and intensity in the formula mean,
I found this formula in opencv doc
http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html
For a grayscale image, intensity levels (0-255) tells you how bright is the pixel..hope that you already know about it.
So, now the explanation of your formula is below:
Aim: We want to find those points which have maximum variation in terms of intensity level in all direction i.e. the points which are very unique in a given image.
I(x,y): This is the intensity value of the current pixel which you are processing at the moment.
I(x+u,y+v): This is the intensity of another pixel which lies at a distance of (u,v) from the current pixel (mentioned above) which is located at (x,y) with intensity I(x,y).
I(x+u,y+v) - I(x,y): This equation gives you the difference between the intensity levels of two pixels.
W(u,v): You don't compare the current pixel with any other pixel located at any random position. You prefer to compare the current pixel with its neighbors so you chose some value for "u" and "v" as you do in case of applying Gaussian mask/mean filter etc. So, basically w(u,v) represents the window in which you would like to compare the intensity of current pixel with its neighbors.
This link explains all your doubts.
For visualizing the algorithm, consider the window function as a BoxFilter, Ix as a Sobel derivative along x-axis and Iy as a Sobel derivative along y-axis.
http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.html will be useful to understand the final equations in the above pdf.

Find density of the Edges in a image

I have used Canny edge detector to detect the edges and below is the output. I need to detect the density of edges in the image and select the region where ever the density is high. How to do that in opencv.How to find the density of high intensity pixels using opencv?
Below is the output after Canny Edge:
How to get the below output?
Here is an idea.
Traverse the external contour and remove it.
Apply Horizontal histogram to get separate the strips.
In each take vertical histogram and locate the bins with values within a neighbourhood of the peak. (Lets call these as Peak Bins)
The longest contiguous sequence of peak bins should give the answer.

Resources