Using pHash from .NET

前端 未结 1 982
天命终不由人
天命终不由人 2020-12-05 05:38

I am trying to use pHash from .NET

First thing I tried was to register (regsvr32) phash.dll and asked here Second of all, i was trying to import using D

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 06:36

    The current Windows source code project (as of 7/2011) on phash.org does not seem to export the ph_ API calls from the DLL. You will need to add these yourself by __declspec(dllexport) at the beginning of the line in pHash.h like so:

    __declspec(dllexport) int ph_dct_imagehash(const char* file,ulong64 &hash);
    

    You should then see the export show up in the DLL using dumpbin

    dumpbin /EXPORTS pHash.dll
    ...
    Dump of file pHash.dll
    ...
              1    0 00047A14 closedir = @ILT+2575(_closedir)
              2    1 00047398 opendir = @ILT+915(_opendir)
              3    2 00047A4B ph_dct_imagehash = @ILT+2630(_ph_dct_imagehash)
              4    3 000477B2 readdir = @ILT+1965(_readdir)
              5    4 00047A00 rewinddir = @ILT+2555(_rewinddir)
              6    5 000477AD seekdir = @ILT+1960(_seekdir)
              7    6 00047AFA telldir = @ILT+2805(_telldir)
    

    You should now be able to use this call from C#.

    however...

    I am getting a crash in the CImg code when I try to call this, so it seems there is some more work to do here...

    0 讨论(0)
提交回复
热议问题