Skip to content

Feat: Add debounce mechanism to stabilize image display#5

Open
Elyter wants to merge 1 commit into
reinesana:mainfrom
Elyter:feat/debounce
Open

Feat: Add debounce mechanism to stabilize image display#5
Elyter wants to merge 1 commit into
reinesana:mainfrom
Elyter:feat/debounce

Conversation

@Elyter

@Elyter Elyter commented Jan 15, 2026

Copy link
Copy Markdown

Problem
The image switching (cat reaction) was sometimes too unstable and sensitive to micro-variations in facial detection, causing rapid flickering between two states.

Solution
I implemented a "debounce" mechanism in the main loop.

Introduced a pending_cat_image variable and a debounce_counter.

The displayed image (current_cat_image) only updates if the new detected expression remains constant for a certain number of consecutive frames (defined by DEBOUNCE_THRESHOLD = 5).

Changes
Modified main.py to integrate the counting and threshold logic.

@Elyter Elyter changed the title Add debounce mechanism to stabilize image display Feat: Add debounce mechanism to stabilize image display Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant