Sulla
Sulla

Reputation: 8019

How to detect the intersection point between two lines formed from a cloud of points

I have a video of rotating circular disk with 4 quadrant marked in alternate black and white colors. The disk moves out of center over a period. My objective is to track the center point of disk over the period of rotation.

I have performed masking to view only my region of interest and also performed corner detection to get the points separating the quadrants using MATLAB computer vision toolbox functions. like enter image description here.

Now, how do I get the center point?

1) If I am to fit a curve between the points and find the intersection point, how to differentiate between the points forming two lines?

2) Is there any other easy method to track the center point?

Note, the disk is rotating and a new set of corners and edges are created at each frame. like,

enter image description here

Upvotes: 2

Views: 2749

Answers (3)

Vicky Budhiraja
Vicky Budhiraja

Reputation: 182

use the following code to detect the center always accurately for both the images:-

imgray=rgb2gray(image);
threshold=graythresh(imgray);
bw=im2bw(imgray,threshold);
se3 = strel('disk',2); %you can try with value 1,3 for better accuracy
bw1 = imerode(bw,SE);
[B,L] = bwboundaries(bw1,'noholes');
stats = regionprops(L,'Centroid');
for k=1:2
centroid = stats(k).Centroid;
x = stats(k).Centroid(1); %acquire X position of the center mass 
y = stats(k).Centroid(2); %acquire Y position of the center mass

x_axis(k,1)= x;
y_axis(k,1)= y;
end

x_axis(1,1) is the x center for first object,x_axis(2,1) is the x center for second object...

Upvotes: 0

Piotr
Piotr

Reputation: 833

You have very nice corner in the center. Try Harris Corner Detector and enjoy sub-pixel accuracy ;) http://en.wikipedia.org/wiki/Corner_detection

don't have matlab link, but you can read about Harris in OpenCV docs http://opencv.willowgarage.com/documentation/cpp/imgproc_feature_detection.html?#cornerHarris http://opencv.willowgarage.com/documentation/cpp/imgproc_feature_detection.html?#cornerSubPix

Upvotes: 1

cyborg
cyborg

Reputation: 10139

You can look for a circle (only circumference required) with an equal amount of black/white, which persists over time, if the disk's center stays stationary long enough.

Upvotes: 0

Related Questions