MATLAB Answers

how can I save/load vision.For​egroundDet​ector object?

14 views (last 30 days)
Evgeny on 12 Jan 2015
Commented: Birju Patel on 13 Jan 2015
This was already asked here, but the solution doesn't work for me on R2014a or R2014b. Here is what I did:
clear all
% init model
detector = vision.ForegroundDetector();
% train model
image = imread ('frame0.png');
step(detector, image);
image = imread ('frame1.png');
step(detector, image);
% save the trained model
save('detector.mat', 'detector');
% clear and load the trained model
clear all
% try to use
image = imread ('frame0.png');
mask = step(detector, image); % this crashes matlab
At the last line, Matlab crashes with a segmentation fault. Is it a bug or is there some other function to call prior to saving?


Birju Patel
Birju Patel on 13 Jan 2015
I tried on both R2014a and R2014b and I couldn't reproduce the segmentation fault.
Do you have the stack trace from the seg fault? That might help determine where the problem is coming from.
Birju Patel
Birju Patel on 13 Jan 2015
Also, can you post the images you used (frame0,frame1)? They might be required to reproduce the issue.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 13 Jan 2015
Any serious problem like a segmentation fault where the entire MATLAB development shuts down unexpectedly should be reported to the Mathworks.


Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!