12 FPN Correction Application
This chapter describes the GK7206 FPN (Fixed Pattern Noise) correction application example — sample_fpn. The application demonstrates the FPN correction feature, used to eliminate fixed pattern noise in sensor images.
The application source code is located in the SDK directory sample/fpn/, and serves as a reference template for developing image quality optimization applications.
1 Application Overview
1.1 Features
- FPN correction: eliminates fixed pattern noise in sensor images
- Interactive calibration: supports a custom number of calibration frames (1-256, powers of 2)
- Offline calibration: FPN calibration in VI offline mode
1.2 Technical Parameters
| Parameter | Value |
|---|---|
work_mode | 0 (vi offline fpn calibrate) |
Dependencies | sensor |
1.3 Directory Structure
sample/fpn/
├── Makefile # Build script
└── sample_fpn.c # Main program2 Build and Deployment
2.1 Prerequisites
Before building this application, make sure the following preparations are complete:
- SDK environment ready: set up the cross-compilation toolchain and SDK configuration by following SDK Build
- Sensor connected: an SC465SL or compatible image sensor
2.2 Build the Application
# Enter the sample directory
cd <SDK_PATH>/sample
# Build the fpn sample
make -C fpn clean && make -C fpn2.3 Deploy to the Board
# Mount the SD card (recommended)
mkdir -p /sd_card
mount -t vfat /dev/mmcblk1p1 /sd_card
# Transfer to the development board via SCP
scp sample/fpn/sample_fpn root@<board IP>:/sd_card/2.4 Run the Application
# Add execute permission
chmod +x /sd_card/sample_fpn
# Enter the SD card directory
cd /sd_card
# Run (work_mode 0)
./sample_fpn 0
# Interactively enter the number of calibration frames
Enter the number of calibration frames when prompted (1-256, must be a power of 2)
# Exit
Ctrl+C2.5 Expected Output
After a successful run, the terminal prints output similar to the following:
sample_fpn running
input number to set calibrate frame and press enter to confirm!
calibrate frame:After the number of calibration frames is entered, FPN calibration runs and the calibration result is output.
3 Internal Execution Logic
3.1 Application Architecture
The application adopts the following architecture:
Sensor → VI → FPN calibration → calibration result saved3.2 FPN Initialization Flow
// Step 1: system initialization
sample_comm_sys_init(&sys_config);
// Step 2: ISP initialization
sample_comm_isp_init();
// Step 3: VI start
sample_comm_vi_start(...);
// Step 4: VPSS start
sample_comm_vpss_start(...);
// Step 5: FPN initialization
xmedia_fpn_init();
// Step 6: configure FPN
xmedia_fpn_config_t fpn_config;
fpn_config.enable = XMEDIA_TRUE;
fpn_config.strength = 50; // correction strength
xmedia_fpn_set_config(&fpn_config);
// Step 7: VENC start
sample_comm_venc_start(...);
// Step 8: bind modules
xmedia_bind_vpss_to_venc(...);4 Key Programming Points
4.1 FPN Configuration
xmedia_fpn_config_t fpn_config;
fpn_config.enable = XMEDIA_TRUE;
fpn_config.strength = 50; // correction strength (0~100)
fpn_config.mode = XMEDIA_FPN_MODE_AUTO; // auto mode
xmedia_fpn_set_config(&fpn_config);4.2 FPN Enable/Disable
// Enable FPN
xmedia_fpn_enable(XMEDIA_TRUE);
// Disable FPN
xmedia_fpn_enable(XMEDIA_FALSE);5 Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| FPN effect not obvious | Correction strength set too low | Adjust the strength parameter to 50~80 |
| Picture too dark or too bright | Incorrect FPN configuration | Check the FPN configuration parameters |
| Initialization fails | Sensor does not support FPN | Check the sensor model |
