一、軟件介紹
本系統(tǒng)采用了LATTICE的XP系列芯片,所用軟件為splever7.0,應(yīng)用本軟件有一個新加功能,可以用FPGA的底層資源生成一個簡單CPU的框架,并且在軟件的庫里邊,有很多的模塊可以調(diào)用,例如GPIO接口,I2C接口等。本系統(tǒng)的設(shè)計使用的是I2C接口。
二、系統(tǒng)構(gòu)成
圖1 系統(tǒng)框圖
本系統(tǒng)(系統(tǒng)框圖如圖1)是采用FPGA進(jìn)行實時運算。從cmos傳感器出來的數(shù)字信號首先經(jīng)過白平衡處理模塊,在這個模塊中,需要對圖象中的R、G、B的分量分別進(jìn)行計算,求出他們各自的均值。一般情況下,只有當(dāng)他們各自的均值為128或者129的時候,我們可以認(rèn)為圖象達(dá)到了白平衡的狀態(tài),當(dāng)然有一個前提就是要對一個白色的背景取圖。如果他們的均值不相等,或者沒有達(dá)到128或者129的值時,給I2C模塊一個信號,使之對傳感器的顏色分量寄存器進(jìn)行設(shè)置,直到完全為我們所期待的數(shù)值為止。
三、部分程序和接口
module send( reset_n,
clk,
vsync,
href,
data_in,
data_out);
input reset_n;
//系統(tǒng)復(fù)位信號
input clk;
//系統(tǒng)時鐘
input vsync;
//廠信號
input href;
//行信號
input [9:0]data_in;
//圖象數(shù)據(jù)
output [29:0]data_out;//色彩分量均值
reg [25:0]count_r;
always@(negedge clk or posedge posevsync)begin
if(posevsync)
count_r 《= 26‘h00000000;
else begin
if(hs_count》=10’d129&&hs_count《=10‘d640)
begin
if((pixcount》=11’d384&&pixcount《=11‘d895)&&row_odd_href)
begin
if(!row_odd_pix)
count_r 《= count_r + data_in;
else
count_r 《= count_r;
end
else
count_r 《= count_r;
end
else
count_r 《= count_r;
end
end
reg [26:0]count_g;
always@(negedge clk or posedge posevsync)begin
if(posevsync)
count_g 《= 27’h00000000;
else begin
if(hs_count》=10‘d129&&hs_count《=10’d640)
begin
if(pixcount》=11‘d384&&pixcount《=11’d895)
begin
if(row_odd_href)
begin
if(row_odd_pix)
count_g 《= count_g + data_in;
else
count_g 《= count_g;
end
else begin
if(!row_odd_pix)
count_g 《= count_g + data_in;
else
count_g 《= count_g;
end
end
else
count_g 《= count_g;
end
else
count_g 《= count_g;
end
end
reg [25:0]count_b;
always@(negedge clk or posedge posevsync)begin
if(posevsync)
count_b 《= 26‘h00000000;
else begin
if(hs_count》=10’d129&&hs_count《=10‘d640)
begin
if((pixcount》=11’d384&&pixcount《=11‘d895)&&(!row_odd_href))
begin
if(row_odd_pix)
count_b 《= count_b + data_in;
else
count_b 《= count_b;
end
else
count_b 《= count_b;
end
else
count_b 《= count_b;
end
end
reg [29:0]data_out;
always@(negedge vsync or negedge reset_n)begin
if(!reset_n)
data_out 《= 30’h0000000000;
else
data_out
《= {count_r[25:16], count_g[26:17], count_b[25:16]};
end
四、仿真圖形
系統(tǒng)的總體仿真圖如圖2
圖2 系統(tǒng)仿真圖
五、結(jié)論
采用FPGA對自動白平衡進(jìn)行運算的一個最大的優(yōu)點就是所有的操作都是實時進(jìn)行,不需要先緩存一整張圖象,所以中間沒有延時,不僅運算速度快,而且圖像的相質(zhì)還可以得到很好的改良。
-
傳感器
+關(guān)注
關(guān)注
2553文章
51415瀏覽量
756671 -
FPGA
+關(guān)注
關(guān)注
1630文章
21799瀏覽量
606082 -
芯片
+關(guān)注
關(guān)注
456文章
51217瀏覽量
427368
發(fā)布評論請先 登錄
相關(guān)推薦
白平衡自動測量調(diào)整儀的工作原理實現(xiàn)設(shè)計
![<b class='flag-5'>白平衡</b><b class='flag-5'>自動</b>測量調(diào)整儀的工作原理<b class='flag-5'>實現(xiàn)</b>設(shè)計](https://file.elecfans.com/web1/M00/C3/86/pIYBAF8jaK6Acj7YAAChH6NHY8I082.png)
什么是白平衡
基于FPGA的BayerCCD相機(jī)彩色自動白平衡設(shè)計
什么是自動白平衡
白平衡幾種算法總結(jié)
![<b class='flag-5'>白平衡</b>幾種算法總結(jié)](https://file.elecfans.com/web1/M00/44/FE/pIYBAFpetuCAbc3mAAB8T_6ULXE177.png)
圖像白平衡原理及實現(xiàn)
自動白平衡算法
![<b class='flag-5'>自動</b><b class='flag-5'>白平衡</b>算法](https://file.elecfans.com/web1/M00/45/00/pIYBAFpexBiAYEpcAAAsguqPrw4943.png)
什么是白平衡漂移_白平衡漂移概念
采用LATTICE XP系列芯片和I2C接口實現(xiàn)自動白平衡的FPGA
白平衡是什么?機(jī)器視覺基礎(chǔ)知識之白平衡的工作原理與設(shè)置
淺析基于FPGA自動白平衡算法的簡述與實戰(zhàn)
基于FPGA自動白平衡算法的介紹和實現(xiàn)
基于FPGA的Bayer彩色自動白平衡設(shè)計
![基于<b class='flag-5'>FPGA</b>的Bayer彩色<b class='flag-5'>自動</b><b class='flag-5'>白平衡</b>設(shè)計](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
評論