Skip to content

Commit

Permalink
Adjacent pixel check function fix
Browse files Browse the repository at this point in the history
The function is fixed so that it does not give false warnings when there are deviating pixels on the edges of the array
  • Loading branch information
slavysis authored Feb 7, 2023
1 parent f992a39 commit f6be7ca
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions functions/MLX90640_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,22 +1386,24 @@ static int ExtractDeviatingPixels(uint16_t *eeData, paramsMLX90640 *mlx90640)

static int CheckAdjacentPixels(uint16_t pix1, uint16_t pix2)
{

int pixPosDif;
uint16_t lp1 = pix1 >> 5;
uint16_t lp2 = pix2 >> 5;
uint16_t cp1 = pix1 - (lp1 << 5);
uint16_t cp2 = pix2 - (lp2 << 5);

pixPosDif = pix1 - pix2;
if(pixPosDif > -34 && pixPosDif < -30)
{
return -MLX90640_ADJACENT_BAD_PIXELS_ERROR;
}
pixPosDif = lp1 - lp2;
if(pixPosDif > -2 && pixPosDif < 2)
{
return -MLX90640_ADJACENT_BAD_PIXELS_ERROR;
pixPosDif = cp1 - cp2;
if(pixPosDif > -2 && pixPosDif < 2)
{
return -6;
}

}
if(pixPosDif > 30 && pixPosDif < 34)
{
return -MLX90640_ADJACENT_BAD_PIXELS_ERROR;
}


return 0;
}

Expand Down

0 comments on commit f6be7ca

Please sign in to comment.