I use lbp descriptor to recognize a pattern and, to filter local noise, i divide the image in several part with each a lbp descriptor.
My problem is if i use more than 4 lbp pattern, whatever the resolution, i have frequently deconnexion and it does not seem stable.
Do you have any knowledge about this problem and advice to do it better ?
Thanks,
Below is the simplified code, where you can define the number of line and column which define the number of areas where the lbp is defined and checked.
I tested the M7 and H7 camera, and both get problem if i increase the number of line and column.
With openmv 2.2.0 :
For M7 (rev 3.4.1), in VGA :
1 line and 1 column works
1 line and 2 column works
2 line and 1 column does not work
2 line and 2 column does not work
It stops at the lbp save step.
For H7 (rev 3.4.1), in VGA :
3 lines and 3 columns works but disconnect
import sensor, image
# Reset sensor
sensor.reset()
sensor.set_contrast(1)
sensor.set_gainceiling(16)
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time=1000)
# Variable to define
nline = 4
ncolumn = 4
thres = 15000
stext = 2
# Size definition
zoneW = sensor.width()
zoneH = sensor.height()
wcolumn = int(zoneW / ncolumn)
hline = int(zoneH / nline)
# Save lbp features
mode = "save" #0
if mode == "save" :
print("save -------------")
img = sensor.snapshot()
for i in range(0,nline) :
for j in range(0,ncolumn) :
dn = img.find_lbp( (int(j*wcolumn), int(i*hline), int(wcolumn), int(hline)) )
n = i*ncolumn+j
filename = "lbp" + str(n) + ".lbp"
if image.save_descriptor(dn, "%s" % filename) == False :
print("Error : ", filename)
print("check -------------")
while (True):
img = sensor.snapshot()
OK = 0
for i in range(0, nline) :
for j in range(0, ncolumn) :
d1 = img.find_lbp( ( int(j*wcolumn), int(i*hline), int(wcolumn), int(hline) ) )
filename = "lbp%d.lbp" % int(i*ncolumn+j)
dn = image.load_descriptor("%s" % filename)
dist = image.match_descriptor(dn, d1)
img.draw_string(int(j*wcolumn), int(i*hline) + 10, "%d" % dist, color=(0,0,0), scale=stext)
if dist < thres :
OK += 1
if OK > 0 :
print( "O_Ok : %d" % OK)
else :
print("Nok")
It seems to be a memory problem, but i dont know how free memory.
Thanks,
I red lbp.c and i discovered the weight are optimized for face recognition.
I would like to use for another use, what is the default values, and how can i define it to my own case ?
Well i understand than lbp_weights has a high value around eyes, medium value for mouth and ear, then low level for cheeks.
If i want to have a neutral use, i can set 1 for all the 7x7 matrix.
I dont understand what is for the uniform_tbl matrix ?