Using double precision with vision.For​egroundDet​ector

1 次查看(过去 30 天)
I am performing foreground detection on a 16 bit grayscale image. The vision.ForegroundDetector object only accepts images of uint8, double, or single data types. I tried using double precision as follows, but my output is 0 for every pixel:
detector = vision.ForegroundDetector(...
'MinimumBackgroundRatio', 0.55, ...
'NumTrainingFrames', 6, ...
'LearningRate', 0.005, ...
'InitialVariance', 24.^2);
fgMask = detector(im2double(frameGray));
However, if I use im2uint8 instead of im2double I get the detections I expect. I want to have full precision, so using im2uint8 doesn't solve my problem.
Edit: It is not just my images that this fails for. Changing the image data type to double in the 'vision/TrackCarsExample' also causes the algorithm to fail.

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by