Discussion:
LBP histogram dimension??
Goutham
2015-05-19 17:02:24 UTC
Permalink
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I can't
follow the previous post regarding this.Can anybody explain me further?
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2015-05-19 19:52:32 UTC
Permalink
Hi,

For 8 bit codes, 36 is just what comes out from the rotation invariant
condition.

The rule is that the binary codes are invariant to rotation. One way of
implementing this is to normalize all the codes to the minimal value of
all rotations (this value is called the pivot and aggregates all values
it represents). That is, you take each value, you try all possible
binary rolls and you take the minimal value. So, code 1 will actually
represent 1, 2, 4, 8, 16...; code 3 (0000 0011) will also represent 6
(0000 0110), 12 (0000 1100)...; code 5(000 0101) will also represent 10
(0000 1010)...

Now, we can just count how many of these pivots there are.


For 8 bit codes, a 1 bit roll can be implemented like this:

def roll1(i):
return ((i << 1) & 0xff) + bool(i & 128)

Now, we can check whether a binary value is a pivot using this basic
loop:

def is_min(v):
i = v
for _ in range(8):
i = roll1(i)
if i > v:
return False
return True

Ok, so how many pivots are there?
n_pivots = sum([is_min(i) for i in range(256)])

It's 36.

HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I can't
follow the previous post regarding this.Can anybody explain me further?
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2015-05-19 19:58:46 UTC
Permalink
There is a bug in the previous code (the < comparison should have read
). As written, it uses the maximum as the pivot. Of course, it doesn't
really matter as you end up with the same number of pivots (different
ones, but the same number of equivalent classes).

HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Hi,
For 8 bit codes, 36 is just what comes out from the rotation invariant
condition.
The rule is that the binary codes are invariant to rotation. One way of
implementing this is to normalize all the codes to the minimal value of
all rotations (this value is called the pivot and aggregates all values
it represents). That is, you take each value, you try all possible
binary rolls and you take the minimal value. So, code 1 will actually
represent 1, 2, 4, 8, 16...; code 3 (0000 0011) will also represent 6
(0000 0110), 12 (0000 1100)...; code 5(000 0101) will also represent 10
(0000 1010)...
Now, we can just count how many of these pivots there are.
return ((i << 1) & 0xff) + bool(i & 128)
Now, we can check whether a binary value is a pivot using this basic
i = v
i = roll1(i)
return False
return True
Ok, so how many pivots are there?
n_pivots = sum([is_min(i) for i in range(256)])
It's 36.
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I can't
follow the previous post regarding this.Can anybody explain me further?
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Goutham
2015-05-20 14:16:27 UTC
Permalink
Thanks, :)
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I can't
follow the previous post regarding this.Can anybody explain me further?
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Goutham
2015-05-21 17:54:55 UTC
Permalink
So the 36 bins corresponds to the 36 pivot values,like
0,1,3,5,7.....127,255..Right??
Post by Goutham
Thanks, :)
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I
can't follow the previous post regarding this.Can anybody explain me
further?
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2015-05-21 18:11:15 UTC
Permalink
Yes, exactly.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Goutham
So the 36 bins corresponds to the 36 pivot values,like
0,1,3,5,7.....127,255..Right??
Post by Goutham
Thanks, :)
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I
can't follow the previous post regarding this.Can anybody explain me
further?
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Goutham
2015-05-22 06:41:44 UTC
Permalink
Thank you :)
Post by Luis Pedro Coelho
Yes, exactly.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Goutham
So the 36 bins corresponds to the 36 pivot values,like
0,1,3,5,7.....127,255..Right??
Post by Goutham
Thanks, :)
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I
can't follow the previous post regarding this.Can anybody explain me
further?
--
You received this message because you are subscribed to the Google
Groups
Post by Goutham
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Goutham
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Goutham
2015-05-22 07:39:34 UTC
Permalink
For 16 neighbours the histogram bins in mahotas implementation is 4116
instead of 243 !!! I think this implementation take more computing time. !!!
Post by Luis Pedro Coelho
Yes, exactly.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Goutham
So the 36 bins corresponds to the 36 pivot values,like
0,1,3,5,7.....127,255..Right??
Post by Goutham
Thanks, :)
Post by Goutham
Why the LBP histogram in mahotas gives 36 bins instead of 59.Sorry,I
can't follow the previous post regarding this.Can anybody explain me
further?
--
You received this message because you are subscribed to the Google
Groups
Post by Goutham
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Goutham
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...