MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 User's Guide

Browse online or download User's Guide for Software MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3. MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 User`s guide User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 252
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews

Summary of Contents

Page 1 - User’s Guide

VideoandImageProcessing Blockset 2User’s Guide

Page 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

Page 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

Page 4

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

Page 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

Page 6 - Conversions

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

Page 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

Page 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

Page 9 - Getting Started

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

Page 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

Page 11 - Installation

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

Page 12

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

Page 13 - Product Demos

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

Page 14

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

Page 15 - Viewing the Documentation

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

Page 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

Page 17 - What Chapter Should I Read?

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

Page 18

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

Page 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

Page 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

Page 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

Page 22

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

Page 23 - From File block dialog box

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

Page 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

Page 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

Page 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

Page 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

Page 28

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

Page 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,

Page 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

Page 31 - Normal and Accelerator Mode

5 Geometri c TransformationImage Courtesy of Michael Myers5-14

Page 32

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

Page 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

Page 34

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

Page 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

Page 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

Page 37

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

Page 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

Page 39

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

Page 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

Page 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

Page 42 - Working with AVI Files

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

Page 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

Page 44

5 Geometri c Transformation5-26

Page 45

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

Page 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

Page 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

Page 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

Page 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

Page 50 - Intensity

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

Page 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

Page 52

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

Page 53

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

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

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

Page 55 - %d'

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

Page 56

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

Page 57 - '%s region

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

Page 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

Page 59 - 'Frame %d'

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

Page 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

Page 61

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

Page 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

Page 63

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

Page 64

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

Page 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.

Page 66 - Separate color signals

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

Page 67 - Exportin

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

Page 68

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 76

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

Page 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

Page 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

Page 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

Page 80

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

Page 81

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

Page 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

Page 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

Page 84

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 90

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

Page 91 - Connect the

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

Page 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

Page 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,

Page 94

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

Page 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

Page 96

Image EnhancementBlock Library QuantityImage FromWorkspaceVideoandImageProcessingBlockset>Sources1Color SpaceConversionVideoandImageProcessingBlock

Page 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

Page 98

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

Page 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

Page 100 - Color Space Conversion

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

Page 101

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

Page 102 - 4 Conversions

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

Page 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

Page 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

Page 105 - Chroma Resampling

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

Page 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

Page 107 - No pad ding

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

Page 108

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

Page 109

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

Page 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

Page 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

Page 112

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

Page 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

Page 114 - Interpolation Overview

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

Page 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

Page 116 - 5 Geometri c Transformation

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 123

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

Page 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

Page 125 - Resizing an Image

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

Page 126

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

Page 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

Page 128

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

Page 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

Page 130

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

Page 131

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

Page 132 - Cropping an Image

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

Page 133

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

Page 134

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

Page 135

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

Page 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

Page 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

Page 138

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

Page 139 - Morphological Operations

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

Page 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

Page 141 - CountingObjectsinanImage

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

Page 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

Page 143

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

Page 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])

Page 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

Page 146

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

Page 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

Page 148

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

Page 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

Page 150

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

Page 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

Page 152

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

Page 153

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

Page 154

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

Page 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

Page 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

Page 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

Page 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

Page 159

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

Page 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

Page 161

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

Page 162

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

Page 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

Page 164

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

Page 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

Page 166

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

Page 167

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

Page 168

Key Blockset Con cepts1-17

Page 169 - Zero-based

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

Page 170

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

Page 171

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 178

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

Page 179

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

Page 180

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

Page 181

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

Page 182

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

Page 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

Page 184

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

Page 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

Page 186

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

Page 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

Page 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

Page 190

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

Page 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

Page 192

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

Page 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

Page 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

Page 195

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

Page 196

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

Page 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

Page 198

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

Page 199

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

Page 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

Page 201

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

Page 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

Page 203

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

Page 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

Page 205

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

Page 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

Page 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

Page 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

Page 209

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

Page 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

Page 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

Page 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

Page 213

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

Page 214

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

Page 215 - Pixel Statistics

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

Page 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

Page 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

Page 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

Page 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

Page 220

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

Page 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

Page 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

Page 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

Page 224 - Pattern Matching

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

Page 225

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

Page 226 - 8 Example Applications

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

Page 227

2 Importing and Exporting Video2-36

Page 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

Page 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

Page 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

Page 231 - Motion Compensation

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 238

3 Working with MPlay3-10

Page 239

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

Page 240

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

Page 241

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

Page 242

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

Page 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

Page 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

Page 245

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

Page 246

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

Page 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

Page 248

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

Page 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

Page 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

Page 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

Page 252

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

Comments to this Manuals

No comments