2017-04-26 3 views
1

내가 읽은 모든 자습서, 샘플 또는 블로그는 으로 이동하는 한 프레임에서 움직이는 개체를 추적하는 다양한 방법을 보여줍니다. 이것은 유비쿼터스 화되었다.개체가 움직이지 않거나 프레임을 벗어 났는지 확인하는 방법

은 내가 알아 내려고 한 것은 개체가 이동 중지하거나 실제로 프레임 왼쪽 여부를 결정하는 방법을 입니다. 배경 분리를 사용하면 물체가 움직이는 것을 멈 추면 전경의 일부가되어 "사라집니다". 다시 움직이면 "다시 나타납니다". 객체가 프레임을 떠날 때 동일한 동작이 존재한다고 말할 수있는 한, 그냥 사라집니다. 예를 들어, 다음 코드 단편은이를 나타냅니다.

**BackgroundSubtractorMOG2 _fgDetector = new BackgroundSubtractorMOG2(); 
CvBlobDetector _blobDetector = new CvBlobDetector(); 
CvTracks _tracker = new CvTracks(); 
CvBlobs _blobs = new CvBlobs();** 

private int FindAndTrack() 
{ 
    CvInvoke.GaussianBlur(_analyzeMat, _smoothedFrame, new System.Drawing.Size(3, 3), 1); 

    #region use the BG/FG detector to find the forground mask 

    _fgDetector.Apply(_smoothedFrame, _foregroundMask); 

    #endregion use the BG/FG detector to find the forground mask 

    _blobDetector.Detect(_foregroundMask.ToImage<Gray, byte>(), _blobs); 
    _blobs.FilterByArea(_minimumAreaValue, int.MaxValue); 

    _tracker.Update(_blobs, 0.01 * _scaleValue, 1, 5); 
    return _tracker.Count; 
} 

더 이상 배경 분리가 해답이 될 수 없습니다.

프레임에서 나가는 개체에 대한 명확한 표시는 무엇입니까?

감사 조건으로 더그

답변

1

장소 tracker.update 루프는 조건이 관심의 개체를 실패 할 경우 경우에 대한 프레임을 떠났다. 객체가 이동했는지 여부를 감지하려면 x & 객체의 경계 상자 y 값과 이전 x & 경계 값 y 값이 같으면 객체 이동이 중지되었습니다. 이동하지 않은 경우