Prerequisites
- A working Android quickstart
- A started Camera2 session and ready Nosmai pipeline
Apply a subtle preset
import com.nosmai.effect.api.NosmaiBeauty; NosmaiBeauty.applySkinSmoothing(0.35f); NosmaiBeauty.applySkinWhitening(0.10f); NosmaiBeauty.applySharpen(0.15f); NosmaiBeauty.applyTeethWhitening(0.20f);
NosmaiBeauty queues these operations until the pipeline is ready, but the app should still wait for camera readiness before presenting enabled controls.
Parameter ranges
| Method | Range | Off value | Visible result |
|---|---|---|---|
applySkinSmoothing | 0.0f to 1.0f | 0.0f | Softens skin detail |
applySkinWhitening | 0.0f to 1.0f | 0.0f | Brightens skin tone |
applySharpen | 0.0f to 1.0f | 0.0f | Restores edge detail |
applyTeethWhitening | 0.0f to 1.0f | 0.0f | Brightens detected teeth |
Clamp values in the UI and update them from the main thread.
Reset beauty
NosmaiBeauty.clearAllBeautyFilters();
Verify it worked
Move smoothing between 0.0f and 0.4f. The preview should update without restarting Camera2 and remain close to the normal 30 FPS target.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| No visible change | Camera or pipeline is not ready | Wait for the preview readiness signal before enabling controls |
| Frame rate falls on a lower-tier device | Too many face or segmentation features are active | Test one feature, use 30 FPS, and reduce the camera resolution if needed |
| Beauty clears another effect | The visual modes conflict | Follow active-slot rules and observe pipeline state |