Git Product home page Git Product logo

Comments (13)

AARS07 avatar AARS07 commented on July 28, 2024

The error is occurring in the following file and line of code:
File PySIFT/orientation.py", line 65, in assign_orientation

from pysift.

SamL98 avatar SamL98 commented on July 28, 2024

Thank you for liking the repo. Unfortunately, I don't maintain this repo anymore so I cannot guarantee I'll have time to look into the issue. In case I do, what is the shape of the image you are passing?

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

from pysift.

SamL98 avatar SamL98 commented on July 28, 2024

I appreciate that but I don't think I'd accept donations for this project.

I don't know of any of the forks that have actually made further commits but I just tried on a 195x195 image and it seemed to work. I recently made a commit slightly changing the main.py script. Take a look at the updated readme and try running again. Let me know if you still get the error and we can work from there.

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

from pysift.

SamL98 avatar SamL98 commented on July 28, 2024

I can't see the attached images as this was sent to me as a GitHub issue, not an email so I cannot test your specific images. Since running on a 195x195 image works on my end, I'm not sure what else I can do right now to troubleshoot. I would suggest for now, to use a lower number of octaves or a lower s (number of images per octave) when running on smaller images. I suggest this because it is my guess that on smaller images, the higher octaves are downsampled enough that the kernel is larger than the downsampled image.

As for the output, your understanding is correct. In addition to displaying the keypoints, the keypoint pyramid and the feature pyramid (the feature vector for each detected keypoint) are saved to the results/<output prefix>_kp_pyr.pkl and results/<output prefix>_feat_pyr.pkl files.

As for using this code in your masters dissertation, I would highly advise you to familiarize yourself with the code and make changes to it instead of using it out-of-the-box. This is because while superficially the algorithm seems to confirm to the Lowe paper, there could easily be discrepancies that I have not realized. In addition, there is a known bug in scaling the keypoints from the later octaves (see the "Limitations" section of the README).

There is also an old implementation of image matching/alignment in the match.py script which could potentially be used as a starting point for any alignment research.

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

from pysift.

SamL98 avatar SamL98 commented on July 28, 2024

Maybe upload them to google drive or something similar and post a shareable link? I'm not huge on posting my email address in public places.

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

With that 'failed' image I set the number of blur levels to 3 for each octave and I set a total of 3 octaves. And it worked. And it does make sense because if you have too many blur levels the final level might be downsampled to a point that you won't be able to find any features because the image is too small. Something which is not yet clear to me is why do you keep getting less features in the final result? For instance taking your example picture in the fourth octave there are way less features as compared to the first octave. My guess it is down to the increase in blurness. In the fourth octave there is more blurness as it uses the previous results of the previous octaves.

from pysift.

yangninghua avatar yangninghua commented on July 28, 2024

orientation.py

def assign_orientation(kps, octave, num_bins=36):
    .........#1
    w = int(2 * np.ceil(sigma))
    .........#2
    m, theta = get_grad(L, x, y)
    theta = 359 if(theta >=360) else theta

descriptors.py

def get_histogram_for_subregion(m, theta, num_bin, reference_angle, bin_width, subregion_w):
    .........#3
    for i, (mag, angle) in enumerate(zip(m, theta)):
        angle = (angle-reference_angle) % 360
        angle = 359 if (angle >= 360) else angle
        binno = quantize_orientation(angle, num_bin)

keypoints.py

def localize_keypoint(D, x, y, s):
    .........#4
    #offset = -LA.inv(HD).dot(J)
    x_hat = np.linalg.lstsq(HD, J)[0]
    offset = x_hat
    return offset, J, HD[:2,:2], x, y, s

from pysift.

AARS07 avatar AARS07 commented on July 28, 2024

from pysift.

yangninghua avatar yangninghua commented on July 28, 2024

Code changes to avoid errors

I got the same error as you, I changed the code like this, the code runs normally

from pysift.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.