Google Vision 图像方向错误

问题描述

我正在使用 React Native 和 Google Vision api 制作对象检测应用程序。当我发送水平图像时,我的应用程序运行良好。但是如果我发送高分辨率的垂直图像,api 会发现像该图像这样的对象是水平的。如果我发送低分辨率垂直图像,api 也可以正常工作。

enter image description here

第一张图的分辨率是6936x9248(其实在三星图库里显示为9248x6936,不知道为什么) 并且第二张图片的分辨率为 750x1000(图库中也是 750x1000)。

这里是视觉对两个图像的响应。

对于第一张图片:#include <iostream> #include <fstream> #include <sstream> #include<string.h> #include <ext/stdio_filebuf.h> using namespace std; int main(int argc,char *argv[]) { ifstream t; string path = "/home/documents/"; string file = path + argv[1]; t.open(file); //t.open("/home/documents/abc.cpp"); string buffer; string line; while(t) { getline(t,line); // ... Append line to buffer and go on buffer += line; buffer += "\n"; } t.close(); return 0; }

对于第二张图片:g++ cmdLine.cpp cmdLine.cpp: In function ‘int main(int,char**)’: cmdLine.cpp:13:32: error: no matching function for call to ‘std::basic_ifstream<char>::open(std::string&)’ t.open(file); ^ cmdLine.cpp:13:32: note: candidate is: In file included from cmdLine.cpp:2:0: /usr/include/c++/4.8.2/fstream:538:7: note: void std::basic_ifstream<_CharT,_Traits>::open(const char*,std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode] open(const char* __s,ios_base::openmode __mode = ios_base::in) ^ /usr/include/c++/4.8.2/fstream:538:7: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘const char*’

如您所见,结果是不同的。至少光剑的位置必须是一样的。我不知道为什么,存在图像方向问题。

这是我发送给 Vision api 的请求:

 [{"mid":"/j/5qg9b8","name":"Packaged goods","score":0.5010282,"boundingPoly":{"normalizedVertices":[{"x":0.23222321,"y":0.45171654},{"x":0.7493964,"y":0.5577906},{"x":0.23222321,"y":0.5577906}]}}]

问题是否应我的要求?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...