sir I want to convert my .m file to VHDL . my code is given below.

조회 수: 1 (최근 30일)
Harshit Sharma
Harshit Sharma 2015년 4월 23일
답변: Kiran Kintali 2021년 5월 22일
function veh
clear all;
close all;
a=imread('veh.png');
%a=rgb2gray(a);
imshow(a)
a=double(a);
b=imread('back.png');
%b=rgb2gray(b);
figure
imshow(b)
b=double(b);
for i=1:250
for j=1:400
sub(i,j)=abs(a(i,j)-b(i,j));
end
end
for i=1:250
for j = 1:399
dxSImg(i,j) =abs(sub(i,j+1)) -abs(sub(i,j));
end
end
for i = 1:249
for j =1:399
dySImg(i,j) =sub(i+1,j)-sub(i,j);
end
end
for i = 1:249
for j = 1:399
dfSImg(i,j) =abs(dxSImg(i,j))+abs(dySImg(i,j));
end
end
figure
imshow(dfSImg)
sum = 0;
Th = 0;
for i = 1:249
for j = 1:399
x(i,j) = mean(dfSImg(i,j));
y(i,j) = std(dfSImg(i,j));
Th = Th + x(i,j)+3*y(i,j);
end
end
for i = 1:249
for j = 1:399
if dfSImg(i,j)>=85
bwdSImg(i,j) = 1;
else
bwdSImg(i,j) = 0;
end
end
end
figure
imshow(bwdSImg)
cc = bwconncomp(bwdSImg);
for j = 1:399
Lveh = max(bwdSImg(i,j));
end
for i = 1:249
Hveh = max( bwdSImg(i,j));
end
rImg = imread('frame.png');
for i = 1:385
for j = 1:640
sl = 250*i;
sh = 250*i+400;
tl = 400*j;
th = 400*j+250;
for s = sl:sh
for t =tl:th
cImg(i,j) = rImg(s,t)/(400*250);
end
end
end
end
virtualRow(j) = 0;
for i= 1:249
virtualRow(j) =virtualImage(j)+bwdSImg(i,j);
end
virtualCol(i) = 0;
for j=1:399
virtualCol(i) = virtualCol(i)+ bwdSImg(i,j);
end

답변 (1개)

Kiran Kintali
Kiran Kintali 2021년 5월 22일
You need to break the design into two parts. A testbench and a design.
Follow basic example shown here.
>> mlhdlc_demo_setup('heq')

카테고리

Help CenterFile Exchange에서 HDL Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by