这是使用.NET的pHash的后续帖子
您如何在.NET中声明以下C++声明?
int ph_dct_imagehash(const char* file,ulong64 &hash);
Run Code Online (Sandbox Code Playgroud)
到目前为止我有
[DllImport(@"pHash.dll")]
public static extern int ph_dct_imagehash(string file, ref ulong hash);
Run Code Online (Sandbox Code Playgroud)
但我现在得到以下错误
ulong hash1 = 0, hash2 = 0;
string firstImage = @"C:\Users\dance2die\Pictures\2011-01-23\177.JPG";
string secondImage = @"C:\Users\dance2die\Pictures\2011-01-23\176.JPG";
ph_dct_imagehash(firstImage, ref hash1);
ph_dct_imagehash(secondImage, ref hash2);
Run Code Online (Sandbox Code Playgroud)

它基本上说我的ph_dtc_imagehash声明是错误的.
我在这做错了什么?
我无法使用CImg加载PNG.我听说你需要让libpng/zlib先上班,但我不确定如何设置它.我在Ubuntu上.我的来源:
#include <cmath>
#include <cstdio>
#include <string>
#include <assert.h>
#include <stdarg.h>
#define cimg_using_png
#include "CImg.h"
using namespace cimg_library;
#include "png.h"
int main(int argc, char** argv)
{
CImg<unsigned char> img2("test.png");
img2.display();
return 0;
}
Run Code Online (Sandbox Code Playgroud)