Cannot pass an image file from Matlab to Python

23 visualizaciones (últimos 30 días)
Asdrubal Cheng Cen
Asdrubal Cheng Cen el 23 de Mzo. de 2021
Respondida: Rashed Mohammed el 26 de Mzo. de 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.

Respuestas (1)

Rashed Mohammed
Rashed Mohammed el 26 de Mzo. de 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

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by