mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix LBP ROI bug.
This commit is contained in:
parent
ac1b1b89ca
commit
7d8a2beee4
@ -53,14 +53,14 @@ const static uint8_t uniform_tbl[256] = {
|
|||||||
uint8_t *imlib_lbp_desc(image_t *image, rectangle_t *roi)
|
uint8_t *imlib_lbp_desc(image_t *image, rectangle_t *roi)
|
||||||
{
|
{
|
||||||
int s = image->w; //stride
|
int s = image->w; //stride
|
||||||
int RY = roi->h/LBP_NUM_REGIONS;
|
|
||||||
int RX = roi->w/LBP_NUM_REGIONS;
|
int RX = roi->w/LBP_NUM_REGIONS;
|
||||||
|
int RY = roi->h/LBP_NUM_REGIONS;
|
||||||
uint8_t *data = image->data;
|
uint8_t *data = image->data;
|
||||||
uint8_t *desc = xalloc0(LBP_DESC_SIZE);
|
uint8_t *desc = xalloc0(LBP_DESC_SIZE);
|
||||||
|
|
||||||
for (int y=roi->y; y<(roi->y+image->h)-3; y++) {
|
for (int y=roi->y; y<(roi->y+roi->h)-3; y++) {
|
||||||
int y_idx = (y-roi->y)/RY*LBP_NUM_REGIONS;
|
int y_idx = ((y-roi->y)/RY)*LBP_NUM_REGIONS;
|
||||||
for (int x=roi->x; x<(roi->x+image->w)-3; x++) {
|
for (int x=roi->x; x<(roi->x+roi->w)-3; x++) {
|
||||||
uint8_t lbp=0;
|
uint8_t lbp=0;
|
||||||
uint8_t p = data[(y+1)*s+x+1];
|
uint8_t p = data[(y+1)*s+x+1];
|
||||||
int hist_idx = y_idx+(x-roi->x)/RX;
|
int hist_idx = y_idx+(x-roi->x)/RX;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user