how to view pdf file in asp.net c# : How to extract pictures from pdf files SDK Library API wpf .net winforms sharepoint cips2ed23-part1020

Chapter 14
Warping and Morphing
14.1 Introduction
Thischapterextendsthediscussionofgeometricoperationsanddelvesinto
warping and morphing g (Hollywood, here we come). Image warping is a
techniquethatHollywooddiscoveredinthe1980’s. Theresultisthemagic
weseeeveryday incommercials,musicvideos,andmovies. Warping(and
itscousinmorphing)\melts"oldcarsintonewonesandcanturnacarinto
atiger.
14.2 Image Warping
Image warping is a a technique that bends and distorts objects in n images.
Rememberpressing a atpiece ofsilly putty onanewspaper tocopy the
imagetothesillyputty?Grabbingandpullingthesillyputtydistortedthe
appearanceoftheimage.Bendingandstretchingthesillyputtycausedthe
objectsintheimagetoassumeweirdandwonderfulshapes.Imagewarping
doesthesamefordigitizedimagesassillyputtydidforusaskids.
Usingacomputertowarpimagesisnotnew.Itbeganinthe1960’swith
earlyspaceprobes.Thepicturesofthemoonproducedbythe\cameras"on
theprobesweredistorted.Straightlinesappearedbentandtheobjectswere
outofproportion. ImageprocessorsattheJetPropulsionLaboratory[14.1]
transformedthesesquareimagesintotheshapeofpiepieces. Theresulting
piepieceimageshadstraightlineswherestraightlinesbelonged.
ThespecialeectsartistsinHollywooddiscoveredwarpinginthe1980’s.
209
How to extract pictures from pdf files - Select, copy, paste PDF images in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support PDF Image Extraction from a Page, a Region on a Page, and PDF Document
extract pdf images; extract image from pdf
How to extract pictures from pdf files - VB.NET PDF Image Extract Library: Select, copy, paste PDF images in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support PDF Image Extraction from a Page, a Region on a Page, and PDF Document
pdf image extractor c#; extract color image from pdf in c#
210
CHAPTER14. WARPINGANDMORPHING
Theydecidedtoapplythistechniquetoentertainment. Theresultiswhat
weseeeverydayincommercials,musicvideos,andmovies.
14.3 The Warping Technique
Thebasicideabehindwarpingistotransformaquadrilateraltoarectangle.
Aquadrilateralisafour-corneredregionboundedbystraightlines. Trans-
formingaquadrilateraltoarectanglewarpstheobjectsinsidethequadrilat-
eral.
Figure 14.1shows aquadrilateralwitha point Pinside [14.2]. Trans-
formingaquadrilateraltoarectanglerequiresndingthecoordinatesofany
pointPinsidethequadrilateral.Thisispossiblegiventhecoordinatesofthe
fourcornersP1,P2,P3,andP4andthefractionsaandbalongtheedges.
The key to ndingP is using bi-linear interpolation. In n the last chapter,
bi-linearinterpolationfoundthe gray levelof apixelbetween other pixels
(graylevelbi-linear interpolation). It t canalsondthelocation of apixel
betweenotherpixels(spatialbi-linearinterpolation).
NOTE:Thischapterworks withshapesthathavefour Parts(1,2,3,and
4). Part1willbeintheupperleft-handcorner,andparts2,3,and4will
proceedclockwise.
Equations(14.1)through(14.7)showhowtondthecoordinatesofpoint
P.(Ifmathematicalderivation is not for you,skip down tothe results in
equations (14.6) and (14.7). The e source code given later will l implement
theseequations).Theseequationsrunthroughbi-linearinterpolation.They
interpolatealongthetopandbottomofthequadrilateralandthenalongthe
sides.Intheequations,aandbarefractions(0<a<1;0<b1).
Equation(14.1)ndspointQbyinterpolatingbetweenpointsP1andP2
usinga. Equation(14.2)ndspoint t Rby interpolatingbetweenpointsP3
andP4usinga. Equation(14.3)ndspointPby y interpolatingbetweenQ
andRusingb. Equation(14.4)istheresultofsubstitutingthevaluesofQ
andRfromequations(14.1)and(14.2)intoequation(14.3).Equation(14.5)
gathersallthetermsfrom(14.4).
Q(a)=P
1
+(P
2
P
1
)a
(14.1)
R(a)=P
4
+(P
3
P
4
)a
(14.2)
VB.NET PDF Convert to Word SDK: Convert PDF to Word library in vb.
be converted to separate Word files within a short time in VB.NET class application. In addition, texts, pictures and font formatting of source PDF file are
extract image from pdf online; extract images from pdf online
VB.NET Image: VB.NET Codes to Load Images from File / Stream in .
When evaluating this VB.NET imaging library with pictures of your own powerful & profession imaging controls, PDF document, image to pdf files and components
extract jpg pdf; extract images from pdf files
14.3. THEWARPINGTECHNIQUE
211
Figure14.1:Bi-LinearInterpolationofaQuadrilateral
VB Imaging - VB Code 93 Generator Tutorial
VB developers to create Code 93 on popular image files, including BMP developers to create and write Code 93 linear barcode pictures on PDF documents, multi
extract images from pdf files without using copy and paste; extract vector image from pdf
C#: Use OCR SDK Library to Get Image and Document Text
a digital camera, scanned document or image-only PDF using C# color image recognition for scanned documents and pictures in C#. Steps to Extract Text from Image.
pdf image extractor; extract image from pdf acrobat
212
CHAPTER14. WARPINGANDMORPHING
P(a;b)=Q+(R Q)b
(14.3)
P(a;b)=P
1
+(P
2
P
1
)a+[(P
4
+(P
3
P
4
)a) (P
1
+(P
2
P
1
)a)]b (14.4)
P(a;b)=P
1
+(P
2
P
1
)a+(P
4
P
1
)b+(P
1
P
2
+P
3
P
4
)ab
(14.5)
Equations(14.6)and(14.7)arethenalanswers.Equation(14.6)shows
howtondthexcoordinateofanypointPgiventhex coordinatesofthe
fourcorners andthefractions aandb. Equation(14.7) ) does thesamefor
theycoordinate.Thesubroutinesdescribedbelowwillimplementequations
(14.6)and(14.7).Noticetheabtermintheequations.Thistermintroduces
non-linearitiesorcurvesintotheresults.
P(x)=x
1
+(x
2
x
1
)a+(x
4
x
1
)b+(x
1
x
2
+x
3
x
4
)ab
(14.6)
P(x)=y
1
+(y
2
y
1
)a+(y
4
y
1
)b+(y
1
y
2
+y
3
y
4
)ab
(14.7)
14.4 Two Ways to Warp
This chapter implements two kinds ofwarping. The e rst is controlpoint
warping illustrated in gure 14.2. Divide e a section ofan image into four
smallersquares1,2,3,and4.Pickacontrolpointanywhereinsidethesquare
section.Thiscontrolpointdividesthesquaresectionintofourquadrilaterals
as showninthe toppart of gure 14.2. Equations s (14.6) and(14.7) will
transformthesefourquadrilaterals backintothefoursquaresas shownin
thebottompartofgure14.2.Thiswillwarptheobjectsintheimage. The
controlpointwilldictatethewarping.
Listing14.1 shows thesourcecode that implementsthis type of warp-
ing. Thewarpsubroutinecontrolstheprocessandcallsthewarp
loopand
bi
warp
loopsubroutines.Theinputstowarpincludetheusualimagearrays
andlineandelementcoordinatesoftheimage. Specicto o warparethex
C# Imaging - Scan RM4SCC Barcode in C#.NET
& decode RM4SCC barcode from scanned documents and pictures in your Decode RM4SCC from documents (PDF, Word, Excel and PPT) and extract barcode value as
online pdf image extractor; extract jpeg from pdf
C# Imaging - C# Code 93 Generator Tutorial
to write and draw the best Code 93 barcode pictures in png, jpeg, gif, bmp, TIFF, PDF, Word, Excel Code93 barcode and save it to image files/object using
extract images from pdf; extract image from pdf java
14.4. TWOWAYSTOWARP
213
Figure14.2:TheControlPointWarpingProcess
C# Imaging - Scan ISBN Barcode in C#.NET
which can be used to track images, pictures and documents in Load an image or a document(PDF, TIFF, Word barcodes from png image files and extract ISBN barcode
extract image from pdf using; extract photo from pdf
Save, Print Images in Web Image Viewer| Online Tutorials
of single page printing and multi-page printing for pictures and documents; various file formats like PNG, JPEG, GIF, BMP, TIFF, PDF, MS Word Save Images & Files.
how to extract text from pdf image file; extract images from pdf c#
214
CHAPTER14. WARPINGANDMORPHING
andycontrolpointsandthebilinearparameter.Thecontrolpointscontrol
the warping, , and bilinear r species accuracy. If f bilinear == 0,warp calls
warp
loop,otherwiseitcallsbi
warp
loop.
warpworks onthefourquartersoftheinput image. Foreachquarter,
warpsets(x1,y1)through(x4,y4)tothecoordinatesofthecornersofthe
quadrilaterals1through4. warpthensetstheextra
xandextra
yvariables
totheupperlefthandcornerofthesmallsquares.Indoingthis,warpisset-
tingthefourcornersofthequadrilateral.Thisisnecessarytotransformthe
quadrilateraltoasquare. warpcallsawarpingroutinethatwillimplement
equations(14.6)and(14.7)andbendtheobjects. warpcallswarp
loopfor
quick warpingor bi
warp
looptousebi-linear interpolationfor slowerbut
betterwarping.
warp
loop(nextinlisting14.1)implements equations(14.6)and(14.7)
totransformthesmallquadrilateraltoasmallsquare. First,itsetsupthe
coecientsfortheequations. Thevariablesxa,xb,andxabcorrespondto
a,b,andabfromequation(14.6).Thevariablesya,yb,andyabcorrespond
toa,b,andabfromequation(14.7). Theloops s overiandjcalculatethe
coordinatesofthepixelsintheinputimagethatwillbecopiedtotheout-
putimage(x
outandy
out). Ifx
outory
outlieoutsidetheimagearray,
output
imageissettoaFILLvalue. Otherwise,output
imageissettothe
properpixelfromthe
image.
bi
warp
loopperformsthesameoperationsaswarp
loop. bi
warp
loop,
however, uses  oating point math and calls the bilinear
interpolate (last
chapter) subroutine toset the naloutput pixelvalue. bi
warp
loop pro-
ducesbetterresultsthanwarp
loop.Italsotakesmoretime.Usewarp
loop
forquickexperimentsandbi
warp
loopforpresentationresults.
Figure14.3showssomeresultsofcontrolpointwarping. Theupperleft
quarter is the input image. The e other three quarters show the e result of
pickingacontrolpointinsidetheinputimageandhavingthewarproutine
warpit. The e objects inthe results arebentoutof shape. Repeating g the
warpingcangiveanobjectalmostanydesiredshape(windowstheshapeof
circles,triangles,etc.).
AsecondformofwarpingiswhatIcallobjectwarping.Insteadofpick-
ing acontrolpointinside theimage array,the user picks the four corners
ofaquadrilateralas showningure14.4. Objectwarpingtransformsthis
quadrilateraltoasquare.Thefourcornersofthequadrilateralcanbealmost
anywhereinsideoroutsidethesquare. Theoutsidethesquareoptionis s a
capabilitythatcontrolpointwarpingdidnothave.
VB.NET Image: Mark Photo, Image & Document with Polygon Annotation
SDK, which can be used to create the most common 7 types of annotations on various image files. What's more, if coupled with .NET PDF document imaging add-on
pdf image text extractor; how to extract images from pdf file
VB.NET Image: Sharpen Images with DocImage SDK for .NET
VB.NET Coding. When you have made certain corrections in your VB.NET project photo or image files, you might want to sharpen your pictures before saving them
extract image from pdf in; extract images pdf acrobat
14.4. TWOWAYSTOWARP
215
Figure14.3:ExamplesofControlPointWarping
Figure14.4: TheObjectWarpingProcess
216
CHAPTER14. WARPINGANDMORPHING
Objectwarpingissimilartobutsimplerthancontrolpointwarping.Con-
trolpointwarpingtransformedfourquadrilateralstofoursquaresinsidean
imagearray.Objectwarpingtransformsonequadrilateraltoonesquare.
Listing14.1continueswiththesourcecodethatimplementsobjectwarp-
ing.Theobject
warpsubroutinecontrolstheprocessandcallsfull
warp
loop
and bi
full
warp
loop. The inputs to object
warp are the same as with
warpexceptitreceivesthefourcornersofthequadrilateral(x1,y1through
x4,y4)insteadofthecontrolpoints. object
warppreparesthecallseither
full
warp
loop(bilinear==0)orbi
full
warp
loop(bilinear==1).
full
warp
loopperformsthesamefunctionthatwarp
loopperformedfor
controlpointwarping,i.e.,it transforms a quadrilateralto asquare. The
dierenceisthattheloopsoveriandjinfull
warp
loopgothroughanentire
imagearray.warp
looponlywentthroughonequarteroftheimagearray.
bi
full
warp
loopperformsthesameoperationsasfull
warp
loopexcept
ituses oatingpoint mathandcallsbilinear
interpolateforthenalpixel
values.bi
full
warp
loopisslower,butitproducesbetterresults.Again,use
full
warp
loopforexperimentsandbi
full
warp
loopforpresentationresults.
Figure14.5showssomeresultsofobjectwarping.Theupperleftquarter
showstheinputimagewiththethreeotherquartersshowingresults.These
resultsaresimilartothoseinFigure14.3. Notice,however,thateachresult
inFigure14.5containsFILLvaluesshiftedinfromoutsidetheinput.
Figures14.6 and14.7showtheresult ofapplyingwarpingtocomplete
imagesandillustrateswhatwarpingcando.Theseimagesshowtheoutcome
ofusingcontrolpointwarpingseveraltimes.
WhilelookingatFigures14.6and14.7,turnonyourimagination. The
houseappearstobeinthemiddleofanearthquake.Wecouldmakeaseries
ofhouseimageswiththewarpingmovedfromrighttoleftalittlebitineach
image. If f you put one house imageineach frame of motionpicture lm,
thesequencewouldlooklikeahouse ripplinginanearthquake. Wecould
makethehouselooklikeJell-O.Whatweneedisacomputerfastenoughto
generate10,000imagesandamotionpicturecamera.Thisishowtheydoit
inHollywood.
14.5 Shearing Images
Oneapplicationofwarpingistoshearimages.Arelatedarticle[14.3]showed
howtoshearimages.Objectwarpingandbi-linearinterpolationcandothe
14.5. SHEARINGIMAGES
217
Figure14.5: ExamplesofObjectWarping
Figure14.6: WarpedHouseImage
218
CHAPTER14. WARPINGANDMORPHING
Figure14.7:AnotherWarpedHouseImage
same operation n without producing g jagged lines. Image e 14.2 showed d how
objectwarpingcanwarpanimageandpullinFILLvaluesfromoutsidethe
image. Thisisbecauseobjectwarpingpermitspickingquadrilateralcorner
pointsoutsidetheimagearrayasshowningure14.4.
Figure14.8depictsimageshearingasproducedbyobjectwarping.These
fourimageshearsaretheresultofcallingthewarpprogram(describedlater)
thatinturncallstheobject
warproutine. Thenumericalparametersthat
areoutsidetheinputimage(i.e.,lessthan0orgreaterthantheimagesize)
causetheimagetoshearorshiftover.
14.6 Morphing
Morphingisthetermmostpeopleusetodaytodescribethemeltingofone
objecttoanother. MichaelJackson\morphed"toapanther. Acar r \mor-
phed"toatiger.TheMightyMorphin’PowerRangers|wellthat’sanother
story.
(Funny, as s I I sit here revising this s in late 1998, , many y people may not
rememberMichaelJacksonandtheMightyMorphin’PowerRangers. Mor-
phinghasbecomesocommonthatpeoplethinkitwasalwaysthere.)
Morphingisasequenceofimages|notasingleimage. Acarbecomes
a tiger by showing asequenceof intermediate images. The e transition ap-
pearsmagicalwhentherearedozensofimagesshowneverysecondinalm
sequence.
Morphingcanbedoneasanextensiontowarping. Supposewewanted
to morph adark circleto abright pentagon. The e rststepis toproduce
Documents you may be interested
Documents you may be interested