相关疑难解决方法(0)

如何通过共享内存将 cv::Mat 发送到 python?

我有一个 C++ 应用程序,它通过共享内存将数据发送到 python 函数。这ctypes在 Python 中非常有效,例如双精度和浮点数。现在,我需要cv::Mat在函数中添加一个。

我的代码目前是:

//H

#include <iostream>
#include <opencv2\core.hpp>
#include <opencv2\highgui.hpp>


struct TransferData
{
   double score;
   float other;  
   int num;
   int w;
   int h;
   int channels;
   uchar* data;

};

#define C_OFF 1000
void fill(TransferData* data, int run, uchar* frame, int w, int h, int channels)
{
   data->score = C_OFF + 1.0;
   data->other = C_OFF + 2.0;
   data->num = C_OFF + 3;   
   data->w = w;
   data->h = h;
   data->channels = channels;
   data->data = …
Run Code Online (Sandbox Code Playgroud)

c++ python opencv shared-memory

4
推荐指数
1
解决办法
1175
查看次数

标签 统计

c++ ×1

opencv ×1

python ×1

shared-memory ×1