Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an amplitude limiting filter for the variable qual #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/modules/flow/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ uint8_t compute_flow(uint8_t *image1, uint8_t *image2, float x_rate, float y_rat
const uint16_t hist_size = 2*(winmax-winmin+1)+1;

/* variables */
uint8_t qualValue=255;
uint8_t qualThreshold=15;
uint16_t pixLo = SEARCH_SIZE + 1;
uint16_t pixHi = FRAME_SIZE - (SEARCH_SIZE + 1) - TILE_SIZE;
uint16_t pixStep = (pixHi - pixLo) / NUM_BLOCKS + 1;
Expand Down Expand Up @@ -744,6 +746,8 @@ uint8_t compute_flow(uint8_t *image1, uint8_t *image2, float x_rate, float y_rat

/* calc quality */
uint8_t qual = (uint8_t)(meancount * 255 / (NUM_BLOCKS*NUM_BLOCKS));

if (qual-qualValue > qualThreshold || qualValue-qual > qualThreshold){
qualValue=qual;
}
return qual;
}