kalman filter object tracking
    7 ビュー (過去 30 日間)
  
       古いコメントを表示
    
HOW CAN CHange THE TRACKER SHAPE FROM CIRCLE TO SQUARE OR RECTANGLE
frames = read(vid,r);
    frames = insertShape(frames,'FilledCircle',[centroid(1,1,r) centroid(1,2,r) sqrt(stats{r}(id(r)).Area/pi)],'LineWidth',1);
    marked_noise(:,:,:,r) = frames;
end
%updating kalman filter
for r=1:nframes-1
    frames = read(vid,r);
    frames = insertShape(frames,'FilledCircle',[centroid(1,1,r) centroid(1,2,r) 4],'LineWidth',2);
    if(mod(r,2) == 0) %%tracking the original object
        input = [centroid(1,1,r); centroid(1,2,r)];
    else
        input=[];
    end
    x = A*x + B*u; %prediction(next state)
    S = A*S*A' + Q; %%error covairance
    K = S*H'*inv(H*S*H'+R);%correction(gain)
    %updating the estimation\\
    if(~isempty(input)) %Check if we have an input
        x = x + K*(input - H*x);
    end
     S = (eye(size(S,1)) - K*H)*S; %update the covariance error
     Kalman_Output = H*x; %plotting the measurement
    frames = insertShape(frames,'Filledcircle',[Kalman_Output(1) Kalman_Output(2) 4],'LineWidth',2,'Color','white');
    scenario_1(:,:,:,r) = frames;
0 件のコメント
回答 (1 件)
  Mark Sherstan
      
 2019 年 4 月 27 日
        Conisder using insertObjectAnnotation(I,shape,position,label). There are some examples in the link provided. 
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
