Problem related to image.match_descriptor

General discussion about topics related to OpenMV.
wayne
Posts: 4
Joined: Fri Aug 18, 2017 2:46 am

Problem related to image.match_descriptor

Postby wayne » Wed May 16, 2018 5:29 am

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.
User avatar
kwagyeman
Posts: 2447
Joined: Sun May 24, 2015 2:10 pm

Re: Problem related to image.match_descriptor

Postby kwagyeman » Thu May 17, 2018 10:41 am

I've asked Ibrahim to look at this.
Nyamekye,
User avatar
iabdalkader
Posts: 624
Joined: Sun May 24, 2015 3:53 pm

Re: Problem related to image.match_descriptor

Postby iabdalkader » Thu May 17, 2018 5:54 pm

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 ?
wayne
Posts: 4
Joined: Fri Aug 18, 2017 2:46 am

Re: Problem related to image.match_descriptor

Postby wayne » Thu May 17, 2018 8:21 pm

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.
User avatar
kwagyeman
Posts: 2447
Joined: Sun May 24, 2015 2:10 pm

Re: Problem related to image.match_descriptor

Postby kwagyeman » Fri May 18, 2018 12:53 am

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.
Nyamekye,
wjtm
Posts: 2
Joined: Tue Aug 28, 2018 10:02 pm

Re: Problem related to image.match_descriptor

Postby wjtm » Wed Aug 29, 2018 12:40 am

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.
User avatar
kwagyeman
Posts: 2447
Joined: Sun May 24, 2015 2:10 pm

Re: Problem related to image.match_descriptor

Postby kwagyeman » Wed Aug 29, 2018 1:34 am

I'll ping Ibrahim about this but I think we've basically abandoned that code.
Nyamekye,
User avatar
iabdalkader
Posts: 624
Joined: Sun May 24, 2015 3:53 pm

Re: Problem related to image.match_descriptor

Postby iabdalkader » Wed Aug 29, 2018 11:58 am

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.
wjtm
Posts: 2
Joined: Tue Aug 28, 2018 10:02 pm

Re: Problem related to image.match_descriptor

Postby wjtm » Wed Aug 29, 2018 9:47 pm

I understand,Thank you.

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 2 guests