Code Monkey home page Code Monkey logo

Comments (13)

kpoman avatar kpoman commented on May 28, 2024

Oh I see static final double maxAngleError = Math.toRadians(10); ... Is this the setting I need to better tolerate rotations ?

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

SourceAFIS algorithm will match fingerprints with any relative rotation. The parameter you found specifies maximum angle error in local minutia direction, which is completely unrelated to global rotation. There must be something else that is causing the drop in score. Does your sensor have the same DPI in X and Y directions? Is it big enough to produce sufficient overlap between two scans?

from sourceafis-java.

kpoman avatar kpoman commented on May 28, 2024

SourceAFIS algorithm will match fingerprints with any relative rotation. The parameter you found specifies maximum angle error in local minutia direction, which is completely unrelated to global rotation. There must be something else that is causing the drop in score. Does your sensor have the same DPI in X and Y directions? Is it big enough to produce sufficient overlap between two scans?

Robert, I'm gonna double-check as the templates are being generated via NIST nbis (xyt) and maybe I screwed something on the angle conversion to your own format. Is there any way to build a debug image with the image and the template set for it (even if I am forcing the template to be the one I calculated with another lib) ?

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

It's currently undocumented, but it works:

https://github.com/robertvazan/sourceafis-visualization-java

You likely need TransparencyGallery.shuffledMinutiae(). Look at TransparencyGalleryTest.

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

I forgot that you have imported templates, so TransparencyGallery won't do for you.

You need something like this:

Template parsed = Template.parse(fp.toByteArray());
byte[] visualization = new TransparencyImage(parsed.size)
	.image(image)
	.add(TransparencyMarkers.markTemplate(parsed))
	.bytes()

Then save visualization as an SVG file.

from sourceafis-java.

kpoman avatar kpoman commented on May 28, 2024

Robert, I suppose when you create Template, it is a FingerprintTemplate, right ? Because I dont have that class available !
Thanks !

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

If you use the maven artifact, you will get all the dependencies:

https://search.maven.org/artifact/com.machinezoo.sourceafis/sourceafis-visualization/0.4.1/jar

from sourceafis-java.

kpoman avatar kpoman commented on May 28, 2024

I do already have a FingerprintTemplate object (i.e. a string containing {"version": "3.8.1", "minutiae": [{"x": 58, "y": 241, "direction": 3.9269908169872414, "type": "bifurcation"}, {"x": .....) which I built this way:

    def __get_vendor_minutiae(self, rec):
        # we must convert our minutia object to SourceAFIS format which is json
        print('_get_vendor_minutiae')
        obj = {'version':'3.8.1', 'minutiae':[]}
        minutiae = rec['minutiae']
        for m in minutiae:
            minutia = {}
            minutia['x'] = m['x']
            minutia['y'] = m['y']
            minutia['direction'] = (m['a']/360.)*2*math.pi
            minutia['type'] = 'bifurcation' if m['t']==0 else 'ending'
            obj['minutiae'].append(minutia)
        json_obj = json.dumps(obj)
        s = gzip.compress(json_obj.encode('utf-8'))
        template = FingerprintTemplate(s)
        return template

(btw I am using SourceAfis from Python via jpype).
Unfortunately it doesnt have a size attribute. Is Template a similar type as FingerprintTemplate or do I have to create a Template bu doing the same I did for FingerprintTemplate (i.e. append minutia then json.dump then gzip) ?

Thank you !

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

Image size is informative. You can leave it zeroed.

from sourceafis-java.

kpoman avatar kpoman commented on May 28, 2024

Ok I think I got a result, I got something saved on disk with an svg:
<svg version="1.1" viewBox="-0.0 -0.0 0.0 0.0" xmlns="http://www.w3.org/2000/svg"><image width="0.0" height="0.0" href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDA...... ...... ....... LexuYZtFLcRs52Kv0PINezwQR20KRRII40GFUdAKcEAJIzycmgCu+m20t0l08Km4Vdu/HOPQ+tWulNYEgYO3mnUAIBimrHsJIJwT0PQfSnEjIBHJ6cUtADCWLjGAB97I6/Sn0UUAFFJnmloAKarbiRg8HGTTqKACiiigD//2Q=="/><g transform="translate(38.5 294.5) rotate(213.0)"><circle cx="0.0" cy="0.0" r="3.5" fill="none" stroke="green"/><line x1="3.5" y1="0.0" x2="10.0" y2="0.0" stroke="green"/></g><g transform="translate(46.5 273.5) rotate(213.0)"><circle cx="0.0" cy="0.0" r="3.5" fill="none" stroke="green"/><line x1="3.5" y1="0.0" x2="10.0" y2="0.0" stroke="green"/></g> ....... ........ ........ <g transform="translate(266.5 330.5) rotate(304.00000000000006)"><circle cx="0.0" cy="0.0" r="3.5" fill="none" stroke="blue"/><line x1="3.5" y1="0.0" x2="10.0" y2="0.0" stroke="blue"/></g></svg>

I'm trying to view the svg from many tools here with no luck, nor Chrome nor Linux Mint image viewer nor anything does open it. Bizarre !

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

Aha. Image size is optional for matching, but it will screw up visualization... Give the template some estimated size if you don't know the real image size.

from sourceafis-java.

kpoman avatar kpoman commented on May 28, 2024

Cool I finally could dump it ! It is pretty weird:
https://pasteboard.co/IM7qjTi.png
I dont get why it got so screwed. Maybe some endianness error (like image upside down) ?

from sourceafis-java.

robertvazan avatar robertvazan commented on May 28, 2024

Minutia positions are right. You have got angles wrong. Check your conversion code.

from sourceafis-java.

Related Issues (20)

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.