SlideShare a Scribd company logo
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
}

More Related Content

TXT
PYTHON PROGRAMS FOR BEGINNERS
KEY
Kwp2 091217
DOCX
Interpolation graph c++
DOCX
Caropro
DOCX
imager package in R and examples..
PDF
Programa expresiones regulares
DOCX
Public string sacar
PDF
Feb 23 Extra Min Max Problems
PYTHON PROGRAMS FOR BEGINNERS
Kwp2 091217
Interpolation graph c++
Caropro
imager package in R and examples..
Programa expresiones regulares
Public string sacar
Feb 23 Extra Min Max Problems

What's hot (17)

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

Viewers also liked (8)

PPT
Course design
PPTX
Roofing contractors
PPT
Course design sts perspectives
PPTX
Chinese words Eun
PDF
Abastos 2.0 en "Cook Circus nº 5"
PPTX
Physics
DOC
Ocr code
PPTX
Course design
Roofing contractors
Course design sts perspectives
Chinese words Eun
Abastos 2.0 en "Cook Circus nº 5"
Physics
Ocr code
Ad

Similar to Seg code (20)

DOCX
Huraira_waris_Assgnment_4.docx
PDF
Go vs C++ - CppRussia 2019 Piter BoF
PPTX
Bank management system project in c++ with graphics
PDF
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
DOCX
PDF
The Art of Clean Code
PDF
Python hmm
PDF
Cryptography and network security record for cse .pdf
DOCX
DOCX
Java binary subtraction
PDF
The Ring programming language version 1.10 book - Part 33 of 212
PDF
C++ ARRAY WITH EXAMPLES
PDF
Implementing Software Machines in C and Go
PDF
C++ normal assignments by maharshi_jd.pdf
PDF
kdjfksdfkjsdkfjlsdfkjsdkfjsdklfjsdkfjsdklfjsdkl
PDF
JAVA PRACTICE QUESTIONS v1.4.pdf
PDF
Algorithm Design and Analysis - Practical File
PDF
Hitchhiker's Guide to Functional Programming
PDF
Write Python for Speed
DOC
Find the output of the following code (Java for ICSE)
Huraira_waris_Assgnment_4.docx
Go vs C++ - CppRussia 2019 Piter BoF
Bank management system project in c++ with graphics
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
The Art of Clean Code
Python hmm
Cryptography and network security record for cse .pdf
Java binary subtraction
The Ring programming language version 1.10 book - Part 33 of 212
C++ ARRAY WITH EXAMPLES
Implementing Software Machines in C and Go
C++ normal assignments by maharshi_jd.pdf
kdjfksdfkjsdkfjlsdfkjsdkfjsdklfjsdkfjsdklfjsdkl
JAVA PRACTICE QUESTIONS v1.4.pdf
Algorithm Design and Analysis - Practical File
Hitchhiker's Guide to Functional Programming
Write Python for Speed
Find the output of the following code (Java for ICSE)

Recently uploaded (20)

PDF
composite construction of structures.pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
additive manufacturing of ss316l using mig welding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
PPT on Performance Review to get promotions
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
web development for engineering and engineering
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
composite construction of structures.pdf
R24 SURVEYING LAB MANUAL for civil enggi
UNIT 4 Total Quality Management .pptx
Model Code of Practice - Construction Work - 21102022 .pdf
additive manufacturing of ss316l using mig welding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
CYBER-CRIMES AND SECURITY A guide to understanding
CH1 Production IntroductoryConcepts.pptx
PPT on Performance Review to get promotions
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
bas. eng. economics group 4 presentation 1.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
web development for engineering and engineering
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Foundation to blockchain - A guide to Blockchain Tech

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 }