Elidor
Elidor

Reputation: 172

How can I use in 'opencv' function that get a color of pixel when I built a hide windows (run in background)?

I build program that run in background and check if tow image are similar. It's do good when I run it in standard running. But when I want run it in hide windows (in background) I get this errors:

  1. unresolved external symbol main ConsoleApplication2

  2. unresolved externals ConsoleApplication2

Here my code:

#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;
}

Can someone help me?

Upvotes: 0

Views: 89

Answers (1)

PeterT
PeterT

Reputation: 8284

The name of the project ConsoleApplication2 so I'm going to assume that you used the Visual Studio project template for "Console Application".

That template sets \SUBSYSTEM:CONSOLE option which means that the program wants to start with a function that has the signature int main(int argc, char* argv[])

So you need to change that option to /SUBSYSTEM:WINDOWS or you need to change the signature of your WinMain function.

Upvotes: 1

Related Questions