【问题标题】:send a photo from android device to server (treat it on matlab)将照片从 android 设备发送到服务器(在 matlab 上处理)
【发布时间】:2018-12-20 13:05:15
【问题描述】:

我遇到了麻烦,需要你的帮助。我目前正在做一个项目,该项目需要我首先使用 android 设备(使用 android studio)从图库中挑选一张照片,提取文本然后识别文本。

我已经通过matlab实现了提取和识别的过程。现在我的问题是,如何将我从我的 android 手机中挑选的照片传输到 MATLAB?图像处理后如何将结果发送回手机?

请帮忙。一个代码将不胜感激。

【问题讨论】:

  • 欢迎来到 Stack Overflow。请在此处阅读有关如何提出好问题以及要避免哪些问题的文档。 stackoverflow.com/help/asking。目前这个问题太宽泛了
  • This 应该很有用

标签: android matlab server upload


【解决方案1】:

我认为最好的方法是使用 TCP/IP 套接字。我曾经做过一个类似的项目,我必须在 MATLAB 中从我的 RPi 接收文本。只需将您的 Android 设备和带有 MATLAB 的工作站连接到同一网络并记下服务器的 IP 地址(您将在其上初始化服务器的设备。最好将您的 Android 设备作为服务器)。将客户端连接到服务器并读取/写入数据。这是我所做的一个例子。我将 MATLAB 初始化为客户端,将我的其他设备初始化为服务器。

t = tcpip('xxx.xxx.xxx.xx', yyyyy, 'NetworkRole', 'Client'); #Replace xxx.xxx.xxx.xx with IP address and yyyyy with the Port
#Change Client to Server if you want MATLAB to work as server
fopen(t)
dataMat = zeros(1, N);
while 1
    data = fread(t); #Change fread to fwrite to transmit data
    raw = char(data);       ###############################
    val = str2num(raw);     #### This part converts the ###
    val = val';             #### received ASCII values ####
    l = length(val);        #### to the original data #####
    message = 0;            ###############################
    for i = 1:l
        message = val(i)*(10^(l-i)) + message;
    end
    dataMat(count) = message;
    message
end

我不确定如何通过 TCP/IP 发送图像,但我很确定这是可能的。 Click here 用于 TCP/IP 与 MATLAB 博客。

我没有使用过 Android Studio,因此无法在 TCP/IP 方面提供帮助,但如果您的应用程序相当简单,您可以使用 MIT App Inventor(我已经研究过)创建一个 TCP/IP 应用程序,所以可以帮忙。

干杯!

【讨论】:

    猜你喜欢
    • 2012-12-10
    • 2011-10-14
    • 2016-07-28
    • 1970-01-01
    • 1970-01-01
    • 2012-12-09
    • 2019-05-03
    • 1970-01-01
    • 2016-10-31
    相关资源
    最近更新 更多