MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 Podręcznik Użytkownika

Przeglądaj online lub pobierz Podręcznik Użytkownika dla Oprogramowanie MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3. MATLAB VIDEO AND IMAGE PROCESSING BLOCKSET 3 User`s guide Instrukcja obsługi

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 252
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów

Podsumowanie treści

Strona 1 - User’s Guide

VideoandImageProcessing Blockset 2User’s Guide

Strona 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

Strona 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

Strona 4

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

Strona 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

Strona 6 - Conversions

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

Strona 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

Strona 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

Strona 9 - Getting Started

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

Strona 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

Strona 11 - Installation

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

Strona 12

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

Strona 13 - Product Demos

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

Strona 14

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

Strona 15 - Viewing the Documentation

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

Strona 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

Strona 17 - What Chapter Should I Read?

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

Strona 18

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

Strona 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

Strona 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

Strona 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

Strona 22

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

Strona 23 - From File block dialog box

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 28

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

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

Strona 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

Strona 31 - Normal and Accelerator Mode

5 Geometri c TransformationImage Courtesy of Michael Myers5-14

Strona 32

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

Strona 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

Strona 34

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

Strona 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

Strona 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

Strona 37

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

Strona 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

Strona 39

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

Strona 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

Strona 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

Strona 42 - Working with AVI Files

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

Strona 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

Strona 44

5 Geometri c Transformation5-26

Strona 45

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 50 - Intensity

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

Strona 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

Strona 52

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

Strona 53

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

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

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

Strona 55 - %d'

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

Strona 56

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

Strona 57 - '%s region

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

Strona 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

Strona 59 - 'Frame %d'

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

Strona 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

Strona 61

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

Strona 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

Strona 63

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

Strona 64

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

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

Strona 66 - Separate color signals

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

Strona 67 - Exportin

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

Strona 68

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 76

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

Strona 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

Strona 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

Strona 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

Strona 80

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

Strona 81

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

Strona 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

Strona 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

Strona 84

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 90

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

Strona 91 - Connect the

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

Strona 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

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

Strona 94

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

Strona 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

Strona 96

Image EnhancementBlock Library QuantityImage FromWorkspaceVideoandImageProcessingBlockset>Sources1Color SpaceConversionVideoandImageProcessingBlock

Strona 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

Strona 98

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

Strona 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

Strona 100 - Color Space Conversion

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

Strona 101

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

Strona 102 - 4 Conversions

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

Strona 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

Strona 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

Strona 105 - Chroma Resampling

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

Strona 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

Strona 107 - No pad ding

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

Strona 108

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

Strona 109

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

Strona 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

Strona 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

Strona 112

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

Strona 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

Strona 114 - Interpolation Overview

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

Strona 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

Strona 116 - 5 Geometri c Transformation

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 123

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

Strona 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

Strona 125 - Resizing an Image

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

Strona 126

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

Strona 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

Strona 128

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

Strona 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

Strona 130

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

Strona 131

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

Strona 132 - Cropping an Image

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

Strona 133

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

Strona 134

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

Strona 135

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

Strona 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

Strona 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

Strona 138

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

Strona 139 - Morphological Operations

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

Strona 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

Strona 141 - CountingObjectsinanImage

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

Strona 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

Strona 143

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

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

Strona 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

Strona 146

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

Strona 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

Strona 148

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

Strona 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

Strona 150

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

Strona 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

Strona 152

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

Strona 153

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

Strona 154

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 159

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

Strona 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

Strona 161

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

Strona 162

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

Strona 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

Strona 164

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

Strona 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

Strona 166

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

Strona 167

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

Strona 168

Key Blockset Con cepts1-17

Strona 169 - Zero-based

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

Strona 170

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

Strona 171

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 178

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

Strona 179

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

Strona 180

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

Strona 181

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

Strona 182

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

Strona 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

Strona 184

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

Strona 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

Strona 186

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

Strona 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

Strona 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

Strona 190

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

Strona 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

Strona 192

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

Strona 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

Strona 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

Strona 195

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

Strona 196

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

Strona 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

Strona 198

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

Strona 199

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

Strona 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

Strona 201

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

Strona 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

Strona 203

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

Strona 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

Strona 205

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

Strona 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

Strona 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

Strona 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

Strona 209

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

Strona 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

Strona 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

Strona 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

Strona 213

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

Strona 214

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

Strona 215 - Pixel Statistics

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 220

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

Strona 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

Strona 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

Strona 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

Strona 224 - Pattern Matching

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

Strona 225

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

Strona 226 - 8 Example Applications

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

Strona 227

2 Importing and Exporting Video2-36

Strona 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

Strona 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

Strona 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

Strona 231 - Motion Compensation

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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 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

Strona 238

3 Working with MPlay3-10

Strona 239

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

Strona 240

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

Strona 241

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

Strona 242

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

Strona 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

Strona 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

Strona 245

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

Strona 246

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

Strona 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

Strona 248

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

Strona 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

Strona 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

Strona 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

Strona 252

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

Komentarze do niniejszej Instrukcji

Brak uwag