Foreground detector is passing a black screen

2 views (last 30 days)
I am currently trying to work on a Smart Traffic System where I want to first detect and track cars in a given video. After doing some research and working I used the vision.ForegroundDetector and the vision.BlobAnalysis libraries. In the given snippet I seem to be having a weird issue. After the first line the image passed in becomes a black screen. As in the image is all black. I tried multiple different methods to change it but cannot seem to find a solution. This is similar to an algorithm that MathWorks implemented themselves and I do not understand why it does not work.
Here is the snippet:
filteredFrame = step(videoObject.detector, singleFrame); <- PROBLEM LIES HERE
% Remove noise and clean the image
filteredFrame = imopen(filteredFrame, strel('rectangle', [3,3]));
filteredFrame = imclose(filteredFrame, strel('rectangle', [15, 15]));
filteredFrame = imfill(filteredFrame, 'holes');
  1 Comment
Madhav Thakker
Madhav Thakker on 20 Aug 2020
How did you create videoObject.detector? You may want to add some details about what different are you doing from the example. Did you refer https://in.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html example?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!