我如何在'opencv'函数,当我构建隐藏窗口(在后台运行)时获得像素的颜色
How can I use in 'opencv' function that get a color of pixel when I built a hide windows (run in background)?
我构建了一个在后台运行的程序,并检查两个图像是否相似。当我以标准跑步方式跑步时,它会做得很好。但当我想在隐藏窗口(在后台)中运行它时,我会收到以下错误:
-
未解析的外部符号主控制台Application2
-
未解析的外部控制台Application2
这是我的代码:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <atlimage.h>
using namespace cv;
using namespace std;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
int count_inequality = 0;
Mat image, image2;
image = imread("hh.jpg", IMREAD_COLOR); // Read thVec3b intensity = img.at<Vec3b>(y, x);
image2 = imread("gg.jpg", IMREAD_COLOR); // Read thVec3b intensity = img.at<Vec3b>(y, x);
float blue;
float green;
float red;
float blue2;
float green2;
float red2;
for (int i = 1; i <= 1000; i+=10) {
for (int h = 1; h <= 900; h += 10) {
Vec3b intensity = image.at<Vec3b>(i, h);
blue = intensity.val[0];
green = intensity.val[1];
red = intensity.val[2];
Vec3b intensity2 = image2.at<Vec3b>(i, h);
blue2 = intensity2.val[0];
green2 = intensity2.val[1];
red2 = intensity2.val[2];
if (blue == blue2 && green == green2 && red == red2) {}
else {
count_inequality++;
if (count_inequality == 3){
//Code what happens if will be 3 inequality.
}
}
}
}
return 0;
}
有人能帮我吗
项目的名称ConsoleApplication2
,所以我假设您使用了"控制台应用程序"的Visual Studio项目模板。
该模板设置SUBSYSTEM:CONSOLE
选项,这意味着程序希望从具有签名int main(int argc, char* argv[])
的函数开始
因此,您需要将该选项更改为/SUBSYSTEM:WINDOWS
,或者您需要更改WinMain
函数的签名。
相关文章:
- 运行同一解决方案的另一个项目的项目
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 代码在main()中运行,但在函数中出现错误
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 如何在运行中期切换GTK CSS style_context
- 将"打开的CV图像"中的"颜色"转换为整数格式
- 如何在MS Visual Studio 2019中运行QT UI
- 如何通过cpp程序运行shell脚本
- IPC使用多个管道和分支进程来运行Python程序
- 删除指向指针的指针是运行时错误吗
- 如何用参数值调用函数(仅在运行时已知)
- 为什么即使使用-cudart-static进行编译,库用户仍然需要链接到cuda运行时
- 是否可以在编译时初始化数组,以便在运行时不会花费时间?
- 如何将控制台输出的文本颜色更改为红色,但如果从Powershell或CMD运行,背景将保持相同的颜色
- 如何在 Ogre3D 中检索模型顶点的运行时颜色
- BASH下运行程序的颜色输出
- 我如何在'opencv'函数,当我构建隐藏窗口(在后台运行)时获得像素的颜色