均值滤波代码
gy=module jz_filter
(
input p00,
input p01,
input p02,
input p10,
input p11,
input p12,
input p20,
input p21,
input p22,
outputoval
);
/*
121
242
121
*/
/*
wire signedgx,gy;
assign gx=(-{3'b000,p00}) + (+{3'b000,p02 }) +
(-{3'b000,(p10<<1)}) + (+{3'b000,(p12<<1) }) +
(-{3'b000,p20}) + (+{3'b000,p22 }) ;
assign gy= (-{3'b000,p00}) + (-{3'b000,(p01<<1)}) + (-{3'b000,p02}) +
(+{3'b000,p20}) + (+{3'b000,(p21<<1)}) + (+{3'b000,p22}) ;
wire gx_abs,gy_abs;
assign gx_abs=gx?~gx+1'b1:gx;
assign gy_abs=gy?~gy+1'b1:gy;
wire d;
assign d=gx_abs+gy_abs;
assign oval=d;
*/
wire sub;
assign sub=p00+p01+p02 +p10+ p12 +p20+p21+p22;
wire signed chaz;
assign chaz=sub-({3'b000,p11}<<3);
wire abs_chaz;
assign abs_chaz=chaz?~chaz+1'b1:chaz;
assignoval=abs_chaz;
//assign oval=sub;//取高8位
/*
wire sub;
assign sub=p00+p01+p02 +p10+p11+p12 + p20+p21+p22;
always @(*)begin
oval=sub/12'd9;
end
*/
endmodule 均值滤波代码 均值滤波代码
页:
[1]