[英]How to send Bitmap using a Socket?
I have a Bitmap image that I want to send using the Socket class. 我有一个要使用Socket类发送的位图图像。 The Bitmap needs to be sent from the Android client to a server.
位图需要从Android客户端发送到服务器。 The server is a C++ program.
该服务器是C ++程序。 How do I this?
我该怎么办?
I was looking at Android's Bitmap class here . 我在这里查看Android的Bitmap类。 But it doesn't really talk about it.
但是它并没有真正谈论它。
Also how do I decode this Bitmap on the server side? 另外,如何在服务器端解码此位图? The server is running a OpenCV program and I need to interpret the Bitmap as an IplImage (IplImage is an OpenCV struct that represents an image).
服务器正在运行OpenCV程序,我需要将位图解释为IplImage(IplImage是表示图像的OpenCV结构)。 If I have a image buffer, I can set IplImage to point to this buffer.
如果我有图像缓冲区,则可以将IplImage设置为指向该缓冲区。
It would be more efficient to send JPEG(or PNG) version of this bitmap as a byte[] to the server. 将此位图的JPEG(或PNG)版本作为byte []发送到服务器会更有效。
On the server side you can easily decode this byte array to OpenCV IplImage or Mat. 在服务器端,您可以轻松地将此字节数组解码为OpenCV IplImage或Mat。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.