MATLAB equivalent cv2 Python function

21 ビュー (過去 30 日間)
Nikhil Hegde
Nikhil Hegde 2016 年 4 月 8 日
コメント済み: Joachim Schlosser 2016 年 4 月 11 日
I'm using bwlabel, regionprops, ismember and bsxfun in MATLAB which I'm porting to cv2 Python. Does cv2 have any similar functions that I can use?
MATLAB code:
cashew_BW is a black and white 2D image
cashew_BW_labeled = bwlabel(cashew_BW);
cashew_stats = regionprops(cashew_BW_labeled, 'BoundingBox');
cashew_single_mask = ismember(cashew_BW_labeled,i) > 0;
cashew_single = bsxfun(@times, cashew_RGB, cast(cashew_single_mask, 'like', cashew_RGB));

回答 (1 件)

Joachim Schlosser
Joachim Schlosser 2016 年 4 月 8 日
Why port at all? You can call Python from MATLAB as well as MATLAB from Python .
  2 件のコメント
Nikhil Hegde
Nikhil Hegde 2016 年 4 月 8 日
I'm actually trying to run the code on a Rpi and MATLAB doesn't help there. So I'm porting the MATLAB code to cv2 python
Joachim Schlosser
Joachim Schlosser 2016 年 4 月 11 日
Ah I see. Still might be no need to port code.
You could but the code into a Simulink model and have that auto-generate code for your Raspberry Pi. See https://mathworks.com/hardware-support/raspberry-pi-simulink.html
See the complete list of functions that support auto code generation at https://mathworks.com/help/simulink/ug/functions-supported-for-code-generation--alphabetical-list.html

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by