I have a project that I need to follow the points like in the picture. I made a picture like this as a representation. I get the coordinates of the red dots as pixel coordinates once per second. Is there a way I can predict the green dots when I don’t take measurements afterwards? When I use the 2d-kalman filter (x,y,x’,y’ states) it keeps guessing in the direction of the blue arrow. I want to make correct predictions on the green dots, not this way. How can I do that.!
Thanks.
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 have images such as below (I am pasting only a sketch here) where I want to calculate the center of symmetry and the displacement between the 2 marked zones in the image(Marked in Red and blue). Could anyone suggest a simple algorithm for this? (Please note the signal is symmetric to 180-degree rotation).
The idea is to calculate the center of symmetry between the red and blue zones
Here is my algorithm approach:
Distinguish the red and blue pixels in the image by thresholding: Lets say set the blue pixels to wihte(255) and set the red pixels(0) and set the rest of image to the (125) in a gray channel image.
Check all of the pixels horizontally in the middle row of the image.
While you are checking, if you hit the red pixel, then try to search blue one. However, if you hit red pixel again, then start searching blue again.
During the search after red pixel if you hit a blue pixel then you can easiy calculate the middle of it. Then re-start the process.
Here is a demonstration of search line:
Note: Since they are dashed lines, luckily you may pass them with gaps. To fix, this you can try couple of random different rows.
I'm trying to calculate the distances between points of different colours, as shown in this image:
The goal is to use a macro to print the distances from the red dot to the yellow dot and then the yellow dot to the purple dot. I believe the best way to do this is to either:
1) Use a macro to print the coordinates of the red dots, and then a macro to print the coordinates of the closest yellow dots. Then a second macro to print the coordinates of the purple dots closest to a given yellow dot. I would also like to calculate the angle of the line relative to the center point, but I believe I can do this in Excel if I'm given the XY coordinates of each point as well.
2) Drawing lines between the red and yellow points and the yellow and purple points, printing the length and angle of those lines.
Ideally being able to do both would be good, but either would work for my purposes (calculating the distance and angle of the lines between the points from red to yellow and yellow to purple).
What is the best way to do this via macro? There are some examples (like this) but I don't believe it 1) selects for points based on colour or 2) picks the next closest point automatically.
Try using the Threshold Color function, I should think it would allow you to select your colors individually. You can then get the coordinates for your different points by selecting "centroid" from the Analyze menu. The calculations for the angles and distances can be done then in Excel if you use the closest coordinates for the relevant colors.
I know, that the Meanshift-Algorithm calculates the mean of a pixel density and checks, if the center of the roi is equal with this point. If not, it moves the new ROI center to the mean center and checks again... . Like in this picture:
For density, it is clear how to find the mean point. But it can't simply calculate the mean of a histogram and get the new position by this point. How can this algorithm work using color histogram?
The feature space in your image is 2D.
Say you have an intensity image (so it's 1D) then you would just have a line (e.g. from 0 to 255) on which the points are located. The circles shown above would just be line segments on that [0,255] line. Depending on their means, these line segments would then shift, just like the circles do in 2D.
You talked about color histograms, so I assume you are talking about RGB.
In that case your feature space is 3D, so you have a sphere instead of a line segment or circle. Your axes are R,G,B and pixels from your image are points in that 3D feature space. You then still look where the mean of a sphere is, to then shift the center towards that mean.
I have used convex hull and convexity defects and found the points in the hand as shown below.
With the above points information available, how can I crop the region marked in red (Knuckle) as shown in the below image.
My intention is to detect the Knuckles in the hand.
Note: The green region drawn is using "Draw contours". Is it possible to use this region to crop the red marked area ( Knuckle ). How to crop these regions.
Update ( 26/2/2014 ):
I have found contour points as below. With the below information in hand is it possible to find the knuckle region. Is there any ways to find using the points.
Since you already know the red position, all you want is to crop this region?
It's very easy, you just need to set a ROI (Region of interest) and to copy this region to another image. Like this (in pseudo-code since I don't have an open CV project up and running)
img1.ROI = varRedRectangle
img1.copyTo(img2)
img1.ROI = null;
If your question is how to detect the red section, I think you need to do like anyone in image recognition and work a lot because there is tons of way to do it nobody here will find them for you.
Hope it helps!
If your idea is to detect those red areas you can use the following simple idea.
Get edge image and remove the edges outside the green boundary.
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.