版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
AttributesofGeometricPrimitives
幾何圖元的屬性ComputerGraphics2Outline(Hearn&Baker,P141:Chapter4)1.Fill-Area★
(4.10,4.13P159-162.P163-167)2.Antialiasing
★(4.17P175-182)1.AreaFillAlgorithms
(區(qū)域填充算法)(
Hearn&Baker,
Section4-10/13,P159-162.P163-167)4AreaFillFillorcolorizeaboundedareausingacolororpatternExamples:barchart,surfaces,solidobjects,etc.5DescriptionofAreaThedescriptionoftheareatobefilledisgivengeometrically:1.byedges,lines,polygons,circles,etc.
(邊界定義區(qū)域,boundary-defined)2.byasetofpixelsdefiningaboundary(內(nèi)部定義區(qū)域,interior-defined)6CommentsonFillingAlgorithmsTechniquesforrasteringapolygonoranarea:3.Scan-lineSeedFillMethod
(掃描線種子填充算法)2.Seedfillmethod(種子填充算法)1.Scan-linemethod
(掃描線填充算法)…自學(xué)Scan-linefillingmethods
(掃描線填充算法)8Scan-linemethods
(掃描線填充算法)WorksrowbyrowfromtoptobottomApixelinsidethecurrentscanlineisonlydrawnifitislocatedinsidethepolygon.逐點(diǎn)判斷法
判斷點(diǎn)在多邊形的內(nèi)外關(guān)系:射線法9如何區(qū)分點(diǎn)在多邊形的內(nèi)部與外部?射線法比較常用從一點(diǎn)p引射線,如果與多邊形邊界交點(diǎn)數(shù)為偶數(shù),則p在多邊形外,否則在多邊形內(nèi)部如果交點(diǎn)為頂點(diǎn),需要特別處理通常射線就是掃描線10Scan-linemethodsWorksforgeometricallyaswellaspixel-wisedefinedareasGreedyapproachveryslow!!!?Improvementspossiblebyexploitingcoherence!(連貫性):11Scan-linemethodsTheapproachisbasedonscan-linecoherence(連貫性):Neighboringpixelsareverylikelytogetthesameintensity/colorvaluesassigned.Thepixelcharacteristics,i.e.color/intensityvalues,onlychangewhereanedgeofthepolygonintersectsthescanline,i.e.thepartofthescan-linebetweentwointersectionpointsiseithercompletelyinsideorcompletelyoutsideofthepolygon.(掃描線的連貫性)12Scan-linemethods:ExampleExample:
Scanliney=2:
-intersectionwithpolygonatx=1,8-wecansubdividethescanlineinto3sections:x<1:outsidethepolygon1≤x≤8:insidethepolygonx>8:outsidethepolygon13Scan-linemethods:ExampleExample:
Scanliney=4:
-intersectionwithpolygon
atx=1,4,6,8-wecansubdividethescanlineinto5sections:x<1:outsidethepolygon1≤x≤4:insidethepolygon4<x<6:outsidethepolygon6≤x≤8:insidethepolygonx>8:outsidethepolygon14Scan-linemethodsSingularitiesareProblematic:i.e.locationswherethescanlineintersectswithavertexofthepolygon.?considerlocalextremes15LocalextremesofPolygonDefinitionofLocalextremes:thosey-valuesofthecornerofthepolygonwherethesevaluesaregreaterorsmallerthanbothvertices(withrespecttothey-value)attheoppositesideoftheedge.Distinguishtwocases:-Ifthevertexisalocalextreme,
theintersectioncountstwice-Ifthevertexisnotlocalextreme,
theintersectioncountsonceonly16Scan-linemethodsThesimpleorderededgelistalgorithm
(有序邊表算法)
Method:preprocessing+scanconversion17OrderedEdgeListAlgorithmPreprocessing(1)Determineforeveryedgeofthepolygontheintersectionswiththescanlinesatthepixelcenters;ignorehorizontaledges.(2)Storeeveryintersection(x,y)inalist.(3)Sortlistfromtoptobottom,lefttoright.18OrderedEdgeListAlgorithmScanconversion(1)Considerpairsofsubsequentintersections(x1,y1)and(x2,y2)inthelist,i.e.listelement1and2,listelement3and4,…)(2)Duetothepreprocessingstep,weknowthatforeveryscanliney:y=y1=y2,x1≤x2(3)Drawallpixelsalongthescanlineyforwhich:x1≤x<x2
foreveryintegernumberx.19Example:Preprocessing20Example:ScanConversionSeedfillmethods
(種子填充算法)22Seedfillmethods(種子填充算法)Seedfillmethodsfillthearea
boundedbythepolygon
startingfromaninitialpixel
(seed)andaresuitablefor
pixel-wisedefinedareas,
hencealsoforrasterdisplays.seedpoint23ConnectednessofAreas4-connected:
connectedhorizontallyorvertically(四連通)8-connected:additionallydiagonallyconnected(八連通)(區(qū)域的連通性)24ConnectednessDifferencebetween4-and8-connect
連通性:4連通可看作8連通區(qū)域,但對(duì)邊界有要求不同依據(jù)區(qū)域內(nèi)點(diǎn)能否訪問到區(qū)域外的點(diǎn),對(duì)邊界的要求是:4連通區(qū)域,邊界只要8連通即可8連通區(qū)域,邊界必須是4連通例:如右圖(1)4連通區(qū)域,邊界為○像素(2)8連通區(qū)域,邊界為○和△像素25Examplesfor4-and8-connected264directionsofmovementaredefinedbyboundaryFILO/LIFONote:
somepixelsmaybestoredinthestack
(andalsocolored)multipletimes.SimpleSeedFillAlgorithm27voidFloodFill4(intx,inty,intnew,intold){
intcolor;getPixel(x,y,color);if(color=old)
{setPixel(x,y);FloodFill4(x+1,y,new,old);//rightFloodFill4(x,y+1,new,old);//up
FloodFill4(x–1,y,new,old);//leftFloodFill4(x,y–1,new,old);//down}}SimpleFlood-FillAlgorithm28Seedfillmethods:Example-1
(numbersindicatelocationofpixelswithinthestack)29Seedfillmethods:Example-1
(numbersindicatelocationofpixelswithinthestack)travel:→R→U→L→Dstack:FILOsomepixelsmaybestoredinthestack(andalsocolored)multipletimes.30Seedfillmethods:Example-2areawithhole5.Antialiasing(反走樣)(Hearn&Baker,Section4-17,P175-182)32AliasingandAntialiasingwhatisaliasing?whatisthereasonforaliasing?whatcanwedoagainstit?33AliasingGenerally,aliasingeffects
areerroneousreconstructionofa(continuous)signalduesamplingratewithatoolowfrequency(seealsoNyquisttheorem).用離散量(像素)表示連續(xù)的量(圖形)而引起的失真,稱為走樣或稱為混淆。34Reasonsforaliasingerrorsthatarecausedbythediscretization
ofanalogdatatodigitaldatatoobadresolutiontoofewcolorstoofewimages/secgeometricerrorsnumericerrors35AliasingThetermaliasing
intheareaofcomputergraphicsisused,besidesvisualeffectsresultingfromtheabove(e.g.aliasingwhenrenderingacheckerboard),todescribevisualartifacts
resultingfromtheprocessofscanconversion.
(e.g.staircasingwhendrawingdiagonallines).36AliasingAliasingartifactsincomputergraphicsTextureartifacts(e.g.checkerboard)Staircasingartifactswhenrasteringcurves?jaggedlinesDisappearanceofobjectswhicharesmallerthanapixelDisappearanceofsmall,skinnyobjectsLossofdetailincompleximages“Flipping”smallobjectsduringmotion/animation37AliasingStaircasingartifacts,jaggededgesThepreviouslydiscussedtechniquesforrasteringstraightlinesandcurvesresultinstaircasingartifacts(left)sinceitisonlypossibletodrawpointsatfixedrasterlocations.Theselocationsaregenerallynotidenticaltothereal/ideallocationsofthesepoints.階梯狀的、鋸齒狀的38VariousAliasingEffects39AliasingfromtoofewColorsartificialcolorborderscanappear40AliasinginAnimationsjumpingimages"worming"41AntialiasingAntialiasing(反走樣)
methodsaretechniques(e.g.over-sampling,filtering)thattrytominimizethealiasingeffect.EliminatingthealiasingeffectisoftenNOTpossible
(alreadyfromatheoreticalpointofview).42ShannonSamplingTheorem43ShannonSamplingTheorem44Antialiasing:NyquistSamplingFrequency45SolutionsagainstAliasing?1.improvethedeviceshigherresolutionmorecolorlevelsfasterimagesequence2.improvetheimages=antialiasingpost-processingpre-filteringsoftwareexpensive46AntialiasingStrategiessupersamplingstraight-linesegmentsareasamplingstraight-linesegmentsfilteringtechniquescompensatingforline-intensitydifferencesantialiasingareaboundaries(adjustingboundarypixelpositions)adjustingboundarypixelintensity47Antialiasing:SupersamplingLinesSupersampling(超級(jí)采樣)48Antialiasing:SupersamplingLines49Antialiasing:AreaSamplingLinescalculatethepixelcoverageexactlycanbedonewithincrementalschemesunweighted
area
sampling(非加權(quán)區(qū)域采樣)
weightedareasampling(加權(quán)區(qū)域采樣)50Unweighted
Area
SamplingSettingintensityproportionaltotheamountofareacovered.theintensitiesofneighboringpixelschangecontinuously51Unweighted
Area
Sampling兩點(diǎn)認(rèn)識(shí):(1)像素不是點(diǎn),一個(gè)小區(qū)域,形狀由硬件決定(如正方形);(2)直線有寬度。掃描轉(zhuǎn)換時(shí)兩點(diǎn)假設(shè):(1)象素是數(shù)學(xué)上抽象的點(diǎn),它的面積為0,它的亮度由覆蓋該點(diǎn)的圖形的亮度所決定;(2)直線段是數(shù)學(xué)上抽象直線段,它的寬度為0。反走樣方法:
把像素看作一個(gè)平面區(qū)域進(jìn)行采樣(1)將直線段看作具有一定寬度的狹長(zhǎng)矩形;(2)當(dāng)直線段與像素有交時(shí),求出兩者相交區(qū)域的面積;(3)根據(jù)相交區(qū)域的面積,確定該象素的亮度值。相鄰兩個(gè)象素的灰度之間有一個(gè)平緩的過渡,淡化了鋸齒狀的邊界。52WeightedAreaSampling權(quán)函數(shù):
或經(jīng)驗(yàn)值,可自定義;直線與像素相交,相交區(qū)域?yàn)锳’,則直線對(duì)象素的亮度的貢獻(xiàn)為:W(X,Y)=1:非加權(quán)情形。53WeightedAreaSampling加權(quán)區(qū)域采樣算法(直線段情形):求直線段與像素的相交區(qū)域A’;計(jì)算的值;用上面的值乘以像素的最大灰度值,即為像素的顯示灰度值。54WeightedAreaSampling加權(quán)區(qū)域采樣的離散算法:分割像素成n個(gè)子像素{Ai},面積為1/n,每個(gè)子像素對(duì)原像素的亮度的貢獻(xiàn)為將各權(quán)值保存在一張加權(quán)表中。求所有子像素中心落在直線段內(nèi)的子像素集;計(jì)算這些子像素對(duì)原像素亮度的和例:加權(quán)表的取法55Antialiasing:FilteringTechniquescontinuousoverlappingweightingfunctionstocalculatetheantialia
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024上海市高壓供用電合同
- 2024安徽省集體合同條例
- 2024個(gè)人之間借款合同參考范本
- 2024【挖機(jī)轉(zhuǎn)讓協(xié)議合同范本】出租車轉(zhuǎn)讓協(xié)議合同范本
- 2024小區(qū)門衛(wèi)勞動(dòng)合同范本
- 深圳大學(xué)《游戲發(fā)行的商業(yè)實(shí)戰(zhàn)》2021-2022學(xué)年第一學(xué)期期末試卷
- 寫字樓物業(yè)停電應(yīng)急預(yù)案(9篇)
- 關(guān)于新學(xué)期學(xué)習(xí)計(jì)劃范文集合七篇
- 眼鏡店開荒保潔施工合同
- 體育學(xué)校租賃協(xié)議
- 上海交通大學(xué)學(xué)生生存手冊(cè)
- 群落的結(jié)構(gòu) 高二上學(xué)期生物人教版選擇性必修2
- 七巧板拼圖圖案打印
- 古文二則菊和蓮
- RB/T 126-2022養(yǎng)殖企業(yè)溫室氣體排放核查技術(shù)規(guī)范
- 小班科學(xué)《肚子里面長(zhǎng)啥樣》課件
- 道路綠化施工圖設(shè)計(jì)說明
- 實(shí)驗(yàn) 苯甲酸乙酯的制備
- 北師大版七年級(jí)上冊(cè)英語(全冊(cè)知識(shí)點(diǎn)語法考點(diǎn)梳理、重點(diǎn)題型分類鞏固練習(xí))(家教、補(bǔ)習(xí)、復(fù)習(xí)用)
- 經(jīng)濟(jì)周期與產(chǎn)業(yè)周期演進(jìn)的關(guān)系(成長(zhǎng)篇)
- 中小學(xué)體育教師晉升高級(jí)職稱考試題匯編(附答案)
評(píng)論
0/150
提交評(píng)論