Cannot pass an image file from Matlab to Python

14 vues (au cours des 30 derniers jours)
Asdrubal Cheng Cen
Asdrubal Cheng Cen le 23 Mar 2021
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.

Réponses (1)

Rashed Mohammed
Rashed Mohammed le 26 Mar 2021
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

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by