Erotemic / hotspotter

Apache License 2.0
13 stars 15 forks source link

Cannot find 'hesaff' dynamic library #4

Open obaiga opened 3 years ago

obaiga commented 3 years ago

Hi there,

I attempt to run the source code in Windows, but it reports the error: “ [C!] load_clib(libname='hesaff' root_dir=None, recurse_down=True, verbose=False) [c!] Cannot FIND dynamic library ” It looks like I should build a file, libhesaff.dll, unfortunately, I don't how to do it. Do you have some ideas to figure out it? Thanks a lot.

Erotemic commented 3 years ago

This is a deprecated repo. For the latest see: https://github.com/Erotemic/ibeis.

The folder https://github.com/Erotemic/hotspotter/tree/jon/hstpl/extern_feat contains pre compiled binaries for Python 2.

The repo: https://github.com/Erotemic/pyhesaff is a more standalone version of the hessian affine library that I organized. It can be compiled on OSX, Win32, or Linux. Precompiled binaries are also available via pypi: https://pypi.org/project/pyhesaff/

About 2 weeks ago I attempted a quick update of this repo to Python 3: https://github.com/Erotemic/hotspotter/tree/dev/python3 (overall I wasn't able to get it working). But in those changes I updated the hesaff library to point to pyhesaff instead of the internal third party libraries.

obaiga commented 3 years ago

Thanks for replying.

I'm so sorry I'm a freshman in Python programming. Sometimes, I would ask for some stupid problems.

  1. I think the version, hostpotter-jon, has precompiled binaries for hesaff, libhesaff.dylib. But when I am running the program, it seems it is looking for a file, libheaff,dll.

  2. I try to install pyhesaff library via PyPI. Unfortunately, it doesn't work on Python 3.7.6-wins64 and Python 2.7.15-wins86. It reports the error:

'ERROR: Could not find a version that satisfies the requirement pyhesaff (from versions: none) ERROR: No matching distribution found for pyhesaff'

Finally, thanks for your strongly help, again. I think, maybe, the best way is to use the Linux system to run the program, ibeis.

Erotemic commented 3 years ago

Yes, I can't recommend Linux strongly enough. You can simply install Python and then pip install ibeis. It should be as simple as that.

The first 4 years of working on this program were such a pain because of Windows. Development is much easier on Linux. I did try hard to make this cross platform and both hotspotter and ibeis do work on windows. But building them is a lot trickier. (On Linux you can just install a compiler with one command, but on windows its a lot harder).

obaiga commented 3 years ago

Hi Erotemic,

Recently, I am working on your Hotspotter program and it's impressive, like magic. Everything looks perfect. When I running the program, the output comments give me a lot of help and I can find where it is to understand the details. Thank you so much for your all work. I think it can be work on Python3.7 in Wins or MacOS system. But I don't know what is difference between 'pyhesaff.py' and 'pyhesaffexe.py'. On my computer (Wins), I can only work for 'pyhesaffexe.py'. According to your comment, it looks new python version and the old python version for 'Hessian Affine + SIFT keypoints', respectively. So, it means that the basic theory for the program is the same, right?

By the way, you can refer to the below link to replace the removed function 'matplotlib.mlab.dist_point_to_segment' in [hstpl]-[mask_creator] in the python3.7 version.

https://matplotlib.org/3.0.0/_modules/matplotlib/mlab.html#dist_point_to_segment

Thanks, again.

Erotemic commented 3 years ago

So hstpl/extern_feat/pyhesaffexe.py) is a module that was originally intended to call the underlying "hessian-affine+sift" feature detector/describer by invoking the hesaff.exe/hesaff.mac/hesaff binary executable.

hstpl/extern_feat/pyhesaff.py instead calls the underlying code by loading the shared library file hesaff.ln/libhesaff.dylib/etc... (I might be mixing up which hesaff files are binary executables and which are binary shared libraries).

Ultimately the second way where you load the library with ctypes is the right way to do it, although very little in how I do it in this repo is actually correct (this repo is basically a mess).

The code in https://github.com/Erotemic/pyhesaff is a standalone version of the entire "hessian-affine+sift" feature detector/describer algorithm.

If you are modifying this code, I would strongly recommend replacing any calls made to to these tpl files with calls that use the pyhesaff module directory. That module is more efficient (it avoids a lot of unnecessary data copies) and simpler to use. After pip install pyhesaff you should be able to:

import pyhesaff
import numpy as np
img = (np.random.rand(416, 416, 3) * 255).astype(np.uint8)  # dummy image for an example
(kpts, vecs) = pyhesaff.detect_feats_in_image(img)

That should drop into any location where tpl/pyhesaff.py / tpl/pyhesaffexe.py is used in hotspotter. If you need to operate on a file path instead of an in memory image use: pyhesaff.detect_feats(<path-to-image>).