imfindcircles没有正确跟踪blob

时间:2015-06-08 18:20:56

标签: matlab tracking blobs

我尝试使用imfindcircles跟踪鼠标腿中的标记。它适用于第一张图像,但即使它们非常相似,其他图像也很混乱。 This is the incorrect output.我的代码出了什么问题?

%Array
A = [0 0;0 0;0 0;0 0];

%multiarray to keep the coordinates
multA(:,:,7) = [0 0;0 0;0 0;0 0];

for k = 1:7
    % Create an image filename, and read it in to a variable called imageData.

    bmpFileName = strcat('image', num2str(k), '.bmp');

    if exist(bmpFileName, 'file')
        imageData = imread(bmpFileName);

        bmpFileName= imcrop(imageData,[1350 150 300 250]);

        [centers, radii] = imfindcircles( bmpFileName,[4 8],'ObjectPolarity','dark', 'Sensitivity', 0.9,'EdgeThreshold',0.05); 

        figure(1)
        imshow(bmpFileName)
        viscircles(centers,radii)

        multA(:,:,k)=[centers(1,1) centers(1,2);centers(2,1) centers(2,2); centers(3,1) centers(3,2);centers(4,1) centers(4,2)];

        pause(0.5)
    else
        fprintf('File %s does not exist.\n', bmpFileName);
    end
end

0 个答案:

没有答案