I am working on a fire detection program in MATLAB, and I have a blob detection as part of it. I would like to ask how to put a pop up warning message when a blob has been detected?
I want to have a warning message as soon as there's a fire.
This is my code for the shape inserter, or the boxes for blob detection.
This part is outside the loop:
detector = vision.ForegroundDetector(...
'NumTrainingFrames', 5, ...
'InitialVariance' , 30*30);
blob = vision.BlobAnalysis(...
'CentroidOutputPort', false, 'AreaOutputPort', false, ...
'BoundingBoxOutputPort', true, ...
'MinimumBlobAreaSource', 'Property', 'MinimumBlobArea', 250);
shapeInserter = vision.ShapeInserter('BorderColor', 'White');
videoPlayer = vision.VideoPlayer();
This part is inside the loop:
fgMask = step(detector, maskedRGBImage);
bbox = step(blob, fgMask);
out = step(shapeInserter, thisFrame, bbox);
step(videoPlayer, out);
For this example I'm assuming that if a blob is detected it will equal 1 (you can change my code to fit whatever output you currently have for when a blob is detected).
if blob == 1;
inputOptions = {'Fire Detected!'};
defSelection = inputOptions{1};
popup = bttnChoiseDialog(inputOptions, 'Warning!', defSelection, 'Warning!');
fprintf( 'Fire Detected - "%s"\n',inputOptions{popup});
else
continue
end
You can download bttnChoiseDialog
from the FileExchange: http://www.mathworks.com/matlabcentral/fileexchange/37261-generalised-question-dialog--questdlg-/content/BtnChoiseDlg/bttnChoiseDialog.m
hope this helps