I want to compare two pictures with visual studio. I have added "Magick++.h".
How can i realize this command with c++?
Code: Select all
compare -metric AE Image1 Image2 info
Code: Select all
compare -metric AE Image1 Image2 info
Code: Select all
Image Image1("Image1");
Image Image2("Image2");
double result;
result=Image1.compare(Image2,AbsoluteErrorMetric);
Code: Select all
compare -metric AE -fuzz 10% Image1 Image2 info:
Code: Select all
...
BitBlt(memdc, 0, 0, width, height, scrdc, 0, 0 ,SRCCOPY);
HBITMAP handle=(HBITMAP)SelectObject(memdc, membit);
Gdiplus::Bitmap bitmap(handle, NULL);
Magick::Image img;
...
Code: Select all
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <gdiplus.h>
using namespace std;
#pragma comment(lib, "GdiPlus.lib")
using namespace Gdiplus;
static const GUID png =
{ 0x557cf406, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e } };
int main()
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
HDC scrdc, memdc;
HBITMAP membit;
HWND hWnd = FindWindow(_T("VGA2USB_MainWindow"), NULL);
scrdc = GetDC(hWnd);
int Height, Width;
RECT rect;
(GetWindowRect(hWnd,&rect));
int width=rect.right-rect.left;
int height = rect.bottom - rect.top;
memdc = CreateCompatibleDC(scrdc);
membit = CreateCompatibleBitmap(scrdc, width, height);
SelectObject(memdc, membit);
BitBlt(memdc, 0, 0, width, height, scrdc, 0, 0, SRCCOPY);
HBITMAP hBitmap;
hBitmap =(HBITMAP) SelectObject(memdc, membit);
Gdiplus::Bitmap bitmap(hBitmap, NULL);
bitmap.Save(L"C:\screen.jpg", &png);
DeleteObject(hBitmap);
return 0;
}
Code: Select all
Image screen("screenshot:")
// And if you have multiple monitors:
Image first("screenshot:[0]")
Image second("screenshot:[1]")
Code: Select all
F:\web\im>%IMG689%convert screenshot: r.png
convert.exe: no images defined `r.png' @ error/convert.c/ConvertImageCommand/3161.