I need help with the following code. I want to plot image sequence points. But in line where is written "pend_centers( count,:) = property.Centroid;" it´s received the error Too many outputs resquested…
%numFrames=550
fileFolder = fullfile('C:\Users\Enrique\Desktop\Video - prueba levitron\Prueba14aIMGJbmp');dirOutput = dir(fullfile(fileFolder, 'Prueba14aIMGJbmp*.bmp'));fileNames = {dirOutput.name}';numFrames = numel(fileNames);I = imread(fileNames{1});FR = imcrop(I,[45 118 290 300]); %FR = frame_region
sequence = zeros([size(FR) numFrames],class(FR));sequence(:,:,:,1) = FR;for p = 1:numFrames sequence(:,:,:,p) = imcrop((imread(fileNames{p})), [45 118 290 300]);endimplay(sequence)image = imcrop((imread('Prueba14aIMGJbmp0000.bmp')), [45 118 290 300]);%imread('Prueba14aIMGJbmp0000.bmp');
darkCar = rgb2gray(image);bw = imextendedmax(darkCar, 67); imshow(image), figure, imshow(bw)sedisk = strel('diamond',9);noSmallStructures = imopen(bw, sedisk);imshow(noSmallStructures)sequence2 = zeros([size(FR,1) size(FR,2) 3 numFrames], class(FR));for k = 2 : numFrames %sequence(:,:,:,k) = SingleFrame
SingleFrame = imcrop((imread(fileNames{k})), [45 118 290 300]); % Convert to grayscale to do morphological processing.
I = rgb2gray(SingleFrame); % Remove dark points.
bws = imextendedmax(I, 67); % Remove lane markings and other non-disk shaped structures.
noSmallStructures = imopen(bws, sedisk); % Remove small structures.
%noSmallStructures = bwareaopen(noSmallStructures, 150);
% Get the area and centroid of each remaining object in the frame. The
% object with the largest area is the light-colored point. Create a copy
% of the original frame and tag the point by changing the centroid pixel
% value to red.
sequence2(:,:,:,k) = SingleFrame; bws = imclearborder(bws); seg_pend(:,:,k) = bws; stats = regionprops(noSmallStructures, {'Centroid','Area'}); if ~isempty([stats.Area]) areaArray = [stats.Area]; [junk,idx] = max(areaArray); c = stats(idx).Centroid; c = floor(fliplr(c)); width = 2; row = c(1)-width:c(1)+width; col = c(2)-width:c(2)+width; sequence2(row,col,1,k) = 255; sequence2(row,col,2,k) = 0; sequence2(row,col,3,k) = 0; endendimplay(sequence2);%,frameRate
%%%%%%%%%%Point trajectory representation
pend_centers = []; %zeros(numFrames,2);
for count = 1:numFrames property = regionprops(seg_pend(:,:,count), 'Centroid'); pend_centers(count,:) = property.Centroid; % ERROR
endx = pend_centers(:,1);y = pend_centers(:,2);figureplot(x,y,'m.')axis ijaxis equalhold on;xlabel('x');ylabel('y');title('axis point');
I've been looking over the code but i don't know how to solve the error. I would be really grateful if yo help me out. regards
Best Answer