home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / graphics / aim_xtra / aimtutor.doc < prev    next >
Text File  |  1988-04-07  |  46KB  |  957 lines

  1. 06600020202800
  2. 1AIM TUTORIALPage # ofFile: AIMTUTOR.DOC
  3. 2
  4. F0110030
  5. 9[...................................................]011
  6. ü
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. ëAIMTUTORIAL
  18. 9[...................................................]011
  19. Ç
  20.  
  21. by
  22.  
  23.  
  24. TomHoeksmaandAdHerweijer
  25.  
  26.  
  27.  
  28. DelftUniversityofTechnology
  29. FacultyofAppliedPhysics
  30. PatternRecognitionGroup
  31. Lorentzweg1
  32. 2628CJDELFT
  33. theNetherlands
  34. ëIntroductionê
  35. Ç
  36. TheimageprocessingsoftwarepackageAIM(AtariImageManager)
  37. hasbeendevelopedatDelftUniversityofTechnologybyFrans
  38. Groen(the'imageprocessor')andwasadaptedfortheAtariST
  39. computerincooperationwithRobertdeVries(theGEMprogram⑨
  40. mer).BothweremembersoftheSignal-/System-techniquesGroupin
  41. theFacultyofAppliedPhysics,Fransasaseniorstaffmember
  42. andRobertasagraduatestudent.Recently,Franschangedjobsto
  43. becomeprofessorofAppliedInformaticsintheUniversityof
  44. Amsterdam.
  45.  
  46. AIMisdesignedtobeanentrylevel'appetizer'fortheartof
  47. imageprocessing.Itgivestheinterestedlaypersonan
  48. opportunitytoacquainthimselfwiththetechniquesand
  49. terminologyusedinthisdynamicfield.Theexperiments
  50. describedmayberegardedasalowerboundofwhatcanbe
  51. accomplishedwithAIM,theupperboundbeinglimitedbythe
  52. user'simaginationonly.
  53.  
  54. Thistutorialisnotafullcourseondigitalimageprocessing.
  55. SuchcoursesarefrequentlyorganizedbythePatternRecognition
  56. Group.Forcourseinformation,pleasecontacttheSecretaryof
  57. thePatternRecognitionGroup,FacultyofAppliedPhysics,
  58. Lorentzweg1,2628CJDelft,theNetherlands,Phone015-781416.
  59.  
  60. Notethattheoperationsusedintheexamplesanddemoscovera
  61. minorpartofAIM'scapabilitiesonly.Acomprehensivedescrip⑨
  62. tionofalltheoperationsavailableisgiveninafilecalled
  63. AIMANUAL.DOC.Likethistutorialitiscontainedinacompressed
  64. file(DOCS_IMS.ARC),whichcanbefoundinthefolderCOMPRESSon
  65. thedistributiondisk(togetherwithadecompressingprogram).
  66.  
  67. Imageprocessingisnotparticularlydifficult;manypeoplewill
  68. havehadtheirfirstimageprocessingexperienceinthe
  69. photographicdarkroom.Note,however,thatAIM,beingdedicated
  70. todigitalimageprocessing,requiressomebasicknowledgeof
  71. digitalsystems.Sothoseofyouwhountilnowhavesuccessfully
  72. avoidedlearningaboutbits,bytesandbinarynumbers,be
  73. preparedtofacetheunavoidable!The15minutesorsospenton
  74. readingabouttheseconceptswillberichlyrewardedbyabetter
  75. understandingofAIM'soperations,ifnotbythedeepadmiration
  76. ofyourenvironmentforthenewlyacquiredvocabulary.
  77.  
  78. AIMisaresultofmanyyearsofresearchanddevelopmentinthe
  79. PatternRecognitionGroup.Manyoftheimageprocessingroutines
  80. werecontributedby(a.o.)GertvanAntwerpen,FransGroen,Piet
  81. Verbeek,BenVerwer,LucasvanVlietandIgorWeber.This
  82. introductionwaswritten(ifnotcompiledfromexistingtexts)by
  83. TomHoeksmaandAdHerweijer.
  84.  
  85. PreviousversionsofAIMhavealreadyextensivelypenetratedthe
  86. AtariSTcommunity.However,asthedocumentationsuppliedwith
  87. thosefirstpublicdomainversionswasratherlimited,the
  88. explorationofthesoftwarehasbeenamere'imageprocessing
  89. adventure'tomostofthe'earlybirds'.Theauthorshopethat
  90. thisintroduction,togetherwiththerelatedexamplesanddemos
  91. includedonthedisk,willenableallprospectiveusers(early
  92. birdsandnewcomersalike)tobetterunderstandwhatwas,resp.
  93. isgoingon.
  94. Ç
  95. Feedbackplaysanimportantroleintheeffectiveuseofimage
  96. processingaswellasinsoftwaredevelopment.Therefore,we
  97. inviteyoutosendyoureventualcommentsandsuggestionsto:
  98.  
  99. Prof.dr.ir.F.C.A.Groen
  100. c/oDelftUniversityofTechnology
  101. FacultyofAppliedPhysics
  102. PatternRecognitionGroup
  103. Lorentzweg1,2628CJDELFT
  104. theNetherlands
  105.  
  106. ë
  107.  
  108. ëWHATCANWEEXPECTOFIMAGEPROCESSING?Ç
  109. 9[...................................................]011
  110.  
  111. MaybeyouhavealreadyhadsomeexperiencewithAIMorseen
  112. somebodyelseworkwithit.Youmayhavewondered,then,how
  113. imageprocessingcouldmakefeaturesappearinthedisplaythat
  114. weren'ttherebeforetheoperation.Textthatatfirstwas
  115. unreadable,suddenlycouldbereadeasily;frecklesinagirl's
  116. face,thatdidn'tshowintheoriginaldisplay,could(toher
  117. distress!)becountedaftersomeappropriatekeystrokes.Youwere
  118. perhapsconvincedtohaveacquiredalittlemagician,hiddenin
  119. thattinyfloppydisk.
  120.  
  121. Bewarned,however!Imageprocessingcanneverreproducefeatures
  122. oftheoriginalimage,thatsomehowhavebeenlost.So,be
  123. preparedforsurprises,butdon'texpectmiracles!Image
  124. processingcanenhanceparticulardetailsinanimage,but
  125. usuallyotherdetailswillhavetobesacrificed.
  126.  
  127. If'Apictureisworthathousandwords',imageprocessingallows
  128. youtoarrangethosewordstomakethepicturerevealits
  129. (secret)'stories'.Butremember:onepicture'sthousandwords
  130. aredifferentfromanother's.Everystorywillinheritthe
  131. characteristicsofthepictureitwasextractedfrom.Theartof
  132. imageprocessingis:tomakethepicturetelltheonestory
  133. that'susefultoyou.
  134.  
  135.  
  136. ë
  137. STAGESINANIMAGEPROCESSINGAPPLICATIONÇ
  138.  
  139. Inalmosteveryimageprocessingapplicationwecanrecognize
  140. somestages,thateventuallyleadtothefinalresult:ürecordingÇ,
  141. üpreprocessingÇ,üsegmentationÇ,üpostprocessingÇ,üanalysisÇandüinter⑨Ç
  142. üpretationÇ.
  143.  
  144. Probablythemostimportantstageistherecordingofthe
  145. originalpicture.Asstatedabove,informationthatgetslostin
  146. therecordingprocesscanneverberecovered.Fortherecordinga
  147. video-cameraisrequired,capableofconvertingthelight,
  148. reflectedfromtheobject,intoanelectricalsignal.Asthe
  149. videosignalcannotbereaddirectlybythecomputer,thissignal
  150. mustbesampledanddigitizedandthedigitalinformationmustbe
  151. transferredinanorderlymannertothecomputer'smemory.This
  152. isdonebyaspecialpieceofhardware,aso-called'üframe
  153. grabberÇ'.VariousframegrabbersareavailablefortheAtariST.
  154. InthePatternRecognitionGroupmonochromeandcolorframe
  155. grabbershavebeendevelopedthateventuallywillbemade
  156. commerciallyavailable.
  157.  
  158. Aftertheimageisstoredinthecomputeritmustbepre⑨
  159. processed.Heretheusertriestoenhanceorfilterout
  160. particularwantedresp.unwantedfeatures,tosatisfy
  161. requirementsoffurtheranalysis.Examplesofpreprocessingare
  162. thecorrectionforchanginggreyvaluesinthebackground
  163. (shading),suppressingnoise,determinationofedgesinthe
  164. image,etc.
  165.  
  166. ÇInordertobeabletodeterminepropertiesofsingleobjectsin
  167. theimage,theseobjectsmustfirstbemadedetectable.Ifagrey
  168. valueimagecontainsdarkobjectsonalightbackground,
  169. segmentationcan,forinstance,resultinabinaryimagewith
  170. whiteobjectsinablackbackground.
  171.  
  172. Postprocessingcanimprovetheresultofthesegmentation.
  173. Examplesarethemorfological(binary)operations.Holesin
  174. objectscanbeclosed,edgespeeledoff,etc.
  175.  
  176. Intheanalysisstage,measurementscanbeperformedonthe
  177. segmentedobjects.Examples:area,perimeter,curvature.
  178.  
  179. Intheinterpretationstagetheresultsofthemeasurementsare
  180. evaluated.
  181.  
  182. An'intelligentrobot'inafactory,thathastomakeadecision
  183. onwhetherhe'sees'anutorabolt,mustbeprogrammedtogo
  184. throughallstagesmentionedhere.Programmingsucharobot
  185. requiresmuchintuitiononhowcomputers'think'.Animportant
  186. requirementfortheprogrammeristobeabletoforgetthewayhe
  187. woulddothejobhimself!Hemustbelongtothenewbreedof
  188. 'computerpsychologists'.ü
  189.  
  190.  
  191. ë
  192. SOMETERMINOLOGYUSEDINIMAGEPROCESSING
  193. 9[...................................................]011
  194. Ç
  195.  
  196. Imagesanddisplaysê
  197.  
  198. ÇInimageprocessingwemustdistinguishbetween'images'and
  199. their'displays'.InthiscontextwedefineanüimageÇasthe
  200. informationthathasbeenstored(as1'sand0's)witha
  201. particularfilenameinthecomputer'smemoryoronamagnetic
  202. disk.AüdisplayÇistherepresentationofsuchanimageonavideo
  203. screenor-asa'hardcopy'-onapieceofpaper.
  204.  
  205. AnimportantpropertyofanimageisitsüinformationÇcontent.The
  206. informationinanimagedependsonthepresenceofdetails
  207. (lines,edges,intensities,colors,etc.).Moreover,the
  208. informationcontentdeterminestheamountofcomputermemory
  209. requiredtostoretheimage.
  210.  
  211. Notethatit'sonethingtostoreanimageaccurately,butthat
  212. it'sanothertodisplayitwithfullconservationofinformation!
  213. Thedisplayhardware(videocontroller,monitor,printer,etc.)
  214. determinesthedegreetowhichtheinformationinanimagecanbe
  215. observedexactly.Inimageprocessing,thereisatendencyto
  216. maketheinformationcontentofstoredimageshigherthancan
  217. actuallybedisplayed.Thisreducesthechancethattheeffects
  218. ofroundingerrorsinintermediateresultswilldeterioratethe
  219. finaldisplay.(Moreover,RAM-chipsandfloppydisksaremuch
  220. cheaperthandisplayhardware!).AIM,forexample,uses64
  221. kilobytes(kB)ofRAMforthestorageofimages,whereasthe
  222. Atarihardwarecanonlyhandle32kBforthedisplayofone
  223. screen(eithermonochromeorcolor).
  224.  
  225. ÇThebasicelementofanimageisaüpixelÇ(pictureelement).Tobe
  226. observableonadisplay,apixelmustbeattributedaügreyvalue
  227. ÇorücolorÇinformation.
  228. Asanexample,considertheAtariST.Inthemonochrome(high
  229. resolution)modetheAtariSTsupportsthedisplayof2grey
  230. valuesonly.Eachpixel(theAtariscreenhas640*400=256,000
  231. ofthem!)hasanumber('0'or'1')associatedwithitthat
  232. determineswhetheritistobeblackorwhite:thereisnothing
  233. inbetween.Wewillcallthisa'übinarydisplayÇ'.
  234.  
  235. Notethattermslike'black','white'and'greyvalue'inthe
  236. contextofmonochromedisplaysactuallyrefertothecolor
  237. emittedbythephosphorusedintheCathodeRayTube(üCRTÇ)ofthe
  238. displaydevice(amber,green,white,etc.).
  239.  
  240. Colorimagesgenerallyconsistofthreeüsub-imagesÇ,displayed
  241. simultaneously.Thesub-imagesrepresentthedecompositionofthe
  242. colorimageintothreemonochromeimages(red,greenandblue,
  243. respectively).The(visual)additionofthesub-imagesrestores
  244. theoriginalcolorsfortheobserver.Sub-imagesmaybebinary,
  245. butusuallytheyhavemorethantwogreyvalues.AnAIMcolor
  246. image,forexample,has256possiblegreyvaluesforeachsub-
  247. image.
  248.  
  249. Inthecolormodes(medium-,resp.low-resolution),theSTis
  250. capableofdisplaying8greyvaluesforallthreeprimarycolors.
  251. Consequently,thereare8*8*8=512differentcombinations,each
  252. combinationrepresentinganothercolor.Suchagroupofavailable
  253. colorsiscalledaüpaletteÇ.Thepaletterepresentsallpossible
  254. statesthatanindividualpixelmayhave.
  255.  
  256. Eachcombinationofred,greenandblueintensitiesisperceived
  257. withaparticularbrightness,theüluminanceÇ.Luminance
  258. informationcanbeusedforthedisplayofcolorimagesona
  259. monochromemonitor;AIMallocatesanextrasub-imageforit.
  260.  
  261. Ifapixelhasequalintensitiesforred,greenandblue,it
  262. willdisplaythecolor'grey'.Thus,inthepaletteofthemed-
  263. resandlo-rescolormodesthereare8levelsofgrey,extending
  264. fromblack(R=G=B=min=0)towhite(R=G=B=max=7).Veryoftenthe
  265. propertyofacolormonitortodisplaygreyvalues(asopposedto
  266. justblackorwhite)ismoreimportanttotheuserthanits
  267. capabilityofdisplayingcolors!
  268.  
  269. Aswehaveseenabove,inbinaryimageseachpixelcanhave2
  270. greyvaluesonly.Wesaythateachpixelhas1'übitÇ'(binary
  271. digit)ofinformationassociatedwithit.Equivalently,incolor
  272. imagestheinformationperpixelishigher;AIMuses32bitsof
  273. colorandgreyvalueinformation.Wewillreturntothisshortly.
  274.  
  275.  
  276. Pixelsandneighbors.ê
  277.  
  278. ÇAnAIMimagecanbevisualizedasa'checkerboard'with256*256
  279. or128*128squarefields(formonochromeandcolorimages,
  280. respectively).Eachfieldcorrespondstoapixelcarrying8bits
  281. (=1üByteÇ)ofgreyvalueinformationor32bits(= 3+1Bytes)of
  282. colorandluminanceinformation.
  283.  
  284. ÇPixels,beingneatlyarrangedinasquareürasterÇofrowsand
  285. columns,haveüneighborsÇ.Thenumberofneighborsofaparticular
  286. pixelisreferredtoasitsüconnectivityÇ.Onacheckerboard
  287. neighborscanbedefinedashavingeitherjustsides,orsidesas
  288. wellascorners,incommonwiththereferencepixel.Dependingon
  289. thesedefinitionstheconnectivityofpixelsonasquareraster
  290. is4or8.Pixelssometimesarearrangedhexagonally.Insucha
  291. 'honeycombconfiguration'theconnectivityis6.
  292.  
  293. Imageprocessingroutinescanbedividedintothreegroups:
  294. üpointÇ,ülocalÇandüglobaloperationsÇ.
  295.  
  296. Pointoperationsusetheinformationofonesinglepixelinthe
  297. inputimagetocalculatetheresultforacorrespondingpixel
  298. (notnecessarilythesame)intheoutputimage.Anexampleisthe
  299. INVERToperation,wheretheintensitybitforeverypixelinthe
  300. (binary)imageisreversed.
  301.  
  302. Inalocaloperationtheresultforonesinglepixelofthe
  303. outputimageisdeterminedbytheoriginalpixelandits
  304. üneighborhoodÇ.AnexampleofsuchanoperationisLmin('Local
  305. minimum'),wheretheoutputpixelgetstheminimumgreyvalueof
  306. itsneighborhood(includingitself)intheinputimage.This
  307. operationextendsdarkpartsintheimage.Theneighborhoodof
  308. interestcanoftenbespecified(i.e.1*3,3*3,5*5,etc.).In
  309. AIMtheneighborhoodcanonlybeanoddnumber.
  310.  
  311. Inglobaloperationstheresultforonesingleoutputpixelis
  312. derivedfromtheinformationofallpixelsintheinputimage.
  313. OneexampleofaglobaloperationistheFouriertransform,used
  314. todetermineperiodicfeaturesintheimage.Fouriertransforms
  315. arenotsupportedinthisversionofAIM.
  316.  
  317. ëPROPERTIESOFTHEATARISTVIDEOHARDWARE
  318.  
  319. ÇAlmostallofAIM'simageswillprobablyhavetobedisplayedon
  320. avideomonitor(eithermonochromeorcolor).Howeverperfectan
  321. imagemaybe,itwilleventuallyhavetopassthebottleneckof
  322. thecomputer'svideodisplayhardware.Muchoftheeffortof
  323. programmingAIMhasbeendevotedtoovercominginevitable
  324. limitationsofacomputer'sdisplayhardware.Foracorrect
  325. interpretationoftheresults,wewillextendbrieflyintosome
  326. detailsofthehardwareusedbytheAtariSTforthecontrolof
  327. displays:üvideodisplaymemoryÇ,üvideocontrollerÇandümonitorsÇ.
  328.  
  329.  
  330. Thevideodisplaymemory.
  331.  
  332. Thecentralpartofthedisplayhardwareisthevideodisplay
  333. memory.Independentoftheresolutionchosen(lo-,med-,hi-res),
  334. theAtariSTallocates32kB(=256,000bits)ofRAMforstorage
  335. oftheinformationofonescreen.
  336.  
  337. Inthehighresolutionmode640*400=256,000pixelscanbe
  338. displayed,leavingjustonebit/pixelforgreyvaluedefinition.
  339. Asaresultonlybinaryimagescanbedisplayedonamonochrome
  340. monitor.
  341.  
  342. ÇAsexplainedabove,acolorimagerequiresmorethan1bitof
  343. memoryperpixel.YoumaywonderhowtheSTmanagestoattribute
  344. morethan1bittoapixelifinthehi-resmode(1bit/pixel)
  345. alltheavailable32kBisusedupalready!
  346.  
  347. Theanswertothisquestioncanbeintuitivelyfoundfromthe
  348. terms'medium-resolution'and'low-resolution'forthecolor
  349. modes.Inthesemodes,thespatialresolutionofthehi-resmode,
  350. 640*400=256,000pixels,issacrificedinordertogivethe
  351. pixelsmoreluminance(monochromedisplaysoncolormonitors)or
  352. colorinformation.Byreducingtheresolutionto640*200=
  353. 128,000(med-res)or320*200=64,000pixels(lo-res),thepixels
  354. canbeattributed2or4bitsforluminanceorcolordefinition.
  355. Thisallowspalettesof4or16colorstobedefinedinthemed-
  356. resorlo-resmode,respectively.
  357.  
  358. Thus,thevideodisplaymemorymaybethoughtofasrepresenting:
  359.  
  360. 1binaryimage  of640*400pixels(hi-res)
  361. 2binaryimagesof640*200pixels(med-res)
  362. 4binaryimagesof320*200pixels(lo-res).
  363.  
  364. Thecolorofaparticularpixelisdeterminedbythe(weighted)
  365. bit-valuesofthe2/4correspondingpixelsinthebinaryimages.
  366.  
  367. Thevideocontroller.
  368.  
  369. Thenextstoponourjourneyfromthevideodisplaymemorytothe
  370. monitorscreenisthevideocontroller.Thischiptakescareof
  371. allthehousekeeping,requiredforconversionofthebytesinthe
  372. videodisplaymemoryto'realworld'voltages,compatiblewith
  373. theintensityinput(s)ofthemonitors.
  374.  
  375. Sinceinthehi-resmodethepixelscontainjust1bitofgrey
  376. valueinformation,thevideocontrollerincorporatesavery
  377. simple1bit'A/Dconverter'togeneratetheintensitysignalfor
  378. themonochromemonitor.
  379.  
  380. Wehaveseenthat,asaconsequenceofthelimited32kBofvideo
  381. displaymemory,inthemed-resandlo-resmodesthepixelscan
  382. havejust2/4bitsofcolorinformation.Thiswouldallowfor
  383. palettesof4/16colors.Fortunately,AtarihasmadetheSTmuch
  384. moreversatile,generouslyincludingthree3bitA/Dconverters
  385. inthevideocontroller.Thus,foreachprimarycolorthereare8
  386. greyvaluesavailable,allowingapaletteof8*8*8=512colors.
  387.  
  388. Ifthepixelscontaininformationforthedefinitionof4/16
  389. colorsonly,howdoesthevideocontrollerknowwhatcolorsto
  390. choosefromthepaletteof512?Theanswerisintheoperating
  391. system;ithasfacilitiestodefinea'sub-palette'of4/16
  392. colors.Eachcolorinthesub-paletterepresentsaparticular
  393. combinationofgreyvaluesforred,greenandblue.These
  394. combinationsarestoredinalookuptableof4/16elements.The
  395. 2/4bitcolorinformationforeachpixelreferstoapositionin
  396. thislookuptableandthevideocontrollerconvertstheRGB-
  397. combinationstoredthereintothecorrespondingintensitycontrol
  398. voltages.
  399.  
  400. ÇWhenacolormonitorisusedtodisplayamonochromegreyvalue
  401. image,theoperatingsystemautomaticallyloadsthelookuptable
  402. with4/8(whynot16?)greycombinationsformed-resorlo-res
  403. displays,respectively.
  404.  
  405.  
  406. Themonitors.
  407.  
  408. Basically,avideomonitorconsistsofaCRTwithsomeelectronic
  409. circuitrytocontrolthedeflectionandtheintensityofthe
  410. electronbeam.Amonochromemonitorusesoneelectronbeam.A
  411. colormonitorrequiresthreebeams,oneforeachprimarycolor.
  412.  
  413. Forintensitycontrolthemonitorshave1or3inputs.The
  414. voltageontheseinputsdeterminestheintensityofthelightspot
  415. onthescreen.
  416.  
  417. Note,thatinprinciplebothmonochromeandcolormonitorsare
  418. capableofdisplayinggreyvalues:thereisacontinuousrange
  419. overwhichtheintensitiescanbecontrolled.However,aswehave
  420. seen,theotherdisplayhardwarereducesthenumberofpossible
  421. greyvaluesand/orcolorsconsiderably.
  422.  
  423. Thedeflectionoftheelectronbeam(s)iscontrolledbythe
  424. monitoritself;forsynchronizationitneedsatriggeringsignal
  425. ('sync')whichisproducedbythevideocontrollerandsimply
  426. addedtotheintensitysignal(s).
  427.  
  428.  
  429.  
  430. ëAIMIMAGESANDTHEIRDISPLAYONTHEATARISTMONTORSÇ
  431.  
  432. TheAIMworkspaceallowssimultaneousstorageof4images:A,B,
  433. CandD.Eachimage(monochromeorcolor)occupies64kB.A
  434. monochromeimage(storedondiskwiththeextension.IM)consists
  435. of256*256pixels,having8bitsofgreyvalueinformation(i.e.
  436. 256greyvaluespossible).Colorimages(extension.COL)consist
  437. of128*128pixels,having24+8=32bitsofcolorandluminance
  438. information.ForthedisplayofcolorimagesAIMsupportsthe
  439. ST'slo-resmodeonly(320*200pixelswithapaletteof16
  440. colors).
  441.  
  442. YoumayhavewonderedwhyAIMuses4Bytesofinformationfor
  443. pixelsof.COLimages.Wouldn'tacolorimagebeperfectly
  444. definedbyjustusing1Byteforeachcolorsub-image?Theanswer
  445. is:yes,itwould.Fortechnicalreasons,however,wehavechosen
  446. toaddenextrabyteforluminancedefinition.Thisformat
  447. allows,forexample,themonochromedisplayof.COLimages.
  448.  
  449. WewilldiscussthedisplayofAIMimagesin4different
  450. situations:
  451.  
  452. Monochrome(.IM)images-monochromedisplay(hi-res)
  453. Color(.COL)images-monochromedisplay(hi-res)
  454. Monochrome(.IM)images-colordisplay(lo-res)
  455. Color(.COL)images-colordisplay(lo-res)
  456.  
  457. ê
  458. ÇMonochrome(.IM)images-monochromedisplay(hi-res).
  459. ü
  460. ÇAsanextensiontoourcheckerboardmodelwemightintroducea
  461. stackof8checkersplacedoneachfield,representingthe8grey
  462. valuebitsofthecorrespondingpixel.Awhitecheckerrepresents
  463. a'1',ablackonea'0'.Dependingonitspositioninthestack
  464. theweightofawhitechecker(i.e.thecontributiontothegrey
  465. value)is128,64,32,16,8,4,2or1.Thus,ifthelowerthree
  466. andtheuppertwocheckersarewhite,thecorrespondinggrey
  467. valueis(128+64+32+0+0+0+2+1=)227.
  468. ë
  469. ÇInourmodelwehave8horizontalplanesof256*256checkers,
  470. eachplanecontributingitsownweighttothetotalimage.Note
  471. thateachplaneitselfactuallycorrespondstoabinaryimage,
  472. hencethename:übitplanesÇ.Theupperplane(b1)istheleast
  473. significantbitplane,thelowerplane(b8)isthemost
  474. significantone.InAIMthe8bitplanesofagreyvalueimagecan
  475. beprocessedas8separatebinaryimages.Bitplanesofoneimage
  476. canbecopied(command:BCOPY)tooneormorearbitrarilychosen
  477. bitplane(s)ofanother.Usingthisfacility,agreyvalueimage
  478. canbeusedasa(temporary)storagefor8independentbinary
  479. images.
  480. ë
  481. ÇAsdeterminedbytheSThardware,inthehi-resmodeonlybinary
  482. imagescanbedisplayed.AIMcircumventsthislimitationbyusing
  483. atrickcalledüsigma-deltatechniqueÇ:the256greyvalues
  484. availableintheimagearerepresentedaswellaspossiblebydot
  485. densitiesinthedisplay.Thisyieldsa256*256*1bitdisplay
  486. withareasonablesuggestionofgreyvaluestothehumaneye.
  487.  
  488. Aspecialsituationoccursifwewanttoprocessmonochrome
  489. picturesfromthedrawingpackageDEGAS.MonochromeDEGAS
  490. pictures(extension.PI3),beingbinary640*400pixelimages,
  491. cannotbeprocesseddirectlybyAIM.Whenreadfromadiskthese
  492. imagesareconvertedtoa320*200pixelimagewith5levelsof
  493. greyinformation.The640*400pixelsaregroupedin320*200non-
  494. overlapping2*2fields.Eachpixelinthefinal320*200pixel
  495. imageisattributedtheaveragegreyvalueofthecorresponding
  496. 2*2field:
  497.  
  498.                 0pixelswhite->greyvalue:0
  499.                 1pixelswhite->greyvalue:63
  500.                 2pixelswhite->greyvalue:127
  501.                 3pixelswhite->greyvalue:191
  502.                 4pixelswhite->greyvalue:255
  503.  
  504. Subsequently,theconvertedDEGASimagesgetthesamesigma-delta
  505. treatmentastheregular.IMimagesforthedisplayofgrey
  506. values.Notethatinthisprocessinformationislost;the
  507. resultingimagehaslessthan320*200*3=192,000bitsof
  508. information(originally:256,000bits).Consequently,eventhough
  509. AIMcanre-convert(loosinginformationagain!)theseimagesback
  510. toDEGASformat,theoriginalpicturescanneverberecovered
  511. completely.
  512.  
  513.  
  514. Color(.COL)images-monochromedisplay(hi-res).ê
  515. Ç
  516. ÇForthedisplayofa.COLimageonamonochromemonitor,onlythe
  517. 128*128pixelluminancesub-imageisused.Thesigma-delta
  518. techniqueagainconvertsthisluminanceinformationtodot
  519. densities.
  520.  
  521.  
  522. Monochrome(.IM)images-colordisplay(lo-res).ê
  523. Ç
  524. Monochrome(.IM)imageshave8bits(256levels)ofgreyvalue
  525. information.Whenan(.IM)imageisreadfromdiskinthelo-res
  526. mode,AIMwillloadthe16colorpalettewiththemaximumof8
  527. levelsofgreyandappliesthesigma-deltatechniqueto
  528. interpolatebetweenthese8levels.
  529.  
  530.  
  531. Color(.COL)images-colordisplay(lo-res).
  532.  
  533. Forthedisplayof.COLimagesinthelo-resmodeAIMfirst
  534. determinesanoptimumpaletteof16colorsfromthepaletteof
  535. 256*256*256colorsavailableintheoriginalimage.The8bitsof
  536. luminanceinformationisnotused.
  537.  
  538. Thepaletteforaparticularscreenisderivedfromtheimagein
  539. theactivewindowonly;thismaynotbetheoptimumpalettefor
  540. otherimagesdisplayedsimultaneously.
  541.  
  542. InthismodecolorpicturesfromtheDEGASandNeochromedrawing
  543. packages(extensions.PI1and.NEO,resp.)canbereadbyAIM
  544. also.Again,sizereduction(to160*100pixels),greyvalue
  545. attributionandthesigma-deltatechniqueareappliedforthe
  546. processinganddisplayoftheseimages.
  547. ë
  548.  
  549. IMAGEPROCESSINGCAPABILITIESOFAIM
  550. Ç
  551. TheimageprocessingsoftwarepackageAIMhasbeenwritteninthe
  552. Clanguage,usingtheMarkWilliamsC-compiler.Itmakes
  553. extensiveuseoftheGEMwindowstructurefortheuserinterface
  554. andthedisplayofimages.AIMallowsprocessinganddisplayof
  555. monochrome,binaryandgreyvalueimagesaswellasofcolor
  556. images.Ithasaninterface(viatheAtariST'sDMAbus)to
  557. monochromeandcolorframegrabbers,developedinthePattern
  558. RecognitionGroup.
  559.  
  560.  
  561. Theuserinterface.
  562.  
  563. Imageprocessingoperationscanbechosenfromdrop-downmenues,
  564. usingdialogboxes,aswellasbytypingtheappropriatecommand
  565. inthecommandbox.Inanycasethecommandsaretransferredas
  566. stringsbytheWindowManagementSystemtotheCommand
  567. Interpreter.ManyoftheAIMcommandscannotbeinvokedfrom
  568. drop-downmenues.Theywillbedesignatedbyanasterisk(*).
  569.  
  570. Thecommandinterpreterstartstheimageprocessingroutine.It
  571. isnotnecessarytotypethecompletecommandname;anynumberof
  572. charactersthatdoesn'tgiveambiguitieswilldo.
  573.  
  574. ÇSequencesofcommandsmaybecombinedinacommandfileormacro.
  575. Commandfilescanbenestedto16levels.Theyareautomatically
  576. createdbyactivatingtheLoggingfeature;anyoperationyou
  577. performafter'Logging'ischecked,willbelogged.Macroscanbe
  578. savedtodiskforre-use.Theextensionforthefilenameis.AIM.
  579. Amacroisexecutedbytypingthename(withoutextension),
  580. precededbythecharacter'@'.Clickingthemenu-entryMacroand
  581. thenameinthedialogboxwilldothesame.Pausingthe
  582. executionispossiblebyhittingtheEsc-key.Proceedwiththe
  583. macrobyhittingReturnorstopbyclickingintheappropriate
  584. box.
  585.  
  586. ThecommandsintheCommandWindowcanbeeditedsimply.Delete
  587. andbackspaceworklikeinmostwordprocessors.Control-Xdeletes
  588. awholeline.
  589.  
  590. Allcharacterstypedafterastar(*)willbeignoredbythe
  591. commandinterpreterandthuscanbeusedforcomments.
  592.  
  593. Typingaquestionmark(?)and<Return>willdisplayalistof
  594. availableoperations.Thesyntaxandashortexplanationforthe
  595. commandscanbefoundinHelp-files.ChooseHELP!!!inthe
  596. Utilitiesmenu.Note,however,thatthisversion(2.5)ofAIMhas
  597. beenextensivelyrevised.Manyoperationshavebeenaddedand
  598. someoftheexistingoperationsallowmoreparameterstobe
  599. specifiedthanthosegiveninthecurrentHelp-filesanddialog
  600. boxes.Fortunately,alloperationsareupwardcompatible.The
  601. AIMANUAL.DOCintheCOMPRESSfoldercontainsanupdated
  602. descriptionofalltheavailableoperations.
  603.  
  604.  
  605. ëEXAMPLESANDDEMOSÇ
  606.  
  607. TheexamplesontheAIMdiskareself-explaining.Theonly
  608. prerequisiteisareasonableunderstandingoftheprevious
  609. chapters.Becausethediskspacewaslimited,wecouldonly
  610. includesomeofthemostrelevantexamples.Consequentlythey
  611. coverjustafewofthepossibleoperations;mostofthe
  612. operationswillhavetobeexploredbyyourself!
  613.  
  614. ThecommentedcommandfilesEXAM1.AIM->EXAM5.AIMhavebeen
  615. includedsothatyoucancheckyourmanuallyenteredexercises.
  616.  
  617. Besidesthepreparedexamplesthreeextrademos(macros)have
  618. beenincludedonthedisk:DEMOCER.AIM,DEMOHFE.AIMand
  619. DEMOSCH.AIM.Theycontainsomeoperationsandstrategiesthatmay
  620. beofinteresttoyouafterhavingcompletedtheexamples
  621. successfully.
  622.  
  623. Finallytwoexercisesareaddedto(self-)testyourabilities.If
  624. thingsgototallywrong,don'tfeelembarrassedbypeepinginto
  625. themacrosPRAK1.AIMandPRAK2.AIM;theycontainpossible
  626. solutionsfortheseexercises.Theexercisesarecompressedfiles
  627. andcanbefoundinthefolderCOMPRESS.
  628.  
  629. Incaseyoumissedapoint:inagreyvalueimage'black'
  630. correspondswithavalue0,'white'withavalue255.Inabinary
  631. image(orabitplaneofagreyvalueimage)thesevaluesare0
  632. and1,respectively.
  633.  
  634. ÇAllexamplesandexerciseswillworkinbothmodes,lo-rescolor
  635. andhi-resmonochrome.Forbinaryoperationsamonochromemonitor
  636. isrecommended.Somedemosaremoreimpressiveincolor,though!
  637.  
  638.  
  639. üExampleEXAM1.AIMÇ
  640.  
  641. Operationsused:Histogram,Equalize
  642.  
  643. FirstwewillretrievetheimageMOON.IM.Clicktheentry'Read
  644. Image'underthe'File'menu.Thedefaultsintheselectorbox
  645. thatpopsup('Window:A'and'STANDARD')areacceptable,so
  646. click'OK'(orhittheReturnkey).Thoseofyouwhoprefera
  647. commandlineinterpretermightaswelltypein'readA'instead
  648. ofusingthemouse.
  649.  
  650. NextaGEM'ITEMSELECTOR'appears.Choose'MOON.IM'andaftera
  651. fewsecondsapictureappearsinWindowA,thatshowsthefoot
  652. ofmoonlandersuroundedbymoondust.Youwillagreethat,
  653. normally,youwouldthrowsuchapictureinthetrashcanand
  654. probablydeclarethemissiontothemoonaflop.AIMcanhelpyou
  655. dealwithsuchfrustations!
  656.  
  657. Justtogetafeelofthepoweraccumulatedinthattiny3.5",
  658. trytheoperation'Equalize'underthemenu'GreyOps'.ChooseA
  659. astheinputimageandBastheoutput.Looksbetter,doesn'tit?
  660. Remember,theinformationwasalreadyintheimage;evenwithout
  661. AIMthemissiontothemoonwasn'tinvain!Buttheapplication
  662. ofAIMcertainlyaddstothesucces.
  663.  
  664. Tounderstandwhathashappenedtotheoriginalimage,trythe
  665. entry'Histogram'under'Utilities'.Thiswillshowagraphof
  666. thefrequencyofoccurrenceofaparticulargreyvalue(or
  667. rather:asmallrangeofgreyvalues)intheimage,plotted
  668. againstthegreyvalue.Frequenciesareplottedvertically,grey
  669. values(0->255)horizontally.Thehistogramindicatesthatthe
  670. greyvaluesintheoriginalimagewereconcentratedina
  671. relativelysmallrange(centeredaroundgreyvalue50).
  672.  
  673. Fromthehistogramwecanconcludethatthegreyscalefrom0to
  674. 255hasnotbeenusedefficiently;nearlyallpixelshaveagrey
  675. valuebetween,say,25and75.Theresultisthat,inaway,we
  676. arelookingattheprintingonatoyballoon;onlyifweinflate
  677. theballoonsomeofthesmallerdetailswillshow.Ifsomehowwe
  678. couldstretchtheoriginalgreyvaluerange,sothat25would
  679. shiftto0and75to255,thesameeffectmightbeimposedonour
  680. moonimage.Throwingawaytheranges0->25and75->255doesn't
  681. domuchharm,becauselittleinformationwillbelost.
  682.  
  683. Equalizationistheairpumpthatinflatesagreyvaluerange.
  684. Unlikeanairpump(andthesuggestionintheprevious
  685. paragraph!)itdoessointelligently.Thatis,thestretching
  686. effectonaparticularrangeofgreyvaluesdependsontheheight
  687. ofthehistogramforthatrange.Rangeswithhighvaluesinthe
  688. histogramwillbeexpandedatthecostofthecompressionofless
  689. prominentranges.Note,thattheremaybemultiplepeaksand
  690. valleysinthehistogram.Toseewhatwemean,determinethe
  691. histogramofimageBandcompareitwiththeoriginalone.The
  692. frequencies(verticallines)aredividedmoreevenlyoverthe
  693. availablerangeofgreyvalues.
  694. ÇRangeswithhighfrequenciesofoccurrenceintheoriginal
  695. histogramhavebeenstretchedandthosewithlowfrequencies
  696. compressed.Ifyouarenotcompletelysatisfied,performthesame
  697. operationsontheimageTRUI.IM,whichhasmultiplepeaksinthe
  698. histogram.
  699.  
  700. Equalizationisaniceexampleofimageprocessing:important
  701. features(inthiscasegreyvalueranges)areemphasizedatthe
  702. costoflessimportantfeatures.Yet,inthisparticular
  703. operationnoinformationislost;a'de-emphasis'procedure(not
  704. availableinAIM)couldrestoretheoriginalimage.
  705.  
  706. Hint:ifyouwanttogetridofthehistograminaparticular
  707. display,use'Gdisplay'intheUtilitiesmenu.
  708.  
  709.  
  710. üExampleEXAM2.AIMÇ
  711.  
  712. Operations:Gradx,Grady,Enhance
  713.  
  714. ReadtheimageTRUI.IMin(thedefault)WindowA.Thisimagehas
  715. becomeakindofreferenceformanygroupsinvolvedinimage
  716. processing.
  717.  
  718. Performtheoperation'Gradx'intheGreyOpsmenu.Acceptallthe
  719. defaultsproposedbyAIM.WorryabouttheMultiplyandAddvalues
  720. later,orbetterstill,experimentwiththem.
  721.  
  722. TheGradx('gradientinx-direction')operationdeterminesthe
  723. rateatwhichgreyvalueschangeintheoriginalimageand
  724. attributescorrespondinggreyvaluestothepixelsoftheoutput
  725. image.Anoutputpixelgetsagreyvalueaccordingtothe
  726. formula:
  727.  
  728. grey-out=(gradient-in)*Multiply/1024+Add.
  729.  
  730. Thisoperationshowsverticaledgesintheimage.Anedge
  731. correspondstoastepingreyvalue.Notetheeffectonedgesin
  732. thegirl'shat.
  733.  
  734. NowperformGrady.ThistimesendtheoutputtoWindowC.Note
  735. theresultforhorizontaledges(mouth,eyebrows,etc.).
  736.  
  737. Arelatedoperation,whichisgenerallyusedtosharpen-up
  738. picturesistheEnhance-operation(inmenuGreyOps).It
  739. determinesthesecondderivative(inbothdirections)ofthe
  740. grey-valuesintheinputimage.LikeGradx/yitemphasizeshigh
  741. frequenciesintheimage.Highfrequenciesoccuratsharpedges.
  742. TrytheEnhancefilterontheoriginalTRUI.IM.andenjoythe
  743. improvement.Butwhatdidwedotohereyes?Seemswecreatedher
  744. contactlenses...
  745.  
  746.  
  747. üExampleEXAM3.AIMÇ
  748.  
  749. Operation:Medianfilter
  750.  
  751. ReadimageBNOISE.IM.Thisimagehasintentionallybeendegraded
  752. by'shotnoise'.Thistypeofnoiseoccursofteninthe
  753. transmissionofsignals.Someofthepixelsdifferverymuchin
  754. greyvaluefromthesurroundingpixels.Inthiscasetheyare
  755. white.Wewanttousefilteringtoremovethenoise.
  756.  
  757. Usuallyitisdifficulttopredicttheeffectsoffiltering.
  758. Variousparametersmustbespecified,requiringmuchintuition.
  759. Try,forexampletheentry'Filter'intheGreyOpsmenu!
  760.  
  761. Agoodfilterfortheproblemofshotnoiseistheso-called
  762. medianfilter.InthisoperationAIMdeterminesthegreyvalues
  763. in3*3neighborhoodsforeachpixelintheinputimage.These
  764. valuesaresortedintableswith9entries.The5thentryineach
  765. table(the'median')becomesthegreyvalueofthecorresponding
  766. outputpixel.Thegreyvalueofashotnoisespeckislikelyto
  767. beintheextremesofthetablesinwhichitappears,andthusit
  768. willberemoved.
  769.  
  770. Performtheoperation'Median'intheGreyOpsmenu.Onlyafew
  771. stubbornnoisespeckswillsurvive.Theymayberemovedbya
  772. repeatedapplicationofthisfilter.
  773.  
  774.  
  775. üExampleEXAM4.AIMÇ
  776.  
  777. Operations:Copy,Lmin,Lmax,(*)mindev,Gdisplay
  778.  
  779. OncemorewecallonTRUI.IM;readitfromdisk.Wewillneeda
  780. secondcopyofthisimageinWindowB.Therearetwooptions:
  781. a.ReadtheimageagainfromdiskandhaveAIMputitinWindowB
  782. b.Use'Copy'inmenuGreyOpstocopyWindowAinWindowB.
  783.  
  784. Notethatthereisa'Copy'entryintheBinOpsmenutoo.This
  785. binaryoperationcopiesonlybitplanes,asopposedtoagrey
  786. valuecopy,whichcopiesall8bitplanesofanimageatonce.
  787.  
  788. Ifallwentwell,younowhavethefabulousTruitwinsonscreen.
  789. Thefirstoperationtobeperformedis'Lmin'intheGreyOps
  790. menu.Thisoperationlooksforthelowestgreyvalueinann*n
  791. neighborhood(ntobespecifiedbytheuser)oftheinputpixel
  792. andattributesittothecorrespondingoutputpixel.Thisfilter
  793. hasatendencyofexpandingdarkerareasintheimage.Tryit
  794. withn=9andputtheresultinWindowC.Experimentalittlewith
  795. differentvaluesforn.Observetheeffectsonnostrilsandeyes!
  796. Inanycaseendwitha9*9Lmin-nedTRUI.IMinWindowC.
  797.  
  798. Nextapplythe'Lmax'filteronWindowA.Choosen=9andputthe
  799. resultinWindowD.Thisfilterexpandslighterarea'sinthe
  800. image.Wehopethatuntilnowyouacquiredenoughintuitiontobe
  801. abletopredicttheeffect:gonearethosenostrilsandgoneis
  802. thatmouthinthe'lightershadeofpale'thatsurroundedthem.
  803.  
  804. ÇButnowtherealimageprocessorarises.Wearegoingtousean
  805. operationthatusesthreeinputimages:(*)mindevC,D,A.This
  806. operationcomparescorrespondingpixels(i.e.pixelswiththe
  807. samecoordinates)intheoriginalimage(A)andthetwoother
  808. images(CandD).Theoutputpixelgetsthegreyvalueofthe
  809. correspondingpixelinCüorÇD,dependingonwhichoneofthetwo
  810. isclosesttothegreyvalueinA.Bigdeal,butwhatisthe
  811. effect?
  812.  
  813. Let'stryitfirst.The(*)mindev('minimaldeviation')
  814. operationcannotbeinvokedfromthemenu,sowehavetotypeit
  815. indeCommandWindow:typemindevC,D,A<Return>.Theresultwill
  816. beshowninWindowA.Compareitwiththeoriginalimage,which
  817. isstillluringinWindowB.Apparentlytheedgesintheimage
  818. (cheeks,hair)havebeensharpened.TheneteffectofLmin,Lmax
  819. andmindevis,thatnearedgesthereisabacklashingreyvalue.
  820. Inotherwords,greyvaluesarereluctantagainstchanges;
  821. changesoccursuddenlyasafunctionofposition.
  822.  
  823. üExampleEXAM5.AIMÇ
  824.  
  825. Operations:(*)Clear,Threshold,Invert,Propagation,Bdisplay,
  826. Reset,Exorand(*)Measure.
  827.  
  828. ReadtheimageCERMET.IMfromdisk.
  829.  
  830. Ourpurposewiththisexampleistodosomemeasurementsonthe
  831. objectsinthisimage.The'(*)Measure'operationrequiresthe
  832. objectsofinteresttobewhiteinablackbackground.Inthe
  833. menu'BinOps'wehavesomeusefuloperationsatourdisposalto
  834. achievethatgoal.
  835.  
  836. Inordertobeabletoapplybinaryoperations('BinOps'),we
  837. firstwillmakethegreyvalueimageinWindowAbinary.The
  838. operation'Threshold'intheGreyOpsmenumakespixelswitha
  839. greyvaluebelowthethresholdblackandpixelswithagreyvalue
  840. aboveitwhite.Whentheoperationisinvoked,itproposesa
  841. thresholdwhichistheaveragegreyvalueintheimage;itisnot
  842. necessarilythebestguess,butusuallyityieldssatisfactory
  843. results.
  844.  
  845. Stop!TheThresholdoperationwillaskforthebitplanewherethe
  846. binaryimageistobestored(itdefaultstob1inWindowB).
  847. However,asourpreviousexerciseswillhaveleftsomegarbagein
  848. theotherbitplanesofWindowB,wefirsthavetoclearthose.
  849. Theoperation'(*)Clear'isprovidedtoclearallbitplanesofa
  850. windowatonce(clear=greyvalue0=black!).Type:clearB
  851. <Return>.
  852.  
  853. NowwearereadyfortheThresholdoperation;clickonitinthe
  854. GreyOpsmenuandacceptthedefaults.
  855.  
  856. Asweneedwhiteobjectsinablackbackground,thepicturein
  857. WindowBmustbeinverted.Clickon'Invert'intheBinOpsmenu
  858. (acceptthedefaults).
  859.  
  860. ÇNotethatsomeoftheobjectsneartheframeofthewindoware
  861. onlypartiallydisplayed.Wedon'twantthe'(*)Measure'
  862. operationtotaketheseincompleteobjectsintoaccount,buthow
  863. canwegetridofthem?Howcanwedistinghuishthemfrom
  864. completeobjects?Theansweris:usethe'Propagation'operation
  865. (inCelOps).
  866.  
  867. The'Propagation'operationallowsustoisolateobjects.White
  868. pixels(called'seeds)will'grow'(expand)underthecondition
  869. thatinagivenreferencebitplane(the'mask')thecorresponding
  870. pixelsarewhitetoo.Wecanvisualizethisoperationastaking
  871. placeinafieldwithseeds(=whitepixelsthatwewanttogrow
  872. toshapespresentinthemask).Thereferencebitplane(the
  873. 'mask')istheculturemedium;ithasfertileandinfertile
  874. regions.Ifaregionisfertile(i.e.ithaswhitepixelsthat
  875. coincidewiththeseedpixels),theseedcangrow.Inone
  876. 'iteration'(propagationstep)apixelgrowsinaccordancewith
  877. itsconnectivity:onewhitepixelisaddedinallconnecting
  878. directions.InAIMtheseedbitplaneiscalledCLP(Cellular
  879. LogicPlane).
  880.  
  881. Inthenextiterationtheseedbitplane(CLP)thatresultedfrom
  882. thefirstiterationiscomparedoncemorewiththemaskbitplane.
  883. CoincidingwhitepixelsinCLPandmaskwill,oncemore,grow.
  884. Thiswillcontinueuntilallseedshavegrowntotheedgesofthe
  885. fieldsinthemask;wehavecreatedanexactcopyofallthe
  886. fieldsthatinthefirstiterationcoincidedwithatleastone
  887. seed.Thetrickofisolatingparticularfieldsinthemaskisto
  888. createaCLPwithseedsthatcoincidewiththosefields.
  889.  
  890. Let'sreturntoourproblemofisolatingtheincompletewhite
  891. objectsatthebordersofbitplaneb1inWindowB.Itwouldbe
  892. niceifwehadabitplaneavailable(tobeusedastheCLP)with
  893. whitepixelsalongtheframeüonlyÇ.ThePropagationoperation
  894. wouldmakethoseborder-pixelsgrowtotheexactshapesofthe
  895. intersectedobjectsinthemask(inourcase:b1).Theresult
  896. wouldbe:twoimageshavingtheunwantedobjectsincommon.
  897. Subsequentapplicationofthelogicaloperation'Exor'(inthe
  898. BinOpsmenu)onthesetwoimageswillfinallyremovetheunwanted
  899. objects.Exoristheinequalityoperator:itcompares
  900. correspondingpixelsinboth(binary!)imagesandoutputsawhite
  901. pixelif(andonlyif)theyaredifferent.
  902.  
  903. Nowthatwehopefullyunderstanditwecannotwaittoputour
  904. knowledgetothetest.Theonlyimageweneedisbitplaneb1in
  905. WindowB.ClickonPropagation.Wewillhavetochangealmostall
  906. ofthedefaults!Ourmaskbitplaneisb1insteadoftheproposed
  907. b2.Furthermore,wewilluseb2asourCLPinsteadofb1.The
  908. connectivityisnotimportant,butchangeitto8.Thenecessary
  909. whiteedgeforourCLPcanbechosenwiththeentry'Edgevalue'.
  910. Choose1(forwhite).Makethenumberofiterations100;thatis
  911. toomany,butAIMwillstopautomaticallywhenallgrowthhas
  912. stopped.
  913.  
  914. CheckallentriesintheDialogBox:ifsomethingiswrongthere
  915. isariskthatyouhavetostartalloveragain!YourSTwon't
  916. complain,butwedon'twanttofrustrateprospectiveimage
  917. processorsinsuchanearlystage.
  918.  
  919. ÇHitReturn.Ifalliswell,youwillseeanimageinbitplaneb2
  920. ofWindowBthathastheintersectedobjectsonly.Wrong?Don't
  921. worry,justkeeptrying.Don'tforgettoclearbitplaneb2prior
  922. toeveryPropagationoperation.
  923.  
  924. NextinvokeoperationExor(inBinOps).Useb1andb2inWindowB
  925. asinputsandb3asoutput.
  926.  
  927. Atlastourimageisreadyforthe(*)Measureoperation.This
  928. operationassumesthattheimageisinb1ofWindowB,sowemust
  929. copyb3tob1first.Click'Copy'inBinOpsandchoosethe
  930. appropriatebitplanes.
  931.  
  932. (*)Measureperformsanumberofmeasurementsontheobjectsand
  933. displaystheresultsintheCommandWindow.Itassignsnumbersto
  934. theobjects(left->right,up->down)andlabelseachobject
  935. withagreyvalueaccordingtothisnumber.Thiscanbeobserved
  936. inWindowD.
  937.  
  938. Typemeasure(meawilldo!)<Return>.NotethattheCommand
  939. Windowcanbesizedtobringallmeasureddataonscreen.
  940.  
  941.  
  942. üPRACTICALEXERCISESÇ
  943.  
  944. PRAK1.
  945. StudytheimagePRAK1.IM.Yourassignmentistoseparatethenuts
  946. fromthebolts.Inotherwords:useAIMtogeneratetwoimages,
  947. onecontainingthenuts(includingtheonethatrestsonits
  948. side!)andtheotheronethebolts.Counttheobjectsafterwards.
  949.  
  950. PRAK2.
  951. TheimagePRAK2.IMshowsahandfulofelectroniccomponents.Try
  952. toseparatethem.Useyourfantasyandsurprisehusbands,friends
  953. andneighbors!
  954.  
  955.