b atch i mage p rocessing l anguage
DESCRIPTION
B atch I mage P rocessing L anguage. Programming Language and Translator Final Project (Team 15). What is BIPL. Batch Image Processing Language Procedural scripting language . Why is BIPL. Simple & Intuitive Powerful Flexible. Project Manage - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/1.jpg)
Batch Image Processing Language
Programming Language and Translator Final Project (Team 15)
![Page 2: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/2.jpg)
What is BIPL
• Batch Image Processing Language
• Procedural scripting language
![Page 3: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/3.jpg)
Why is BIPL Simple & Intuitive Powerful Flexible
![Page 4: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/4.jpg)
Project ManageShih-Hao Tsai (Project Manager)
StructureTerry Tsai (Language Guru)
Compiler ArchitectureFan Wei (System Architect)
EnvironmentYi-Hong Lin (System Integrator)
Testing Chun-Chao Wang (Testing & validate)
![Page 5: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/5.jpg)
How Project Managed
• Weekly meeting
• Version Control
![Page 6: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/6.jpg)
Project ManageShih-Hao Tsai (Project Manager)
StructureTerry Tsai (Language Guru)
Compiler ArchitectureFan Wei (System Architect)
EnvironmentYi-Hong Lin (System Integrator)
Testing Chun-Chao Wang (Testing & validate)
![Page 7: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/7.jpg)
Program Structure
Function Declarations
Begin Block
Body Block
End Block
![Page 8: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/8.jpg)
Function Declarations
image apply_watermark(string str, image i) { image lbl = label(str, "Tahoma",72, 0, 200, 40); return lbl
# [(i.width-lbl.width)/2, (i.height-lbl.height)/2]: compose(i, .);
}
![Page 9: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/9.jpg)
Begin Block
BEGIN { string path = ""; int x = 0, y = 0; int xRes = 1366, yRes = 768; int scale = yRes / 10;
image canv = canvas(xRes, yRes);}
![Page 10: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/10.jpg)
Body Block{ if (path == "") canv.pathname = $.pathname; $ = $ * [$.width, scale];
if (x + $.width <= canv.width) { canv = compose(canv, $ # [x,y]); x += $.width;
} else { int lsize = canv.width-x; int rsize = $.width - lsize;
canv = $ : crop(., [0,0], [lsize,$.height]) # [x,y] : compose(canv, .);
(x = 0, y += scale); if (y >= canv.width) break;
canv = $ : crop(., [lsize,0], [rsize,$.height]) # [x,y] : compose(canv, .);
x += rsize; }}
canv = $ : crop(., [0,0], [lsize,$.height]) # [x,y] : compose(canv, .);
(x = 0, y += scale);if (y >= canv.width) break;
canv = $ : crop(., [lsize,0], [rsize,$.height]) # [x,y] : compose(canv, .);
canv = $ : crop(., [0,0], [lsize,$.height]) # [x,y] : compose(canv, .);
(x = 0, y += scale);if (y >= canv.width) break;
canv = $ : crop(., [lsize,0], [rsize,$.height]) # [x,y] : compose(canv, .);
![Page 11: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/11.jpg)
End Block
END { canv = apply_watermark("generated using BIPL", canv); canv.filename = "CANVAS"; save(canv, "JPG");}
![Page 12: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/12.jpg)
Project ManageShih-Hao Tsai (Project Manager)
StructureTerry Tsai (Language Guru)
Compiler ArchitectureFan Wei (System Architect)
EnvironmentYi-Hong Lin (System Integrator)
Testing Chun-Chao Wang (Testing & validate)
![Page 13: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/13.jpg)
Translator Architecture
Tokenizer Parser SymbolTable
flex++
bipl_frontend.exe
Image modules
skeleton
bison
bipl.l symboltable.hbipl.y
test.biplFunction
Declarations
Begin Block
Body Block
End Block7 types
operator overloading
Built-in functions
prebuilt libraries
module.dlltest.exe
FRONTEND BACKEND
C
![Page 14: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/14.jpg)
Sample Programint x () return 1;
BEGIN {image c = canvas( 1000.0, 1000.0);int i = 0, j = 0;}
{c = compose(c, $ * [100,100] # [i*100,j*100]);i = i + 1;if (i == 10) {i = 0;j = j + 1;}}
END {c.filename = "test";save(c, "JPG");}
![Page 15: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/15.jpg)
Tokenizer Parser SymbolTable
flex++
bipl_frontend.exe
Image modules
skeleton
bison
bipl.l symboltable.hbipl.y
test.biplFunction
Declarations
Begin Block
Body Block
End Block7 types
operator overloading
Built-in functions
prebuilt libraries
module.dlltest.exe
FRONTEND BACKEND
C
Translator Architecture
![Page 16: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/16.jpg)
int x () return 1; BEGIN {image c = canvas( 1000.0, 1000.0);
<T_INT> <id, 1> <(> <)> <RETURN> <INT_CONST> <;><BEGIN> <{>
<T_IMAGE> <id, 2> <=> <id, 3> <(> <FLT_CONST> <,> <FLT_CONST> <)> <;>
Tokenizer
![Page 17: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/17.jpg)
End Block
Tokenizer Parser SymbolTable
flex++
bipl_frontend.exe
Image modules
skeleton
bison
bipl.l symboltable.hbipl.y
test.biplFunction
Declarations
Begin Block
Body Block
7 typesoperator overloading
Built-in functions
prebuilt libraries
module.dlltest.exe
FRONTEND BACKEND
C
End Block
Translator Architecture
![Page 18: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/18.jpg)
=
T_IMAGE
expr1
id2 ( FLT_CONST FLT_CONST
expr2
) ;
imageTypes c canvas 1000.0 1000.0
canvas imageTypes 2
compose imageTypes 2
… … …
x intTypes 0
... … …
c imageTypes -1
int x () return 1; BEGIN {image c = canvas( 1000.0, 1000.0);
Parser
id1 ,
![Page 19: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/19.jpg)
Tokenizer Parser SymbolTable
flex++
bipl_frontend.exe
Image modules
skeleton
bison
bipl.l symboltable.hbipl.y
test.biplFunction
Declarations
Begin Block
Body Block
End Block7 types
operator overloading
Built-in functions
prebuilt libraries
module.dlltest.exe
FRONTEND BACKEND
C
Translator Architecture
![Page 20: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/20.jpg)
Function DeclarationsintTypes x() return intTypes(1);
Begin BlockimageTypes c = canvas(floatTypes(1000.0),floatTypes(1000.0));intTypes i = intTypes(0), j = intTypes(0);
Body Blockc = compose(c,_dollar_sign*pairTypes(100,100)|pairTypes (i*intTypes(100),j*intTypes(100)));i = i+intTypes(1);if (i==intTypes(10)) {i = intTypes(0);j = j+intTypes(1);}
End Blockc.filename = stringTypes("test");save(c,stringTypes("JPG"));
Frontend Output
int x () return 1;
BEGIN {image c = canvas( 1000.0, 1000.0);int i = 0, j = 0;}{c = compose(c, $ * [100,100] # [i*100,j*100]);i = i + 1;if (i == 10) {I = 0;j = j + 1;}}END {c.filename = "test";save(c, "JPG");}
![Page 21: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/21.jpg)
Tokenizer Parser SymbolTable
flex++
bipl_frontend.exe
Image modules
skeleton
bison
bipl.l symboltable.hbipl.y
test.biplFunction
Declarations
Begin Block
Body Block
End Block7 types
operator overloading
Built-in functions
prebuilt libraries
module.dlltest.exe
FRONTEND BACKEND
C
Translator Architecture
![Page 22: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/22.jpg)
Project ManageShih-Hao Tsai (Project Manager)
StructureTerry Tsai (Language Guru)
Compiler ArchitectureFan Wei (System Architect)
EnvironmentYi-Hong Lin (System Integrator)
Testing Chun-Chao Wang (Testing & validate)
![Page 23: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/23.jpg)
Runtime Environment• Use parameters to indicate files or directory• Supported image file type will be selected• (runtime) Dynamic-linked library may load
> build_bipl.bat test.bipl> test.exe -f path/to/somefolder > test.exe> test.exe lena.jpg lena.bmp
test.exedirectorylist of image files Outputs
Dynamic-linked libraries
![Page 24: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/24.jpg)
Development Environment• Bison(yacc), flex(lex), Visual Studio
2010(cl.exe)• msbuild to build libraries and BIPL files.
c-generic-librariesargtable
![Page 25: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/25.jpg)
Project ManageShih-Hao Tsai (Project Manager)
StructureTerry Tsai (Language Guru)
Compiler ArchitectureFan Wei (System Architect)
EnvironmentYi-Hong Lin (System Integrator)
Testing Chun-Chao Wang (Testing & validate)
![Page 26: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/26.jpg)
Test Plan
System Test
Frontend
Backend
![Page 27: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/27.jpg)
System Test
Frontend• Redefinition• Undeclared identifier• Scope of identifier• # of Function
parameter• Built-in functions• Dollar sign
Backend• Primitive types
Operator Type conversion
• Image type Operators Built-in functions
![Page 28: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/28.jpg)
Non-Technical Part
Performance
• Batch image processing test
Space
• Dynamic-link library
![Page 29: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/29.jpg)
DemonstrationTerry Tsai / Yi-Hong Lin
ConclusionShih-Hao Tsai
![Page 30: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/30.jpg)
DEMO
demo sample code 1
![Page 31: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/31.jpg)
DEMO
demo sample code 2
![Page 32: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/32.jpg)
DemonstrationTerry Tsai / Yi-Hong Lin
ConclusionShih-Hao Tsai
![Page 33: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/33.jpg)
Conclusion
• What we learned?
• What worked well?
• What’s done differently?
• Why people need to use BIPL?
![Page 34: B atch I mage P rocessing L anguage](https://reader036.vdocuments.us/reader036/viewer/2022062501/5681636f550346895dd44c72/html5/thumbnails/34.jpg)
~THANKS~