我试图读取从c++发送的python套接字中的opencv图像。在
我可以将图像读入另一个c++程序或VB程序并构建一个映像,但是使用python我不明白发生了什么。在
我发送的代码材料数据公司名称:
char *start_s = "<S><size>43434234<cols>64<rows>64<SE>";//plus I send the image size, cols, rows, which varies, not like the static char string shown
char *end_e = "<E>";
cv::Mat image_send = some_mat;
iResult = send( ConnectSocket, start_s, (int)strlen(start_s), 0 );
iResult = send( ConnectSocket, (const char *) image_send.data, i_buffer_size, 0 );
iResult = send( ConnectSocket, end_e, (int)strlen(end_e), 0 );
这是我在python上尝试过的,但是还没有成功。image_cols和image_行是从套接字中筛选出来的,这里不显示,只显示图像_材料数据在c++中,mat在我试图放入映像的套接字中:
^{pr2}$
在这些评论的帮助下,我得到了一个可行的答案。原始图像位于单个数组RGB中,这需要重塑形状并放置到“RGB”图像中,可以在一行中完成:
当从套接字读取opencv数据数组时:这是有效的:
^{pr2}$相关问题 更多 >
编程相关推荐