Skip to content

Add per-channel auto-calibration feature#230

Open
SummerSigh wants to merge 2 commits intomainfrom
feat/autocalibration
Open

Add per-channel auto-calibration feature#230
SummerSigh wants to merge 2 commits intomainfrom
feat/autocalibration

Conversation

@SummerSigh
Copy link
Member

When enabled, continuously tracks the running min/max of each face expression and eye lid channel, updating the calibration Lower/Upper bounds accordingly. This eliminates the need for users to manually set calibration ranges.

@CLAassistant
Copy link

CLAassistant commented Feb 27, 2026

CLA assistant check
All committers have signed the CLA.

When enabled, continuously tracks the running min/max of each face
expression and eye-lid channel, updating the calibration Lower/Upper
bounds accordingly. This eliminates the need for users to manually
set calibration ranges.

- Add AutoCalibrationEnabled property and ResetAutoCalibration to
  ICalibrationService / CalibrationService
- Subscribe CalibrationService to ExpressionChangeEvent to track
  per-channel min/max with a 0.5 seed value
- Fire AutoCalibrationReset event so CalibrationViewModel can
  refresh sliders synchronously before tracking begins
- Add saved setting toggle in AppSettingsViewModel and
  AppSettingsView
@dfgHiatus dfgHiatus self-requested a review February 27, 2026 19:20
@dfgHiatus dfgHiatus self-assigned this Feb 27, 2026
@dfgHiatus dfgHiatus added the enhancement New feature or request label Feb 27, 2026
};

// Face expression names ordered by inference output index (matches ParameterSenderService.FaceExpressionMap)
private static readonly string[] FaceExpressionNames =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of re-declaring this, we ought to make the ParameterSenderService.EyeExpressionMap/ParameterSenderService.FaceExpressionMap static readonly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ive made this change

return;

var calParam = _calibrationService.GetExpressionSettings(setting.Name);
var upperChanged = Math.Abs(setting.Upper - calParam.Upper) > 0.0001f;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use an epsilon?

Copy link
Member Author

@SummerSigh SummerSigh Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0.0001f threshold skips the update when the difference is just floating point noise caused from the double to float conversions through the Avalonia RangeSlider bindings

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replacing with setting.Upper != calParam.Upper would be fine too

…nNames

- Make ParameterSenderService.EyeExpressionMap and FaceExpressionMap
  public static readonly so they can be referenced directly
- CalibrationService.FaceExpressionNames now derives from
  ParameterSenderService.FaceExpressionMap.Keys instead of
  maintaining a hardcoded duplicate
- Remove unused _parameterSenderService field from CalibrationViewModel
@RamesTheGeneric
Copy link
Contributor

Tested and works on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants