Cannot pass an image file from Matlab to Python

12 次查看(过去 30 天)
Hi, so I have been trying to call a python module that I created using a existing MATLAB code. the pyversion of the python interpreter works fine and it outputs:
>> version: '3.8'
>> executable: 'C:\Users\xxx\AppData\Local\Programs\Python\Python38\python.exe'
>> library: 'C:\Users\xxx\AppData\Local\Programs\Python\Python38\python38.dll'
>> home: 'C:\Users\xxx\AppData\Local\Programs\Python\Python38'
>> isloaded: 1
And so, this is what I have so far:
>> image = imread("image_path");
>> info = py.mymodule.myfunction(image);
However, im getting this error: "Python Error: ModuleNotFoundError: No module named 'libmwbuffer'
Python function '' might not be able to accept at least one input argument at position 1. The function may require a specific data type that you can
construct from the MATLAB array. For more information, see the documentation for Python function '' and working with Python arrays."
I was wondering what I could do to solve this issue,
Thank you.

回答(1 个)

Rashed Mohammed
Rashed Mohammed 2021-3-26
Hi Asdrubal,
Please refer to MATLAB to Python Data Type Mapping and check if the output type implements the Python buffer protocol. You can learn more about it here.
Hope this helps

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by