Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it ead an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it ead read an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it read an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

then, NO, feature matching can't be abused for object detection

you can only use it to find a part of a known scene, not with arbitrary images.

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it read an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

then, NO, feature matching can't be abused for object detection

you can only use it to find a part of a known scene, not with arbitrary images.images. (you'll have to re-think the whole (broken !) approach)

also:

good_matches=[]
for m,n in matches:
    if m.distance < 0.7 * n.distance:
        good_matches.append(m)
    return len(good_matches) ## what ? indentation error (it will return after the 1st) ?

please also learn, that the number of matches is entirely irrelevant here, it's NOT a measure for "similarity" or such.

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it read an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

then, NO, feature matching can't be abused for object detection

you can only use it to find a part of a known scene, not with arbitrary images. (you'll have to re-think the whole (broken !) approach)

also:

good_matches=[]
for m,n in matches:
    if m.distance < 0.7 * n.distance:
        good_matches.append(m)
    return len(good_matches) ## what ? indentation error (it will return after the 1st) ?

please also learn, that the number of matches is entirely irrelevant here, it's NOT here. if you happen to have a measure for "similarity" or such.

potted plant in the background in both images, it will happily take most matches from there. it does not at all know, "what you're looking for", so results are arbitrary.

python noobs NEVER validate their input, thus the funny errors.

did your capture open at all ? did it read an image ? was the imread() output valid ?

you HAVE TO CHECK ALL OF THOSE !

then, NO, feature matching can't be abused for object detection

you can only use it to find a part of a known scene, not with arbitrary images. (you'll have to re-think the whole (broken !) approach)

also:

good_matches=[]
for m,n in matches:
    if m.distance < 0.7 * n.distance:
        good_matches.append(m)
    return len(good_matches) ## what ? indentation error (it will return after the 1st) ?

please also learn, that the number of matches is entirely irrelevant here. if you happen to have a potted plant in the background in both images, it will happily take most matches from there. it does not at all know, "what you're looking for", so results are arbitrary.

so, "back to the drawing board" for you. discard this attempt, don't copypaste code without understanding it, and do some proper research on "object recognition" first.