sir I want to convert my .m file to VHDL . my code is given below.
1 view (last 30 days)
Show older comments
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
Answers (1)
Kiran Kintali
on 22 May 2021
You need to break the design into two parts. A testbench and a design.
Follow basic example shown here.
>> mlhdlc_demo_setup('heq')
0 Comments
See Also
Categories
Find more on HDL Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!