MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 Guida Utente

Navigare online o scaricare Guida Utente per Software MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3. MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 User`s guide Manuale Utente

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 252
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti

Sommario

Pagina 1 - User’s Guide

VideoandImageProcessing Blockset 2User’s Guide

Pagina 2 - Natick, MA 01760-2098

1 Gettin g StartedWhat Is Video and Image Processing Blockset?Video and Image Processing Blockset is a tool used for the rapid design,prototyping, gra

Pagina 3 - Revision History

4 ConversionsColor Space ConversionThe Color Space Conversion blo ck enables you to conve rt co lor informationfrom the R’G’B ’ color space to the Y’C

Pagina 4

Color Space Conversion3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityImage FromWorkspaceVid

Pagina 5 - Contents

4 ConversionsOnce you have assembled the blocks needed to convert a R’G’B’ image toan intensity image, you are ready to set your block parameters. To

Pagina 6 - Conversions

Color Space Conversion7 View the modified image using the Video Viewer block. Accept the defaultparameters.8 Connect theblockssothatyourmodelissimilar

Pagina 7

4 Conversions• Solver pane, Stop time = 0• Solver pane, Type = Fixe d-st ep• Solver pane, Solver = discr ete (no continuous states)10 Run your model.T

Pagina 8

Chroma ResamplingChroma ResamplingThe Y’CbCr color space separ ate s the luma (Y’) compon ent of an image fromthe chroma (Cb and Cr) components. Luma

Pagina 9 - Getting Started

4 Conversions3 Create a new Simulink model, and add to it the blocks shown in thefollowingtable.Block Library QuantityImage FromWorkspaceVideoandImage

Pagina 10 - 1 Gettin g Started

Chroma ResamplingThe blocks to the left of and including the Chroma Resampling blockrepresent the transmission portion of the model. The remaining blo

Pagina 11 - Installation

4 ConversionsTheImagePadblockaddsonecolumntotherightofeachplaneofthearray by repeating its border values. This padding minimizes the effectof the pixe

Pagina 12

Chroma Resampling– Index Option = Select all• 2– Index Option =Select all• 3– Index O ption =Index vector (dialog )– Index = 1Set the Selector1 block

Pagina 13 - Product Demos

InstallationInstallationThis section describes how to install Video and Image Processing Blockset andits d ocumentation. It also reviews the other Mat

Pagina 14

4 Conversionsa gamma corrected signal. Set the Image signal parameter to Separatecolor signals.9 Use the Chroma Resampling block to downsample the chr

Pagina 15 - Viewing the Documentation

Chroma Resampling14 Configure Simulink to display signal dimensions next to each signal line.Click Format > Port/Signal Displays > Signal Dimens

Pagina 16

4 Conversions17 Examine the signal dimensions in your model. The Chroma Resamplingblock downsamples the Cb and Cr components of the image from 206-by

Pagina 17 - What Chapter Should I Read?

5Geometric TransformationThe Geometric Transformations library contains blocks that enable you torotate, translate, shear, and resize images.Interpola

Pagina 18

5 Geometri c TransformationInterpolation OverviewVideo a nd Image Processing Blockset contains blocks that perform geometrictransformations. These blo

Pagina 19 - Key Blockset Concepts

Interpolation Overview1 Zero pad the input matrix and translate it by 1.7 pixels to the right.1230045600789001.7 pixelsOriginal zero-padded matrixTran

Pagina 20

5 Geometri c Transformation123456789represents your input image. You want to translate this image 0.5 p ixel inthe p ositiv e horiz ontal direction us

Pagina 21 - Defining Intensity and Color

Interpolation Overview123456789represents your input image. You want to translate this image 0.5 p ixel inthe positive horizontal direction using bicu

Pagina 22

5 Geometri c TransformationRotating an ImageYoucanusetheRotateblocktorotateyourimageorvideostreambyaspecified angle. In this exampl e, you le arn how

Pagina 23 - From File block dialog box

Rotating an ImageBlock Librar y QuantityRotateVideo and Image ProcessingBlockset > G eo metricTransformations1Video Viewer Video and Image Processi

Pagina 24

1 Gettin g Started2 Click Download products.3 Log in to the system using your MathWorks Account e-mail and password.If you do not have a MathWorks Acc

Pagina 25 - Key Blockset Con cepts

5 Geometri c TransformationYou are now ready to set your block parameters by double-clicking theblocks, modifying the blo ck parameter values, and cli

Pagina 26

Rotating an ImageThe Angle port appears on the block. You use this port to input a steadilyincreasing angle. Setting the Output size parameter toExpan

Pagina 27 - Coordinate Systems

5 Geometri c Transformation• Counter size = 16 bits• Output = Count• Clear the Reset input check box.• Sample time =1/30The Counter block counts upwar

Pagina 28

Rotating an Image12 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu.

Pagina 29 - Sample Time

5 Geometri c TransformationNote If you are on a Windows operatin g system, you c an re pla c e the VideoViewer block with the To Video Display block,

Pagina 30

Resizing an ImageResizing an ImageYou can use the Resize block to change the size of your image or video stream.In this example, you learn how to use

Pagina 31 - Normal and Accelerator Mode

5 Geometri c TransformationImage Courtesy of Michael Myers5-14

Pagina 32

Resizing an Image3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityImage FromWorkspaceVideo an

Pagina 33 - Neares t neighbor

5 Geometri c TransformationThe Video Viewer1 block autom atically displays the original image in theVideo Viewer1 window when you run the model.7 Use

Pagina 34

Resizing an Image10 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu.

Pagina 35

Product DemosProduct DemosVideo and Image Processing Blockset has a number of demo models that solvereal-world pro blems. B eg in viewing Video and Im

Pagina 36 - Block Data Type Support

5 Geometri c TransformationThe reduced image appears in the Video Viewer window. Right-click thewindow and select Set D isplay To True Size. The small

Pagina 37

Resizing an ImageIn this example, you used the Resize block to shrink an image. For moreinformationaboutthisblock,seetheResizeblockreferencepageintheV

Pagina 38

5 Geometri c TransformationCropping an ImageYou can use the Selector block to cro p your image or video stream. In thisexamp le, you learn how to use

Pagina 39

Cropping an ImageBlock Library QuantityImage FromWorkspaceVideo and Image ProcessingBlockset > Source s1Video Viewer Video and Image ProcessingBloc

Pagina 40 - Image Credits

5 Geometri c Transformation7 Use the Selector block to crop the image. Set the block parameters asfollows:• Number of input dimensions =2• 1– Index Op

Pagina 41 - Importing and Exporting

Cropping an ImageThe Selector block starts at row 140 a nd co lum n 200 of the im ag e andoutputs the next 70 rows and columns of the image.8 Use the

Pagina 42 - Working with AVI Files

5 Geometri c Transformation10 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simula

Pagina 43

Cropping an ImageThe cropped image appears in the Video Viewer w indow. The followingimage is shown at its true size.In this example, you used the Sel

Pagina 44

5 Geometri c Transformation5-26

Pagina 45

6Morphological OperationsMorphological image analysis can be u sedtoperformimagefiltering,imagesegmentation, and measurement operations.Overview of Mo

Pagina 46 - Exporting to AVI Files

1 Gettin g StartedDemos on the WebThe MathWorks Web site contains demos that show you how to useVideo and Image Processing Blockset. You can find thes

Pagina 47 - Same as input

6 Morphological OperationsOver view of MorphologyMorphology is the s tudy of the shape and form of objects. Morphologicalimage analysis can be used to

Pagina 48 - Importing and Exporting Video

CountingObjectsinanImageCountingObjectsinanImageIn this ex ample, you im port an intensity imag e of a wheel from the MATLABworkspace and convert it t

Pagina 49

6 Morphological OperationsThe file testpat1.png is an intensity image of a wheel that contains 24black spokes.3 Create a new Simulink model, and add t

Pagina 50 - Intensity

CountingObjectsinanImageYou are now ready to set your block parameters by double-clicking theblocks, modifying the blo ck parameter values, and clicki

Pagina 51

6 Morphological OperationsThe strel function creates a circular STREL object with a radius of 5pixels. When working with the Openi ng block, pick a ST

Pagina 52

CountingObjectsinanImage12 The Display block displays the number of spokes in the input image. Usethe default parameters.13 Connect the block as shown

Pagina 53

6 Morphological Operations14 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulat

Pagina 54 - [[5 10]' [80 10]']

CountingObjectsinanImageAsyoucanseeintheprecedingfigure, the spokes are now separate whiteobjects. In the model, the Display b lock correctly indicate

Pagina 55 - %d'

6 Morphological OperationsTo Workspace block in Sim ulink or the Signal to Workspace block in SignalProcessing Blockset. For more information about ST

Pagina 56

Correcting for Nonuniform IlluminationCorrecting for Nonuniform IlluminationGlobal threshold techniques, which areoftenthefirststepinobjectmeasurement

Pagina 57 - '%s region

Working w ith the DocumentationWorking with the DocumentationVideo and Image Processing Blockset documentation includes the Video andImage Processing

Pagina 58

6 Morphological OperationsThis image is darker at the bottom than at the top. You want to createa model to even out this lighting.3 Create a new Simul

Pagina 59 - 'Frame %d'

Correcting for Nonuniform IlluminationBlock Library QuantitySum Simulink > Math Operations2Data Typ e Conversi on Simu link > Sig n al Attribute

Pagina 60 - Video only

6 Morphological OperationsThe stre l function creates a circular STREL object with a radius of 15pixels. When working with the Openi ng block, pick a

Pagina 61

Correcting for Nonuniform Illumination13 UsethesecondSumblocktolightentheimagesothatithasthesamebrightness as the original i mage. Set the block param

Pagina 62

6 Morphological OperationsThe original image appears in the Video Viewer window. To view theimage at its true size, right-click the window and select

Pagina 63

Correcting for Nonuniform IlluminationThe image without the estimated background appears in the Video Viewer2window. The fo llow ing image is show n a

Pagina 64

6 Morphological OperationsIn this section, you h ave used the Opening block to remove irregularillumination from an image. For more information about

Pagina 65 - WorkingwithMultimediaFiles

7Analysis and EnhancementYou can use Video and Image Processing Blockset blocks to learn more aboutthe structure of images as well as to improve them.

Pagina 66 - Separate color signals

7 Analysis and EnhancementFeature ExtractionFeature extraction techniques return information about the structure of animage. For example, you can use

Pagina 67 - Exportin

Feature Extraction3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityImage FromWorkspaceVideo a

Pagina 68

1 Gettin g StartedDocumentationontheWebYou can also view the documentation from the MathWorks Web site. Thedocumentation available on these Web pages

Pagina 69

7 Analysis and Enhancement4 Place the blocks so that your model resembles the following figure.You are now ready to set your block parameters by doubl

Pagina 70 - Fi xed- step

Feature ExtractionThe Edge Detection block convolves the input matrix with the Sobel kernelto calculate the gradient components of the image that corr

Pagina 71 - Working with Audio

7 Analysis and Enhancement9 Use the Subtract blocks to subtract the minimum values from each elementof the Gv and Gh matrices. This process ensures th

Pagina 72

Feature Extraction• Solver pane, Solver = discr ete (no continuous states)15 Run your model.The Video Viewer window displays the e dg es of the r ice

Pagina 73 - Working with Multimedia Files

7 Analysis and EnhancementThe Video Viewer2 window displays the intensity image of the horizontalgradient components of the image. In this image, the

Pagina 74

Feature Extraction17 Run your model again.Your model runs faster because the Edge D etection block is more efficientwhen you clear the Edge thinning c

Pagina 75

7 Analysis and Enhancementimshow(I)Image Courtesy of Steve Decker and Shujaat Nadeem3 Create a new Simulink model, and add to it the blocks shown in t

Pagina 76

Feature ExtractionBlock Library QuantityHough Transform Video and Image Processing Blockset> Transforms1Find Local Maxima Video and Image Processin

Pagina 77

7 Analysis and Enhancement5 Use the Image From Workspace block to import your image from theMATLAB workspace. Set the Value parameter toI.6 Use the Ed

Pagina 78 - 3 Working with MPlay

Feature Extraction9 Use the Find Local Maxima block to find the location of the m a ximumvalue i n the H oug h matrix. Set the block parameters as fol

Pagina 79

Working w ith the Documentation• MATLAB, to write scripts and functions w ith M-code, and to use functionswith the command-line interface• Simulink,to

Pagina 80

7 Analysis and Enhancement• 1– Index Option =Index vector (dialog)– In dex = 0• Inputportsize= 2Set the Selector1 block parameters as follows :• Index

Pagina 81

Feature Extraction16 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu

Pagina 82 - Viewing Video Files

7 Analysis and EnhancementThe Video Viewer1 window displays t he original imag e with a white linedrawn over the longest line in the image.You have no

Pagina 83

Feature Extractionthese bl ock s, see the Hough Transform, Find Local Maxima, and H ough Li n esblock reference pages in the Video and Image Processin

Pagina 84

7 Analysis and EnhancementBlock Library QuantityEmbedded MATLABFunctionSimulink > User-Defined Functions1Draw Shapes Video and Image Processing Blo

Pagina 85 - 7 Experim

Feature ExtractionNote In this example, you segment the image using a thresholdingoperation that performs best on the Cb channel of the Y’CbCr color s

Pagina 86

7 Analysis and Enhancement6 Use the Submatrix and Submatrix1 blocks to crop the Y’ and Cb matricesto a particular region of interest (ROI). This ROI c

Pagina 87

Feature Extraction9 Use theFind Local Maxima block to find the peak values in the Houghmatrix. These values represent potential lines in the input ima

Pagina 88 - IntensitytoBinaryConversion

7 Analysis and Enhancement• Starting row = Index• Starting row index = 2• Ending row = Index• Ending row index = 2The Idx port of the Find Local Maxim

Pagina 89 - 4 Positi

Feature Extraction13 Use the Hough Lines block to find the Cartesian coordinates of lines thatare described by rho and theta pairs. Set the Sine value

Pagina 90

1 Gettin g Started• ReadChapter8,“ExampleApplications”tolearnhowtotrackthemotionof an object in a video stream. Also, learn more about motion compensa

Pagina 91 - Connect the

7 Analysis and Enhancement19 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulat

Pagina 92

Feature ExtractionThe Video Viewer window disp lays the orig inal im age.The Video Viewer1 window displays the ROI w he re two beams intersect.7-25

Pagina 93 - Autothreshold Block

7 Analysis and EnhancementThe Video Viewer2 window displays the ROI that has been annotated withtwo white lines.The Display block shows a value of 54,

Pagina 94

Image EnhancementImage EnhancementImage enhancement techniques improve images. You can use them to removenoisefromimages,increasethesignal-to-noiserat

Pagina 95

7 Analysis and EnhancementI is a 384-by-512-by-3 array of double-precision floating-point values.Each plane of this array represents the red, green, o

Pagina 96

Image EnhancementBlock Library QuantityImage FromWorkspaceVideoandImageProcessingBlockset>Sources1Color SpaceConversionVideoandImageProcessingBlock

Pagina 97

7 Analysis and Enhancement7 Use the 2-D FIR Filter block to filter the luma portion of the image. Set theblock parameters as follows:• Coefficients =f

Pagina 98

Image EnhancementThe fspecial('unsharp')command creates two-dimensio nal highpassfiltercoefficients suitable for correlation. This highpassf

Pagina 99

7 Analysis and Enhancement9 Use the Video Viewer block to automatically display the n ew, sharperimage in the Video Viewer window when you run the mod

Pagina 100 - Color Space Conversion

Image Enhancement11 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu.

Pagina 101

Key Blockset Con ceptsKey Blockset ConceptsIn this section, you learn how the VideoandImageProcessing Blockset blocksinterpret input matrices and arra

Pagina 102 - 4 Conversions

7 Analysis and Enhancement13 To blur theimage,double-clickthe2-D FIR Filter block. Set Coefficientsparameter tofspecial('gaussian',[15 15],7

Pagina 103

Image EnhancementIn this exampl e, you used the Color S pa ce Conve rsion and 2-D FIR Filterblocks to sharpen and blur an image. For m o re informatio

Pagina 104

7 Analysis and EnhancementI= double(imread('circles.png'));I= imnoise(I,'salt & peppe r',0.02);Iis a 256-by-256 matrix of 8-bi

Pagina 105 - Chroma Resampling

Image EnhancementBlock Library QuantityImage FromWorkspaceVideo and Image Processing Blockset> Sources1Median Filter Video and Image Process in g B

Pagina 106

7 Analysis and EnhancementThe Median Filter block replaces the central value of the 3-by-3neighborhood with the median value of the neighborhood. This

Pagina 107 - No pad ding

Image Enhancement9 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu.

Pagina 108

7 Analysis and EnhancementThe cleaner image appears in the Video Viewer1 window. The followingimage is shown at its true size.YouhaveusedtheMedianFilt

Pagina 109

Image EnhancementRemoving Periodic Noise from VideoPeriodic noise can be introduced into a video stream during acquisition ortransmission due to elect

Pagina 110

7 Analysis and EnhancementYou are now ready to set your block parameters by double-clicking theblocks, modifying the blo ck parameter values, and clic

Pagina 111 - Fixe d-st ep

Image Enhancement6 UsetheImageDataTypeConversionblock to convert the data type of thevideo to singl e- precision f loating point. Accept the d ef au l

Pagina 112

How to Contact The MathWorkswww.mathworks.comWebcomp.soft-sys.matlab Newsgroupwww.mathworks.com/contact_TS.html Technical [email protected]

Pagina 113 - Geometric Transformation

1 Gettin g StartedImage TypesImages can be b inary, intensity (grayscale), or RGB.Binary ImagesBinary images are represented by a Boolean matrix of 0s

Pagina 114 - Interpolation Overview

7 Analysis and Enhancementradians per sample. The coefficients were created using the Filter Designand Analysis Tool (FDATool) and theftrans2 function

Pagina 115 - Bilinear Interpo lation

Image Enhancement12 Use theVideo Viewer2 block to view the approxim ation of t he origina lvideo.Accept the default parameters.13 Connect the block as

Pagina 116 - 5 Geometri c Transformation

7 Analysis and Enhancement14 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulat

Pagina 117 - 0 0 0 7 7 8 8 9 9 0 0 0 0

Image EnhancementThe noisy video appears in the Video Viewer1 window. The following videois shown at its true size.Theapproximationoftheoriginalvideo

Pagina 118 - Rotating an Image

7 Analysis and Enhancementblocks, see the R ead Binary File, 2-D FIR Filter, and Video Viewer blockreference pages in the Video and Image P rocessing

Pagina 119

Image Enhancement3 Use the Image From File block to import the first image into the Simulinkmodel. Set the File name parameter topout.tif.4 UsetheImag

Pagina 120

7 Analysis and EnhancementThis block adjusts the contrast of the image by linearly scaling the pixelvalues between u ser-specified upper and lower lim

Pagina 121 - Free running

Image EnhancementThis block enhances the contrast of images by transforming the values inan intensity image so that the histogram of the output image

Pagina 122

7 Analysis and Enhancement• Solver pane, Stop time = 0• Solver pane, Type = Fixe d-st ep• Solver pane, Solver = discr ete (no continuous states)10 Run

Pagina 123

Image EnhancementIn this example, you used the Contrast Adjustment block to linearlyscale the pixel values inpout.tif between new upper and lower limi

Pagina 124

Key Blockset Con ceptsDefining Intensity and ColorThe values in a binary, intensity, or RGB image can be different d ata types.The data type of the im

Pagina 125 - Resizing an Image

7 Analysis and EnhancementBlock Library QuantityImage FromWorkspaceVideo and Image Processing Blockset> Sources1Color SpaceConversionVideo and Imag

Pagina 126

Image Enhancement• Image signal = Separate color signals5 Use the Color Space Conversion block to separate the luma informationfrom the color informat

Pagina 127

7 Analysis and Enhancement9 Use the Product block to scale the values back to the 0 to 100 range. Acceptthe default parameters.10 Use the Color Space

Pagina 128

Image EnhancementAs shown in the following figure, the model displays the original image inthe Video Viewer1 windo w.7-57

Pagina 129

7 Analysis and EnhancementAs the next figure shows, the model displays the enhanced contrast imagein the Video Viewer window.In this example, you used

Pagina 130

Pixel StatisticsPixel StatisticsVideo and Image Processing Blockset contains blocks that can provideinformation ab ou t the data values that make up a

Pagina 131

7 Analysis and Enhancement3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityImage FromWorkspac

Pagina 132 - Cropping an Image

Pixel StatisticsBlock Library QuantityReshape Simulink > Math Operations3MatrixConcatenationSimulink > Math Operations1Vector Scope Signal Proce

Pagina 133

7 Analysis and Enhancement7 UsetheBusCreatorblocktocombinetheR,G,andB,signalsintoonesignal so you can process it with one 2-D Histogram block. Set the

Pagina 134

Pixel Statistics10 UsetheReshapeblockstotransformtherowvectorsoutputfromtheBusSelector block into columns vectors. Set the Output dimensionalityparame

Pagina 135

1 Gettin g StartedColor Image ProcessingVideoandImageProcessing Blockset enables you to work with color imagesand video signals as multidimensional ar

Pagina 136

7 Analysis and EnhancementThe Bus Selector block still needs to be connected. You cannot configurethe parameters of this block until you connect an in

Pagina 137

Pixel StatisticsThe original image appears in the Video Viewer window. To view theimage at its true size, right-click the window and select Set Displa

Pagina 138

7 Analysis and EnhancementYouhavenowusedthe2-DHistogramblock to calculate the histogram of theR, G, and B values in an RGB image. For m ore informatio

Pagina 139 - Morphological Operations

8Example ApplicationsVideoandImageProcessingBlocksetblocksenableyoutotrackobjectsinanimage, stabilize a video stream, and compress images.Pattern Matc

Pagina 140 - Over view of Morphology

8 Example ApplicationsPattern MatchingPattern matching can be used to recognize and/or locate specific objects inan image. It can be accomplished usin

Pagina 141 - CountingObjectsinanImage

Pattern MatchingBlock Library QuantityVideo Viewer Video and Image ProcessingBlockset > Sinks1Data Type Conversion Simulink > Signal Attributes1

Pagina 142 - 6 Morphological Operations

8 Example Applications4 UsetheImageDataTypeConversionblock to convert the data type of thevideo to singl e- precision f loating point. Accept the d ef

Pagina 143

Pattern MatchingBecause you chose Valid for the Output size parameter, the blockoutputs only those parts of the correlation that are computed without

Pagina 144

8 Example Applications9 Use the Constant block to define the size of the image of the cat sculpture.Set the Constant value parameter tosingle([41 41])

Pagina 145

Pattern Matchingby single-p recision floating-point values, a value of 0 corresponds to blackand a value of 1 corresponds to wh ite.13 Connect the blo

Pagina 146

Key Blockset Con ceptsYou can choose to process the image as a multidimensional array by settingthe Im age signal parameter toOne multidimensional sig

Pagina 147

8 Example ApplicationsAs the video plays, you can watch the rectangular ROI follow the s culptureas it moves.In this example, you used the 2-D Correla

Pagina 148

Motion CompensationMotion CompensationMotion compensation is a set of techniques that take advantage of redundancyin consecutive video frames. The se

Pagina 149

8 Example ApplicationsThis demo model detects motio n by analyzing how much objects move betwee nconsecutive v ideo frames. The model aligns two seque

Pagina 150

Image CompressionImage CompressionThe examples in this section illustrate how to b uild a Simulink model that iscapable of image compression. For imag

Pagina 151 - 'disk',15)

8 Example ApplicationsImage Courtesy of MIT3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityI

Pagina 152

Image CompressionYou are nowready to set your block parameters by d ouble -clicking theblocks, modifying the blo ck parameter values, and clicking OK.

Pagina 153

8 Example ApplicationsThe Block Processing block’s subsystem opens.8-14

Pagina 154

Image CompressionYou can drag blocks into this subsystem to process the submatrices.8 Add the following blocks to your subsystem.Block Library Quantit

Pagina 155

8 Example Applications10 The 2-D DCT b lock takes the two-dimensional DCT of each submatrix. Thisprocess p uts m ost of the energy in the image into t

Pagina 156

Image CompressionYou are using the Selector block to compress the image by extracting theupper left corner of the submatrix, which contains the high e

Pagina 157 - Analysis and Enhancement

1 Gettin g StartedThe blocks that support multidimensional arrays meet at least one of thefollowing criteria:• They have the Image signal parameter on

Pagina 158 - Feature Extraction

8 Example ApplicationsViewing the Compressed ImageIn “Compre ssingan Image” on page 8-11, you compressed an image usingthe 2-D DCT and Selector blocks

Pagina 159

Image Compression4 Open the block’s subsystem by clicking Open Subsystem,andaddthefollowing blocks to it.Block Library QuantityImage Pad Video and Ima

Pagina 160 - 7 Analysis and Enhancement

8 Example Applications5 Connect the blocks as shown in the following figure.6 UsetheImagePadblocktozeropadthe4-by-4submatrixbacktoitsoriginal 8-by-8 s

Pagina 161

Image CompressionBecause z eros are replacing the low en ergy transform coefficients, theoutput image is an approximation of the original image.7 The

Pagina 162

8 Example Applications9 UsetheVideoViewerblocktoviewthecompressedimage. Acceptthedefault parameters.10 Connect the blocks as shown in the following fi

Pagina 163

Image CompressionThe compressed image is displayed in the Video Viewer window. Thecompressed i mage is not as clear as the original image. However, it

Pagina 164

8 Example Applicationsreference pages in the Video and Image P rocessing Blockset Reference.Forinformation on the Selector block, see the Simulink doc

Pagina 165 - Finding Lines in Images

IndexIndexAAccelerator mode 1-23adding periodic noise to a signal 7-41adjustingintensity image contrast 7-48RGB image contra st 7-53Adobe Acrobat Read

Pagina 166

Indexcontrastincreasing 2-27controlling video duration 1-22conventionscolumn-major format 1-21conversioncolor space 4-14intensity to binary 4-2R’G’B’

Pagina 167

Indexlines in images 7-9form of objects 6-2frequency distributionof elements in an image 7-59fspecial function 7-27Ggamma correction 4-14geometric tra

Pagina 168

Key Blockset Con cepts1-17

Pagina 169 - Zero-based

Indexinterpretation ofmatrices 1-11irregular illumination 6-11Kkey blockset concepts 1-11knowledgeuser’s expected 1-8Llabeling objects 6-3lightening i

Pagina 170

Indexinterpolation 5-2morphology 6-2VideoandImageProcessingBlockset 1-2Ppadding 7-41pattern matching 8-2performanceimproving 1-23periodic noiseremoval

Pagina 171

Indexsummary of morphology 6-2Ttechniquesmotion compensation 8-9sum of absolute differences (SAD) 8-9thresholding 6-11thresholding operation 4-2with u

Pagina 172

1 Gettin g StartedTo process the individual color planes of an image or video signal, set theImage signal parameter toSeparate color signal s in both

Pagina 173

Key Blockset Con ceptsIf you a re working with a block that only outpu ts multidimensional arrays,you can use the Selector block to separate the color

Pagina 174

1 Gettin g StartedFor pixel coordinates, the first comp onent r (the row) increases dow nward,while the second component c (the column) increases to t

Pagina 175

Key Blockset Con ceptspositions. Seco nd, the spatial coordinates of the cente r point of any p ix el areidentical to the pixel coordinates for that p

Pagina 176

Revision HistoryJuly 2004 First printing New for Version 1.0 (Release 14)October 2004 Second printing Revised for Version 1.0.1 (Release 14SP1)March 2

Pagina 177

1 Gettin g StartedThe Solver, w h ile in scheduler mode, uses a block’s sample time to determinewhen the code behind each block is executed. For examp

Pagina 178

Key Blockset Con ceptsNormal and Accelerator ModeThe Simulink Accelerator removes much of the computational overheadrequired by Simulink models. It wo

Pagina 179

1 Gettin g StartedFor more information, see “Simulink Accelerator” in the Simulinkdocumentation.Strategies for Real-Time Video ProcessingVideo process

Pagina 180

Key Blockset Con ceptsOptimizing Your ImplementationOptimizing your implementation is a crucial step toward real-time videoprocessing. The following t

Pagina 181

1 Gettin g StartedDeveloping Your ModelsUse the following g eneral process guidelines to develop real-time videoprocessing models to run on embedded t

Pagina 182

Key Blockset Con ceptsFor more information about Real-Time Workshop optimization parameters,see “Generated Source Files and File Dependencies” in the

Pagina 183 - Image Enhancement

1 Gettin g StartedBlock Data Type SupportThe following table shows what data types are accepted on the main inputdata port of each Video and Image Pro

Pagina 184

Block Data Type SupportBlock Double Single BooleanBaseIntegerFixed-Point2-D Variancexx s,us,uAutothresholdxx s,us,uBlob Analysisx (Output) x (Output)

Pagina 185 - Separate color signals

1 Gettin g StartedBlock Double Single BooleanBaseIntegerFixed-PointFind Local Maximaxx s,us,uFrame Rate Displayxxxs,us,uFrom Multimedia File This is a

Pagina 186

Block Data Type SupportBlock Double Single BooleanBaseIntegerFixed-PointProjectiveTransformationxxxs,us,uPSNRxx s,us,uRead Binary Files, uResizexx s,u

Pagina 188

1 Gettin g StartedImage CreditsThis table lists the copyright owners of the images used in the Video andImage Processing Block set docume ntation.Imag

Pagina 189

2Importing and ExportingVideoIn this chapter, you learn how to bring video data i nto a model, display it onyour monitor, and export it to an AVI or m

Pagina 190

2 Importing and Exporting VideoWorking with AVI FilesVideoandImageProcessingBlocksetenables you to work with video datawithin the Simulink environment

Pagina 191

Working with AVI Files2 Locate an AVI file that you want to import into Simulink. If you do nothave access to an AVI file, Video and Im age Processing

Pagina 192

2 Importing and Exporting Video6 Set the configuration parameters. Open the Configuration dialog box byselecting Simulation > Configuration Paramet

Pagina 193

Working with AVI FilesNote Thevideo that is d isplayed in the Video Viewer w indow runs as fastas Simulink processes the video frames. If you are on a

Pagina 194

2 Importing and Exporting Videoaudio associated with an AVI f il e, use the To Wave Device b lock in SignalProcessing Blockset.Note The Video Viewer b

Pagina 195

Working with AVI FilesBlock Library QuantityWrite AVI File Video and Image ProcessingBlockset > Sinks1Gain Simulink > Math Operation s23 Connect

Pagina 196

2 Importing and Exporting Video5 UsetheGain1blocktochangethebluevaluesofthevideostream.Settheblock parameters as follows:• Main pane, Gain =1.5• Signa

Pagina 197

Working with AVI FilesYou have now manipulated your video stream and exported it from a Simulinkmodel to an AVI fi le. For more information, see the W

Pagina 198

ContentsGetting Started1What Is Video andImage Processing Blockset?...1-2Installation... 1-3Installing Videoan

Pagina 199

2 Importing and Exporting VideoBlock Library QuantityFrom Mu lti m edia File Video and Image ProcessingBlockset > Sources1Insert TextVideoandImageP

Pagina 200

Working with AVI Files5 Click-and-drag the Frame Counter block from the demo model into yourmodel. This block counts the number of frames in an input

Pagina 201

2 Importing and Exporting Video9 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Sim

Pagina 202

Working with AVI FilesThe annotated video appears i n the Video Viewer1 window.You have now added descriptive text to a video stream. For more informa

Pagina 203

2 Importing and Exporting VideoBlock Library QuantityFrom Mu lti m edia File Video and Image ProcessingBlockset > Sources1Insert TextVideoandImageP

Pagina 204

Working with AVI FilesBy setting the Text parameter to 'Text posit ion: Row %d and Column%d', you are asking the block to replace each conv

Pagina 205

2 Importing and Exporting Video8 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Sim

Pagina 206

Working with AVI FilesAlternatively, you can input two string values at the Variables port.10 On the Insert Text block dialo g box, set the Text param

Pagina 207

2 Importing and Exporting VideoYou have now added descriptive text to a video stream. For more information,see the Insert Text block reference page in

Pagina 208

Working with AVI Files3 Use the From Multimedia File block to import a n AVI file into your model.Accept the default parameters.4 UsetheInsertTextbloc

Pagina 209

Importing and Exporting Video2Working w ith AVI Files ... 2-2Importing a nd Viewing AV I Files... 2-2Expor

Pagina 210

2 Importing and Exporting Video5 Double-click each Enabled Subsystem block, and click-and-drag one of theTo Multimedia File blocks into i t.6 Inside e

Pagina 211

Working with AVI Files8 Use the Counter block to count the number of video frames. You use thisinformation to specify which frames are sent to wh ich

Pagina 212

2 Importing and Exporting Video10 Use the Compare to Constant1 and Compare to Constant2 blocks to sendframes 10 to 19 to the s econd AVI file. Set the

Pagina 213

Working with AVI Files14 Set the configuration parameters. Open the Configuration dialog box byselecting Simulation > Configuration Parameters. Set

Pagina 214

2 Importing and Exporting Video16 View the resulting files by typing the following commands at the MATLABcommand prom pt:mplay output1.avimplay output

Pagina 215 - Pixel Statistics

Working with Multimedia FilesWorkingwithMultimediaFilesIf you are working on a Windows platform, Video and Image ProcessingBlockset contains blocks th

Pagina 216

2 Importing and Exporting Video2 Locate a m ultime dia file that you want to import in to Simulink. If you donot have access to a multimedia file, Vid

Pagina 217 - Separate color signa ls

Working with Multimedia Files• Stop time = 20• Type = Fi xed- step• Solver = discre te (no continuous states)7 Run your model.View your video in the T

Pagina 218

2 Importing and Exporting Video1 If the model you created in “Importing and Viewing Multimedia Files” onpage 2-25 is not open on your desktop, you can

Pagina 219

Working with Multimedia Files4 Use the To Multimedia File block to export the video to a multime dia file.Set the block parameters as follows:• Output

Pagina 220

Chroma Resampling ... 4-19Geometric Transformation5Interpolation Overview ... 5-2Nearest Neighbor

Pagina 221

2 Importing and Exporting VideoYou are now ready to set your block parameters by double-clicking theblocks, modifying the blo ck parameter values, and

Pagina 222

Working with Multimedia FilesYou have now manipulated y our video stream and exported it from a Simulinkmodel to a multimedia file. For more informati

Pagina 223 - Example Applications

2 Importing and Exporting Video3 Use the From Multimedia Fil e block to im port a multimedi a file into themodel. Accept the following default paramet

Pagina 224 - Pattern Matching

Working with Multimedia FilesThe From Multimedia File block inherits its sample time from vipmen.avi.Forvideosignals,thesampletimeisequivalenttothefra

Pagina 225

2 Importing and Exporting VideoTheframeperiodoftheaudiosignalmustmatchtheframeperiodofthevideo signals, which is 0.0333 seconds per frame. Since the f

Pagina 226 - 8 Example Applications

Working with Multimedia Files6 Set the configuration parameters. Open the Configuration dialog box byselecting Simulation > Configuration Parameter

Pagina 227

2 Importing and Exporting Video2-36

Pagina 228

3Working with MPlayThe MPlay GU I ena bles you to view videos that are repres ented as variablesin the MATLAB workspace. You can also use it to view v

Pagina 229 - Fixed-step

3 Working with MPlayViewing Videos from the MATLAB WorkspaceThe MPlay GU I ena bles you to view videos that are repres ented as variablesin the MATLAB

Pagina 230

Viewing Videos from the MATLAB WorkspaceNote The MPlay GUI supports M ATLAB variables that are in themovie structure array format. It also suppo rts t

Pagina 231 - Motion Compensation

Image Enhancem en t ... 7-27Sharpening and Blurring an Image... 7-27Removing Salt and Pepper Noise from Im

Pagina 232

3 Working with MPlay5 Experiment with using the MPlay GUI to play and interact with the videosequence. By default, the GUI assumes that the video data

Pagina 233 - Image Compression

Viewing Videos from the MATLAB WorkspaceFor more informatio n about the MPlay GUI, see the mplay function referencepage in the Video and Image Process

Pagina 234

3 Working with MPlayViewing Video FilesThe MPlay GUI enables you to view videos from files without having to loadall the video d ata into m emory at o

Pagina 235

Viewing Video Files3 Experiment with the MPlay GUI by using it to play and interact with thevideo stream.For more informatio n about the MPlay GUI, se

Pagina 236

3 Working with MPlayViewing Vide o Signals in SimulinkThe MPlay GUI enables you to view video signals in S imulink models withoutadding blocks to your

Pagina 237

Viewing Video Signals in SimulinkAlso, some new buttons appear above the video w indow.6 Change to floating-scope mode by clicking the button.7 Experi

Pagina 238

3 Working with MPlay3-10

Pagina 239

4ConversionsIn this chapter, you learn how to convert an intensity image to a binary imageandanRGBimagetoanintensityimage.Youalsolearnhowtodownsamplet

Pagina 240

4 ConversionsIntensitytoBinaryConversionBinary images contain Boolean pixel values that are either 0 or 1. Pixelswith the value 0 are displayed as bla

Pagina 241

Intensity to Binary Conversion3 Create a new Simulink model, and add to it the blocks shown in thefollowing table.Block Library QuantityImage FromWork

Pagina 242

1Getting StartedVideo and Image Processing Blockset is a tool for processing images andvideo in the Simulink® environment. This chapter provides an in

Pagina 243

4 Conversions5 Use the Image from Workspace block to import your image from theMATLAB workspace. Set the Value parameter toI6 Use the Video Viewer1 bl

Pagina 244

Intensity to Binary Conversion9 Use the Video Viewer b lock to view the binary ima ge. Accept the defaultparameters.10 Connect theblocks as shown in t

Pagina 245

4 Conversions11 Set the configuration parameters. Open the Configuration dialog box byselecting Configuration Parameters from the Simulation menu. Set

Pagina 246

Intensity to Binary ConversionNote A single threshold value was unable to effectively threshold thisimage due to its uneven lighting. For information

Pagina 247 - Accelerator mode 1-23

4 Conversions1 If the model you created in “Thresholding Intensity Images UsingRelational Ope rato rs” on page 4-2 is n ot open on your desktop, you c

Pagina 248

Intensity to Binary Conversion5 Connect the blocks as shown in the following figure.6 Use the Autothreshold block to perform a thresholding operation

Pagina 249

4 ConversionsThe block outputs the calculated threshold value at the Th port.7 From the Signal Processing Blockset library, and then from the SignalPr

Pagina 250 - Normal mode 1-23

Intensity to Binary Conversion8 Double-clicktheImageFromWorkspaceblock.OntheData Types pane,set the Output data type param eter todouble.9 If you have

Pagina 251

4 ConversionsThe binary image appears in the Video Viewer window.In the model window, the Display block shows the thres ho ld value,calculated by the

Pagina 252

Intensity to Binary ConversionYou have used the Autothreshold block to convert an intensity image to abinary image. For more information about this bl

Commenti su questo manuale

Nessun commento