How can parallelize my object detection code?

The code in the example below works sequentially and is slow to detect objects. I want the algorithm to be able to detect them faster using parallel operation. How can I do that?
cam = webcam('name camera');
d1 = vision.CascadeObjectDetector('T_1.xml');
d1 = vision.CascadeObjectDetector('T_2.xml');
d1 = vision.CascadeObjectDetector('T_3.xml');
gcf
set(gcf, 'CurrentCharacter','@');
i = 1;
while 1
image = snapshot(cam);
detectedImg = image;
bbox = step(detector1, image);
detectedImage = insertShape(detectedImage,'Rectangle',bbox, 'LineWidth', 4, 'Color', 'red','Opacity',0.7);
imshow(detectedImage);
i = i+1;
k=get(gcf, 'CurrentCharacter');
if k ~= '@'
break;
end
end
clear('cam');
close all;
clear all;

2 件のコメント

Florian Morsch
Florian Morsch 2018 年 4 月 26 日
Try to use tic / toc to see the times of the code. A lot of time is needed to display or draw images, so maybe you can save some time if you just speed up those operations.
From my experience the cascade object detector is pretty fast and dont use much computing time (depending on your needs of course). Mostly its the displaying and drawing into the found pictures which takes the most time).
Also on what resolution do you run those loops? If you scale your camera resolution down a bit the detection and image processing also works a lot faster.
Sur moo
Sur moo 2018 年 4 月 26 日
編集済み: Sur moo 2018 年 4 月 26 日
I want to get The format of the code is parallel. Using a detector, it detects. One file The second detector also detects sequential files sequentially. such as
d1 = vision.CascadeObjectDetector ('T_1.xml');
d2 = vision.CascadeObjectDetector ('T_2.xml');
d3 = vision.CascadeObjectDetector ('T_3.xml');
But this is now.
d1 = vision.CascadeObjectDetector ('T_1.xml');
d1 = vision.CascadeObjectDetector ('T_2.xml');
d1 = vision.CascadeObjectDetector ('T_3.xml');
I would like to modify this code in parallel. THX

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImage Processing and Computer Vision についてさらに検索

質問済み:

2018 年 4 月 23 日

編集済み:

2018 年 4 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by