Clear Filters
Clear Filters

vision.For​egroundDet​ector: NumTrainingFrames

2 views (last 30 days)
Tiziana
Tiziana on 7 Nov 2022
Answered: Neha on 6 Sep 2023
I am using the vision.ForegroundDetector to detect and segment moving cells in a microscopy video.
In order for the ForegroundDetector to work properly, the training frames (NumTrainingFrames) have to contain only the background or is some movement allowed?
In all my frames, the cells that I want to detect are always moving, so I don't have any frames with only background.

Answers (1)

Neha
Neha on 6 Sep 2023
Hi Tiziana,
The vision.ForegroundDetector algorithm requires a few initial frames containing only the background in order to learn and create a background model. These frames are used to estimate the background and differentiate it from the moving objects (cells) in subsequent frames.
In your case, where the cells you want to detect are always moving and there are no frames with only the background, you can still use the vision.ForegroundDetector algorithm, but you might need to adjust the parameters and experiment with different settings to achieve satisfactory results.
Here are a few suggestions to handle the scenario where the cells are always moving:
1. Adjust the number of training frames (NumTrainingFrames): Reduce the number of training frames to a smaller value, especially if you have a limited number of frames available without the cells. But if it is not a short video, you can increase the number of training frames, the algorithm will have more samples of the background to learn from.
2. Experiment with different parameter values: You can try adjusting other parameters of the vision.ForegroundDetector algorithm, such asNumGaussains”, LearningRate and MinimumBackgroundRatio. Experimenting with different values can help you find the optimal settings for your specific video. In this case, since the background is static, you can reduce the value of “NumGaussians”. To understand more about choosing the hyperparameters for the detector, you can refer to the following MATLAB Answer:
Hope this helps!

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!