Page 1 of 1

Problem related to image.match_descriptor

Posted: Wed May 16, 2018 5:29 am
by wayne
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 ... int-object

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

Do I misunderstand something ?

Thanks.

Re: Problem related to image.match_descriptor

Posted: Thu May 17, 2018 10:41 am
by kwagyeman
I've asked Ibrahim to look at this.

Re: Problem related to image.match_descriptor

Posted: Thu May 17, 2018 5:54 pm
by iabdalkader
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 ?

Re: Problem related to image.match_descriptor

Posted: Thu May 17, 2018 8:21 pm
by wayne
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.

Re: Problem related to image.match_descriptor

Posted: Fri May 18, 2018 12:53 am
by kwagyeman
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.

Re: Problem related to image.match_descriptor

Posted: Wed Aug 29, 2018 12:40 am
by wjtm
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.

Code: Select all

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.

Re: Problem related to image.match_descriptor

Posted: Wed Aug 29, 2018 1:34 am
by kwagyeman
I'll ping Ibrahim about this but I think we've basically abandoned that code.

Re: Problem related to image.match_descriptor

Posted: Wed Aug 29, 2018 11:58 am
by iabdalkader

Code: Select all

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.

Re: Problem related to image.match_descriptor

Posted: Wed Aug 29, 2018 9:47 pm
by wjtm
I understand,Thank you.