I am tracking an object that is thrown into the air, and this object controls parabolic patterns. I am tracking the object through a series of 30 images, I managed to exclude all the background and keep the object clear, then used its center to get its coordinates and plot them. Now I'm guessing where the object is going to fall, so I have the polyp and amp; Polyval The problem is, say:
??? Index matrix is more than dimensions.
Now the center creates its structure with one line and two columns, each time the object moves in the loop, it only updates the first line.
Here is a part of the code:
for N = 1:30. . X = nucleus (1,1); Remove the first row and column for% x = centroid (1,2); Remove the second line and call for% X plot_xy = plot (X, Y) set (plot _xy, 'XData', x (1: N), 'YData', y (1: N)); Fittings = Polyphot (X (1: n), Y (1: n), 2); Parvola = Plot (X, Nain (23,1)); Evaluation = polyval (fitting, x); Set (Parabola, 'YData', Evaluation). . End
I got the error message:
??? Index matrix is more than the dimension.
It seems (1: N) is causing problems, why do not I honestly know, but when I extract n, the object is plotted with its digit, but Polyphyting will not work. This tells me an error:
Warning: polynomial is not unique; Degree & gt; = Number of data points & Gt; If I made it (1: N-1) or something else, then it gives me more error (not unique ...). But I can not remove (1: n), because I have to evaluate the coefficient of polynomials in each loop (each value of n), then what is the solution? Edit 2:
This is more of my code
for N = 1:30 at I = shape Dimensions. (['J' num2str (n)]); Live = (i); Imshow (BW) SS = Beavalable (BW); S = Areaprop (bw, 'centroid'); Centroids = Cat (1, S. Controy); Plot (Igga, Santoids (1,1), Centroids (1,2), 'R *') X = Sentoids (1,1); Y = Centroids (1,2); Points = plot (x, y, 'bo', x, y, 'rx'); Wait; N & gt; 3c1 = cayonoids (1,1); C 2 = Centroids (1,2); Set (number, 'XData', C1, 'YData', C2); Poly = polyfit (c1, c2, 2 2); Parvlo = Plot (C1, Nain (Size (Centrodes, 1), 1)); Powel = Polywell (poly, x); Set (parabola, 'ydata', pval); Positive positive (C1, C2, ADI), positive polyfoide (C1, C2, 2); G = root (poly); Plot (v, 'go') Plot (v, 'go')
Because of the excel, the Parabola line is set properly But for the g
(prophecy), all this has gone wrong ... am I using the wrong syntax to get maximum value?
Even if I put plot (g, 'g -')
instead of V, then I think: I wonder if I Instead of vertical I can get this horizontal. Then I will have a line with a circle where Parabola is predicted to stop.
"post-text" itemprop = "text"> This should look like your code, if I correctly understand what you want to do:
% # If there is only one center per image, zero (30,1); % # Case A% # If any number of images can have centrosides per image, then preserve it like Centroids = Cell (30,1); % # For case B, hold on N = 1: 30 I = shape Image. (['Jammu' num2str (n)]); BW = (i); Imshow (BW) SS = Beavalable (BW); S = Areaprop (bw, 'centroid'); A centroids (n, :) = cat (1, S. Controy) for the #% case; For the case,% # B. Sentences {N} = cat (1, s.Centroid); % (B), (%), (%), (%),% imga, centroids {n} (:, 1), centroids {n} (:, 2), 'r *'); End% # I do not think the following lines are anything useful x = centroids (1,1); Y = centroids (1,2); Explains = conspiracy (x, y, 'bo', x, y, 'rx'); % # Drag the plots to be removed% # You can only fitting after all centroids end% # of the case is collected. Nothing is B / C centrirides already to form a numerical array with 2 column centrosides from the numeric% # case B-catechto Santroids = cat (1, centroids {:}); C1 = centroids (:, 1); C2 = centroids (:, 2); % # Set (number, 'XData', C1, 'YData', C2); Poly = polyfit (c1, c2.2); % # You can straighten out the output of the polygon as y-coordinate parabola = plot (C1, polyval (poly, C1));
Comments
Post a Comment