Please correct my code : rgb2gray image conversion using VHDL code
1 次查看(过去 30 天)
显示 更早的评论
Please correct my code : rgb2gray image conversion using VHDL code. I need in help in VHDL coding. This code is not working.
entity colorfilter is Port ( RI : in STD_LOGIC_VECTOR (7 downto 0); GI : in STD_LOGIC_VECTOR (7 downto 0); BI : in STD_LOGIC_VECTOR (7 downto 0); RTarget : in STD_LOGIC_VECTOR (7 downto 0); GTarget : in STD_LOGIC_VECTOR (7 downto 0); BTarget : in STD_LOGIC_VECTOR (7 downto 0); O : out STD_LOGIC); end colorfilter;
architecture Behavioral of colorfilter is
signal sqrtsum : std_logic_vector(17 downto 0);
signal threshold : std_logic_vector(17 downto 0) : ="000000001100000000"
begin
process(RI, BI, GI)
varible Rdiff, Gdiff, Bdiff : std_logic_vector(17 downto 0);
variable sum : std_logic_vector(17 downto 0);
variable R2, G2, B2 : std_logic_vector(15 downto 0);
begin
if (RI > RTarget) then
Rdiff := RI-Rtarget;
else
Rdiff := Rtarget-RI;
end if;
if (GI > GTarget) then
Gdiff := GI - GTarget;
colorfilter.vhd
else
end if;
if (BI > BTarget) then
Bdiff := BI - BTarget;
else
Bdiff := BTarget - BI;
end if;
R2 := Rdiff*Rdiff;
G2 := Gdiff*Gdiff;
B2 := Bdiff*Bdiff;
sqrtsum <= ("00"&R2) + ("00"&G2) + ("00"&B2);
if (sqrtsum > threshold) then
O <= '0';
else
O <= '1';
end if;
end process;
end Behavioral;
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 FPGA, ASIC, and SoC Development 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!