How to create Matlab Simulink Model for Object Detection?

Hello everyone! I have created a Cascade Classifier for Weapon Detection. The code is working perfectly. Now I want to simulate my code and i have to create a simulink model for the Gun Detection. I have an Input image, and the detector.xml file. I want the Detected image as Output. Can anyone guide me that which block can be used for this purpose? Any help will be highly appreciated. Thanks.

 採用された回答

Birju Patel
Birju Patel 2014 年 10 月 1 日

1 投票

Hi Sorath,
You can call the vision.CascadeObjectDetector by using a MATLAB Function block in Simulink. For example:
% MATLAB Function block code
function y = fcn(u) %#codegen
coder.extrinsic('vision.CascadeObjectDetector'); % only supported in simulation
detector = vision.CascadeObjectDetector;
bboxes = step(detector, u);
y = zeros(size(u), 'like',u);
y = insertShape(u, 'rectangle', bboxes); % draw a box around detected object
Note the use of coder.extrinsic. The vision.CascadeObjectDetector is only supported in simulation modes. You won't be able to generate code for the vision.CascadeObjectDetector inside of Simulink.
Hope that helps.

6 件のコメント

Sorath Asnani
Sorath Asnani 2014 年 10 月 1 日
Dear Sir, Thank You very much from the bottom of my heart. You have solved a Nightmare Problem of mine. I spent days and days in finding the solution but everywhere I was getting the same answer that vision.CascadeObjectDetector is not supported in Simulink. So again, Thank You very much Sir. May you be Blessed always. :)
Sorath Asnani
Sorath Asnani 2014 年 10 月 1 日
Dear Sir Birju Patel, I have to deploy the detector over Raspberry Pi Board. I am a bit confused between Simulink and OpenCV. Can you give your suggestions that whether I should deploy the Simulink Model over Raspberry Pi or should I use the Classifier .xml file in OpenCV to detect the Object and then Deploy that over Raspberry Pi? Thanks.
Birju Patel
Birju Patel 2014 年 10 月 14 日
You won't be able to deploy vision.CascadeObjectDetector to the Raspberry Pi using Simulink. This is because code generation is not supported for vision.CascadeObjectDetector in Simulink.
You will have to use the the classifier XML file in OpenCV to run it on the Pi.
Krishna Moorthy
Krishna Moorthy 2016 年 7 月 16 日
Dear Briju, I too have the same problem, could you guide me how to deploy simulink based 'face detection' application in Raspberry Pi ? Thanks.
junaed khan
junaed khan 2018 年 10 月 18 日
i need help.i am trying to solve similer tipe of project.please help me
hegel77
hegel77 2020 年 3 月 1 日
how do you pass or bring in the xml detector file into the matlab function?
also is there a way to generate code to deploy to android device?
thanks,

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeComputer Vision Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by