Problem related to image.match_descriptor

Hi, when I try image.match_descriptor for ORB descriptors, I find that kptmatch.count() will be 2x larger than length of kptmatch.match().

Example
kptmatch.count() Length of kptmatch.match()
20 10
15 8

From
http://docs.openmv.io/library/omv.image.html#class-kptmatch-keypoint-object

I assume that both kptmatch.count() and length of kptmatch.match() are the number of matched keypoints.

Do I misunderstand something ?

Thanks.

I’ve asked Ibrahim to look at this.

Hi, kptmatch.count() returns the number of matching keypoints pairs. while kptmatch.match() returns a list of tuples of matching keypoints indices. So they should be the same length, if count() returns 5 (5 pairs match), match() should return a list of 5 tuples [(0, 1), (1, 2), etc…]

This features was requested by someone and was never actually tested, I fixed now. Are you doing something with it ? would you like a patched fw image ?

Hi, thanks for your quick fix.

It will be great if you can provide me with the patched fw.

I still use OpenMV Cam M4, not sure if this could be a problem when updating fw.

As for the firmware update flow, do I just use Tools->Run Bootloader in IDE to update ?

Thanks again.

Yes, Ibrahim can get you an updated M4 firmware. We have to disable the FLIR driver though to do this which requires me to get invloved in the firmware. We are a little busy right now with Maker Faire so it will be a while.

Hello,
I’m using Openmv cam7 and lerning micropython. I saved ORB descriptor using “image.save_descriptor” then tried to match descriptors using
“image.match_descriptor”. But this error was returned.

OSError:Descriptor type is not supported

Same error was occuerred LBP descriptor. Please teach me how to solve this problem.

import time, image, sensor, pyb

def resistration():
    global kpts1
    global tem_img
    global FILE_NAME1
    global FILE_NAME2
    global FILE_NAME3
    global FILE_NAME4
    global desc1

    FILE_NAME1="01"
    FILE_NAME2="02"
    FILE_NAME3="03"
    FILE_NAME4="04"

    sensor.reset()
    sensor.set_pixformat(sensor.GRAYSCALE)
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(time = 2000)
    clock = time.clock()

    clock.tick()
    pyb.delay(100)
    tem_img=sensor.snapshot().save("/%s.bmp"%(FILE_NAME1),roi=(121,0,203,196))
    tem_img=tem_img.mode(3, threshold=True, offset=4, invert=True)
    kpts1=tem_img.find_keypoints(max_keypoints=300,roi=(121,0,203,196),threshold=20,normalized=False,scale_factor=1.2,corner_detector=image.CORNER_AGAST)
    key_temimg=tem_img.draw_keypoints(kpts1)
    desc1=image.save_descriptor(kpts1,"/%s.orb"%(FILE_NAME1))

def authentication():
    global img_dst

    sensor.reset()
    sensor.set_pixformat(sensor.GRAYSCALE)
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(time = 2000)
    clock = time.clock()

    clock.tick()
    pyb.delay(100)
    img=sensor.snapshot().save("/%s.bmp"%(FILE_NAME3),roi=(121,0,203,196))
    tem2=img.mode(3, threshold=True, offset=4, invert=True)
    kpts2=tem2.find_keypoints(max_keypoints=300,roi=(121,0,203,196),threshold=20,normalized=False,scale_factor=1.2,corner_detector=image.CORNER_AGAST)
    key_img=tem2.draw_keypoints(kpts2)
    desc2=image.save_descriptor(kpts2,"/%s.orb"%(FILE_NAME4))
    match=image.match_descriptor(desc1,desc2,threshold=70,filter_outliers=True)
    if  match.count()>=10:
        print(match.count())
        time.sleep(100)
    else:
        print("match count:",match.count())
        raise(Exception("AUTHENTICATE FAIL : TRY AGAIN!"))

Thank you for your advence.

I’ll ping Ibrahim about this but I think we’ve basically abandoned that code.

desc2=image.save_descriptor(kpts2,"/%s.orb"%(FILE_NAME4))

The save_descriptor doesn’t return a descriptor object it returns True or raises an exception, so you’re passing boolean values to image.match_descriptor() you should use kpts1 and kpts2. Also I don’t think that’s how globals are used (google python global variables).

Please start with the examples and modify from there.

I understand,Thank you.