Traduction de code Java vers MATLAB
Bonjour,
comment traduire ce code Java en MATLAB ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| public void Segmenteur()
{
this.realisation_histo_Vertical();
epaisseur= this.getHistogramme_Vertical().calculEpaisseur();
//passer les pixels blancs "=0"
int p=w-1;
while((this.getHistogramme_Vertical().toArray()[p].equals(0)||this.getHistogramme_Vertical().toArray()[p].equals(epaisseur)) && p>=0)// passer les pixels 0 a la fin de l'image
p--;
int i=p;
while((i-2)>0 )
{
if(!(this.getHistogramme_Vertical().toArray()[i-1].equals(epaisseur)) &&(this.getHistogramme_Vertical().toArray()[i].equals(epaisseur)))
{ if(!(this.getHistogramme_Vertical().toArray()[i-2].equals(0)) )
if((p-i>3) && matrices[i][lignedebase-1]==1 && matrices[i-1][lignedebase-1]==1&& matrices[i+1][lignedebase-1]==1 )// passer les segment de petitte teaille ( largeur <4)
{
for(int j=0;j<h;j++)
this.matrices[i][j]=0;
p=i;
}
}
i--;
}
for(int k=0;k<h;k++)
{
for(int j=0;j<w;j++)
System.out.print(this.matrices [j][k]);
System.out.println();
}
saveSegment();
} |
et mercii :)