因此,我刚刚在计算机上安装了OpenCV,并且试图进行快速测试以使所有功能正常运行。我的计算机在Linux Deepin 15上运行。由于它不是众所周知的流行发行版,因此使该问题很难解决。
无论如何,这是我要运行的代码:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int argc, const char** argv) {
Mat color = imread("lena.jpg");
Mat gray = imread("lena.jpg", 0);
imwrite("lenaGray.jpg", gray);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在终端中使用以下命令进行编译:
g++ main.cpp -o main `pkg-config opencv --cflags --libs`
Run Code Online (Sandbox Code Playgroud)
它似乎编译没有错误。尽管文件管理器中的图标不是可执行文件的图标,但仍创建“主”文件。
当我尝试运行它时,出现以下错误:
./main: error while loading shared libraries: libopencv_shape.so.3.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我完全不知道该怎么办。我真的需要启动并运行opencv。我浏览了互联网,甚至没有引用'libopencv_shape.so.3.1'文件。
我该怎么办?
提前致谢!
所以我正在学习C++,我正在尝试学习如何操作字符串等,在这段代码中,我希望提供一个没有空格的特定字符串:
#include <iostream>
#include <string>
using namespace std;
int main() {
string intro = "Hello my name is John";
for(string::iterator it = intro.begin(); it != intro.end(); ++it) {
if((*it) != " ") {
cout << *it;
}
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我完全忘记了我在这里做错了什么.有人可以帮忙吗?我没有使用任何整数,错误说"ISO C++禁止指针和int之间的比较"
我正在学习 WebGL 图形编程,最近出现了这段代码。
void main() { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); }
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我听说它与渲染光有关,但我完全不知道。