如何从Android设备中的照片传送到Matlab和反之亦然 [英] How to transfer pictures from android device to Matlab and vice-versa

查看:168
本文介绍了如何从Android设备中的照片传送到Matlab和反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的麻烦,需要你的帮助。我目前工作的要求我先采集使用的是Android设备的自然场景(图片),提取文本,然后识别文本的项目。

I am in trouble and need your help. I am currently working on a project which requires me to first capture a natural scene(picture) using an android device, extract text and then recognize the text.

我已经实现了提取过程,并通过Matlab的认识。现在我的问题是,我怎么能转移这是从我的Andr​​oid手机捕捉到MATLAB的照片吗?如何处理图像后,将结果发送回手机?

I have already achieved the process of extraction and recognizing through Matlab. Now my problem is, how can i transfer a picture which is captured from my android cell phone to MATLAB? How to send the results back to the phone after processing the image?

请帮忙。 A code会遭到AP preciated。

Please help. A code will be appreciated.

推荐答案

您可能能够使用客户端/服务器套接字。我没有试过在Android上,但我相信,只要你能上网,将工作。 <一href="http://blogs.mathworks.com/loren/2011/05/27/transferring-data-between-two-computers-using-matlab/"相对=nofollow> Matlab的客户端 - 服务器和 Java客户端-server 应该是兼容的,因为你应该能够运行在Matlab一台服务器,并连接到它从Java客户端在Android上。 Matlab的服务器可以是这样的:

You might be able to use client/server sockets. I haven't tried this on Android, but I assume it would work as long as you have internet access. Matlab client-server and Java client-server should be compatible, in that you should be able to run a server in Matlab and connect to it from a Java client on android. The Matlab server could look like:

tcpipServer = tcpip('0.0.0.0',port,'NetworkRole','Server');
fopen(tcpipServer);
imageSize = fread(tcpipServer, 2, 'int32');
image = zeros(imageSize(1), imageSize(2), 3);
for x=1:imageSize(1)
  for y=1:imageSize(2)
    image(x, y, :) = fread(tcpipServer, 3, 'double');
  end
end
%Process image
fwrite(tcpipServer, results, 'double'); %or 'char'

和Java客户端可以是这样的:

And the Java client could be something like:

Socket s = new Socket(<Server IP>, port);
out = new PrintWriter(s.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(s.getInputStream()));

out.println(image.getWidth());
out.println(image.getHeight());
for (int x = 1; x < image.getWidth(); x++) {
  for (int y = 1; y < image.getHeight(); y++) {
    //Write the RGB values. I can't remember how to pull these out of the image.
  }
}

String results = in.readLine();

我不完全知道如何的东西将与数据类型。也许不是PrintWriter的其他的东西会更好,或者你可能需要发送一切为char [],然后在另一端解析它。

I'm not exactly sure how things will work with datatypes. Maybe something other than PrintWriter would be better, or you might have to send everything as char[] and then parse it at the other end.

这篇关于如何从Android设备中的照片传送到Matlab和反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆