This chapter introduces the GK7206 FPN (fixed pattern noise) correction sample, sample_fpn. It demonstrates FPN correction, which removes fixed pattern noise from sensor images.
The source lives in sample/fpn/ in the SDK and serves as a reference template for image-quality work.
| Parameter | Value |
|---|---|
work_mode |
0 (vi offline fpn calibrate) |
Dependency |
sensor |
sample/fpn/
├── Makefile # build script
└── sample_fpn.c # main program
Before building this application, make sure the following are ready:
# enter the sample directory
cd <SDK_PATH>/sample
# build the fpn sample
make -C fpn clean && make -C fpn
# mount the SD card (recommended)
mkdir -p /sd_card
mount -t vfat /dev/mmcblk1p1 /sd_card
# transfer to the board over SCP
scp sample/fpn/sample_fpn root@<board-IP>:/sd_card/
# make it executable
chmod +x /sd_card/sample_fpn
# enter the SD card directory
cd /sd_card
# run it (work_mode 0)
./sample_fpn 0
# enter the calibration frame count when prompted
enter the calibration frame count when prompted (1-256, must be a power of two)
# exit
Ctrl+C
After a successful start the terminal prints output like this:
sample_fpn running
input number to set calibrate frame and press enter to confirm!
calibrate frame:
After you enter the calibration frame count, FPN calibration runs and prints the result.
This application uses the following architecture:
Sensor -> VI -> FPN calibration -> save the calibration result
// Step 1: system initialization
sample_comm_sys_init(&sys_config);
// Step 2: ISP initialization
sample_comm_isp_init();
// Step 3: start VI
sample_comm_vi_start(...);
// Step 4: start VPSS
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: start VENC
sample_comm_venc_start(...);
// Step 8: bind the modules
xmedia_bind_vpss_to_venc(...);
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; // automatic mode
xmedia_fpn_set_config(&fpn_config);
// enable FPN
xmedia_fpn_enable(XMEDIA_TRUE);
// disable FPN
xmedia_fpn_enable(XMEDIA_FALSE);
| Problem | Likely cause | Fix |
|---|---|---|
| FPN effect is weak | Correction strength set too low | Raise strength to 50~80 |
| Image too dark or too bright | Wrong FPN configuration | Check the FPN configuration parameters |
| Initialization fails | Sensor does not support FPN | Check the sensor model |