SlideShare una empresa de Scribd logo
1 de 7
public class seg
{
final int LINES = 100;
final int WORDS = 100;
final int CHARS = 100;
int line[]=new int[LINES];
int wordarr[][] = new int[LINES][WORDS];
int carr[][][]=new int[LINES][WORDS][CHARS];
int tarr[][][]=new int[LINES][WORDS][CHARS];
int larr[][][]=new int[LINES][WORDS][CHARS];
seg()
{
for(int i = 0; i < LINES; i++)
{
line[i] = -1;
for(int j = 0; j < WORDS; j++)
{
wordarr[i][j] = -1;
for(int k = 0; k < CHARS; k++)
{
carr[i][j][k] = -1;
tarr[i][j][k] = -1;
larr[i][j][k] = -1;
}
}
}
}
public int wordseg(int lineno, int w, int h, int vHisto[])
{
int m=0;
int t = 0;
while(t<w)
{
while(t < w && vHisto[t] == 0 )
t++;
if ( t >= w )
break;
wordarr[lineno][m] = t;
//System.out.println("t=" + t + "m= " + m + " " + vHisto[t]);
m++;
while(t < w && vHisto[t] > 0 )
t++;
if ( t >= w )
break;
wordarr[lineno][m] = t;
//System.out.println("t=" + t + "m= " + m + " " + vHisto[t]);
m++;
}
wordarr[lineno][m] = -1;
return m;
}
public int lineseg(int w, int h, int hHisto[])
{
int m=0;
int t = 0;
while(t<=h)
{
while(t < h && hHisto[t] == 0 )
t++;
if ( t >= h )
break;
//System.out.println("t=" + t + "m= " + m + " " + hHisto[t]);
line[m] = t;
m++;
while(t < h && hHisto[t] > 0 )
t++;
if ( t >= h )
break;
line[m] = t;
//System.out.println("t=" + t + "m= " + m + " " + hHisto[t]);
m++;
}
line[m] =-1;
return m;
}
public int hline(int ln, int wn, int w, int h, int hHisto[])
{
if(wordarr[ln][2*wn] ==-1 )
{
carr[ln][wn][0]=-1;
return -1;
}
int hlinepos=0;
int max=0;
//PixelGrabber pg = new PixelGrabber (img,ss[ln][0],line[0],w,h,pixels,0,w);
for(int m=0;m<h;m++)
if(hHisto[m]>=max)
{
//System.out.println(m + " " + hHisto[m]);
hlinepos=m;
max=hHisto[m];
}
if(hlinepos >= 20 || hlinepos <9)
{
//carr[ln][wn][0]=-1;
hlinepos=11;
}
return hlinepos;
}
public void ccharseg(int ln, int wn, int w, int h, int vHisto[])
{ //System.out.println("hlinepos "+hlinepos);
int m=0;
int t = 0;
while(t<w)
{
while(t < w && vHisto[t] == 0 )
t++;
if ( t >= w )
break;
carr[ln][wn][m] = t-1 + wordarr[ln][2*wn];
m++;
while(t < w && vHisto[t] > 0 )
t++;
if ( t >= w )
carr[ln][wn][m] = w-1+wordarr[ln][2*wn];
else
carr[ln][wn][m] = t-1 + wordarr[ln][2*wn];
m++;
}
carr[ln][wn][m] = -1;
} //System.out.println(ln + " " + wn + " " + m);
//for(int i = 0; i <m ; i++)
//System.out.println(carr[ln][wn][i]);
public void tcharseg(int ln, int wn, int w, int h, int vHisto[])
{ //System.out.println("hlinepos "+hlinepos);
int m=0;
int t = 0;
while(t<w)
{
while(t < w && vHisto[t] == 0 )
t++;
if ( t >= w )
break;
tarr[ln][wn][m] = t-1 + wordarr[ln][2*wn];
m++;
while(t < w && vHisto[t] > 0 )
t++;
if ( t >= w )
tarr[ln][wn][m] = w-1+wordarr[ln][2*wn];
else
tarr[ln][wn][m] = t-1 + wordarr[ln][2*wn];
m++;
}
tarr[ln][wn][m] = -1;
}//tchar
}

Más contenido relacionado

La actualidad más candente

pycon jp 2016 ---- CguTranslate
pycon jp 2016 ---- CguTranslatepycon jp 2016 ---- CguTranslate
pycon jp 2016 ---- CguTranslateRenyuan Lyu
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++Ankit Kumar
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Dr. Volkan OBAN
 
Wap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmWap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmKapil Pandit
 
Lcs & fractional knapsack
Lcs & fractional knapsackLcs & fractional knapsack
Lcs & fractional knapsackSajid Hasan
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onDr. Volkan OBAN
 
ggplot2: An Extensible Platform for Publication-quality Graphics
ggplot2: An Extensible Platform for Publication-quality Graphicsggplot2: An Extensible Platform for Publication-quality Graphics
ggplot2: An Extensible Platform for Publication-quality GraphicsClaus Wilke
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicalsManoj Chauhan
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignmentashikul akash
 

La actualidad más candente (17)

pycon jp 2016 ---- CguTranslate
pycon jp 2016 ---- CguTranslatepycon jp 2016 ---- CguTranslate
pycon jp 2016 ---- CguTranslate
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Basic Calculus in R.
Basic Calculus in R. Basic Calculus in R.
Basic Calculus in R.
 
PythonArtCode
PythonArtCodePythonArtCode
PythonArtCode
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.
 
Wap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmWap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithm
 
Experement no 6
Experement no 6Experement no 6
Experement no 6
 
Lcs & fractional knapsack
Lcs & fractional knapsackLcs & fractional knapsack
Lcs & fractional knapsack
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,on
 
Sheet 3
Sheet 3Sheet 3
Sheet 3
 
Ooprc4 b
Ooprc4 bOoprc4 b
Ooprc4 b
 
ggplot2: An Extensible Platform for Publication-quality Graphics
ggplot2: An Extensible Platform for Publication-quality Graphicsggplot2: An Extensible Platform for Publication-quality Graphics
ggplot2: An Extensible Platform for Publication-quality Graphics
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicals
 
Sheet 1
Sheet 1Sheet 1
Sheet 1
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
Tugas 1
Tugas 1Tugas 1
Tugas 1
 

Destacado (8)

Course design
Course designCourse design
Course design
 
Roofing contractors
Roofing contractorsRoofing contractors
Roofing contractors
 
Course design sts perspectives
Course design sts perspectivesCourse design sts perspectives
Course design sts perspectives
 
Chinese words Eun
Chinese words EunChinese words Eun
Chinese words Eun
 
Abastos 2.0 en "Cook Circus nº 5"
Abastos 2.0 en "Cook Circus nº 5"Abastos 2.0 en "Cook Circus nº 5"
Abastos 2.0 en "Cook Circus nº 5"
 
Physics
PhysicsPhysics
Physics
 
Ocr code
Ocr codeOcr code
Ocr code
 
Ppt sla
Ppt slaPpt sla
Ppt sla
 

Similar a Seg code

Go vs C++ - CppRussia 2019 Piter BoF
Go vs C++ - CppRussia 2019 Piter BoFGo vs C++ - CppRussia 2019 Piter BoF
Go vs C++ - CppRussia 2019 Piter BoFTimur Safin
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphicsVtech Academy of Computers
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfanujsharmaanuj14
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtractionCharm Sasi
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212Mahmoud Samir Fayed
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfRohitkumarYadav80
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileKushagraChadha1
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingSergey Shishkin
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for SpeedYung-Yu Chen
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Mokshya Priyadarshee
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfeyewatchsystems
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfcontact32
 

Similar a Seg code (20)

Huraira_waris_Assgnment_4.docx
Huraira_waris_Assgnment_4.docxHuraira_waris_Assgnment_4.docx
Huraira_waris_Assgnment_4.docx
 
Go vs C++ - CppRussia 2019 Piter BoF
Go vs C++ - CppRussia 2019 Piter BoFGo vs C++ - CppRussia 2019 Piter BoF
Go vs C++ - CppRussia 2019 Piter BoF
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphics
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
 
Ann
AnnAnn
Ann
 
The Art of Clean Code
The Art of Clean CodeThe Art of Clean Code
The Art of Clean Code
 
Python hmm
Python hmmPython hmm
Python hmm
 
C programs
C programsC programs
C programs
 
Java binary subtraction
Java binary subtractionJava binary subtraction
Java binary subtraction
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdf
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical File
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional Programming
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
 

Último

DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 

Último (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 

Seg code

  • 1. public class seg { final int LINES = 100; final int WORDS = 100; final int CHARS = 100; int line[]=new int[LINES]; int wordarr[][] = new int[LINES][WORDS]; int carr[][][]=new int[LINES][WORDS][CHARS]; int tarr[][][]=new int[LINES][WORDS][CHARS]; int larr[][][]=new int[LINES][WORDS][CHARS]; seg() { for(int i = 0; i < LINES; i++) { line[i] = -1; for(int j = 0; j < WORDS; j++) { wordarr[i][j] = -1; for(int k = 0; k < CHARS; k++) { carr[i][j][k] = -1;
  • 2. tarr[i][j][k] = -1; larr[i][j][k] = -1; } } } } public int wordseg(int lineno, int w, int h, int vHisto[]) { int m=0; int t = 0; while(t<w) { while(t < w && vHisto[t] == 0 ) t++; if ( t >= w ) break; wordarr[lineno][m] = t; //System.out.println("t=" + t + "m= " + m + " " + vHisto[t]); m++; while(t < w && vHisto[t] > 0 ) t++;
  • 3. if ( t >= w ) break; wordarr[lineno][m] = t; //System.out.println("t=" + t + "m= " + m + " " + vHisto[t]); m++; } wordarr[lineno][m] = -1; return m; } public int lineseg(int w, int h, int hHisto[]) { int m=0; int t = 0; while(t<=h) { while(t < h && hHisto[t] == 0 ) t++; if ( t >= h ) break; //System.out.println("t=" + t + "m= " + m + " " + hHisto[t]); line[m] = t; m++; while(t < h && hHisto[t] > 0 ) t++;
  • 4. if ( t >= h ) break; line[m] = t; //System.out.println("t=" + t + "m= " + m + " " + hHisto[t]); m++; } line[m] =-1; return m; } public int hline(int ln, int wn, int w, int h, int hHisto[]) { if(wordarr[ln][2*wn] ==-1 ) { carr[ln][wn][0]=-1; return -1; } int hlinepos=0; int max=0; //PixelGrabber pg = new PixelGrabber (img,ss[ln][0],line[0],w,h,pixels,0,w); for(int m=0;m<h;m++) if(hHisto[m]>=max) {
  • 5. //System.out.println(m + " " + hHisto[m]); hlinepos=m; max=hHisto[m]; } if(hlinepos >= 20 || hlinepos <9) { //carr[ln][wn][0]=-1; hlinepos=11; } return hlinepos; } public void ccharseg(int ln, int wn, int w, int h, int vHisto[]) { //System.out.println("hlinepos "+hlinepos); int m=0; int t = 0; while(t<w) { while(t < w && vHisto[t] == 0 ) t++; if ( t >= w ) break; carr[ln][wn][m] = t-1 + wordarr[ln][2*wn]; m++;
  • 6. while(t < w && vHisto[t] > 0 ) t++; if ( t >= w ) carr[ln][wn][m] = w-1+wordarr[ln][2*wn]; else carr[ln][wn][m] = t-1 + wordarr[ln][2*wn]; m++; } carr[ln][wn][m] = -1; } //System.out.println(ln + " " + wn + " " + m); //for(int i = 0; i <m ; i++) //System.out.println(carr[ln][wn][i]); public void tcharseg(int ln, int wn, int w, int h, int vHisto[]) { //System.out.println("hlinepos "+hlinepos); int m=0; int t = 0; while(t<w) { while(t < w && vHisto[t] == 0 ) t++; if ( t >= w ) break; tarr[ln][wn][m] = t-1 + wordarr[ln][2*wn]; m++;
  • 7. while(t < w && vHisto[t] > 0 ) t++; if ( t >= w ) tarr[ln][wn][m] = w-1+wordarr[ln][2*wn]; else tarr[ln][wn][m] = t-1 + wordarr[ln][2*wn]; m++; } tarr[ln][wn][m] = -1; }//tchar }