我遇到了麻烦,需要你的帮助。 我目前的工作要求我先采集使用的是Android设备的自然场景(图片),提取文本,然后识别文本的项目。
我已经实现了提取过程,并通过Matlab的认识。 现在,我的问题是,我怎么能转移这是从我的Android手机捕捉到MATLAB的照片吗? 如何将结果发送回手机处理图像后?
请帮忙。 A码将不胜感激。
我遇到了麻烦,需要你的帮助。 我目前的工作要求我先采集使用的是Android设备的自然场景(图片),提取文本,然后识别文本的项目。
我已经实现了提取过程,并通过Matlab的认识。 现在,我的问题是,我怎么能转移这是从我的Android手机捕捉到MATLAB的照片吗? 如何将结果发送回手机处理图像后?
请帮忙。 A码将不胜感激。
你也许能够使用客户机/服务器套接字。 我没有试过在Android,但我相信,只要你能上网,将工作。 Matlab的客户端-服务器和Java客户端-服务器应该是兼容的,因为你应该能够运行在Matlab中的服务器,并从Java客户端连接到它在Android上。 Matlab的服务器可能看起来像:
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客户端可以是这样的:
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 [],然后在另一端解析它。