使用图像的路径显示图像
Display an image using the path of the image
我用下面的代码为我弹出了一个图像,但它不起作用,那么view函数出了什么问题?
当我调用应用程序时,它会打开:
void Image::view(){
string app="open /Applications/GIMP.app";
system(app.c_str());}
应用程序GIMP成功打开,但当我这样做时,使用应用程序打开我的图像:
void Image::view()
string app="open /Applications/GIMP.app"+getID();
//getID contain the path of the image
system(app.c_str());}
这是我收到的错误消息"文件/Users/Eric/Desktop/Product/Green.ppm不存在。程序结束,退出代码为:0"
注意:一个朋友使用Xcode,因为我使用了相同的第二个功能,它与完美配合
getID()将返回/Users/Eric/Desktop/Product/Green.ppm
假设getID()的路径是正确的,则会缺少一个空格。
string app="open /Applications/GIMP.app " + getID();
目前,它正在尝试打开/Applications/GIMP.appYourFile.Extension,该操作无效。它需要/Applications/GIMP.app YourFile.Extension.
通过使用自定义工作目录(到我的产品文件)编辑方案,并更改getID()以返回其工作的图像的名称"Green.ppm"。
我想我的系统在读取目录时有问题(我之前在我的终端中遇到过这个问题),还有另一个问题需要稍后解决!
相关文章:
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- C++射线示踪剂ppm表示没有足够的数据来显示图像
- 如果不在窗口 10 中声明名为 openCV 的 openCV namedWindow,QT 图像显示将无法正常工作
- 我在 OpenGL 中显示图像时遇到问题
- C++ 窗口显示无框图像
- 裁剪并显示我从哈尔级联获得的图像
- 如何显示具有 opengl 纹理的灰度图像
- 使用 Splashkit 逐个显示多个C++图像
- 如何使用OpenCV同时显示"深度"和"颜色"视频图像
- 如何从amd gpus的显示输出中获取图像数据
- Qt-png图像未显示在部署应用程序中
- 无法在 Opencv 中显示图像导致内存位置
- 只有左侧图像显示在OpenGL Stereo上
- gstreamer 管道代码,用于通过来自相机的实时流式传输而不是图像显示文本
- wxnotebook动态图像显示
- OpenCV-关闭图像显示窗口
- Qt拖放-改变图像显示,而拖动
- 为什么从Project Tango Tablet中提取的图像显示为灰色
- 如果同时运行两次wkhtmltopdf库,为什么它只会发生数据文档,而没有任何表或图像显示在html文件中
- 如何在win32中刷新图像显示白色,保持文字不变