sir I want to convert my .m file code into python. Is it possible.my code is given below.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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:149
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
0 commentaires
Réponses (1)
Navaneeth Raman
le 23 Avr 2015
Hi,
There is no feature currently available in MATLAB that will convert MATLAB code to Python code automatically. You may search online for any open source software that does this.
Thanks,
Navaneeth
0 commentaires
Voir également
Catégories
En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!