Using python function in matlab

3 ビュー (過去 30 日間)
Finley Li
Finley Li 2020 年 11 月 22 日
コメント済み: 晓榆 潘 2024 年 4 月 24 日
I'm trying to call the following opencv function on matlab
so I did the following:
img, background = py.cv2_rolling_ball.subtract_background_rolling_ball(hardsperm, 30,pyargs('light_background','True'), pyargs('use_paraboloid', 'False'),pyargs('do_presmooth','True');
but apparently there's some syntatic errors in my code and matlab wouldn't recognize the function call. Could someone point me in the right direction on what I should change to make it work?

回答 (1 件)

Rohit Pappu
Rohit Pappu 2020 年 11 月 25 日
The closing ) is missing in the above code. The correct code would be
img, background = py.cv2_rolling_ball.subtract_background_rolling_ball(hardsperm, 30,pyargs('light_background','True'), pyargs('use_paraboloid', 'False'),pyargs('do_presmooth','True'));
  2 件のコメント
Finley Li
Finley Li 2020 年 12 月 4 日
編集済み: Finley Li 2020 年 12 月 4 日
So I spotted some error in my code and change it accordingly. My code now reads:
[img,background] = py.cv2_rolling_ball.subtract_background_rolling_ball(img, 30,pyargs('light_background','True'), pyargs('use_paraboloid', 'False'),pyargs('do_presmooth','True'));
But now the program is giving me a different error:
No method 'py.cv2_rolling_ball.subtract_background_rolling_ball' with matching signature found.
I'm pretty sure the method exists in the python opencv library (check out the link in the main discussion). I ran it using python and it works well on the image. So I'm not sure if I called it wrong in matlab or anything. Could someone help? Thanks!
晓榆 潘
晓榆 潘 2024 年 4 月 24 日
I have the same problem. Have you solved it?

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

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by