MATLAB Image Processing and Video Blockset
MATLAB Image Processing and Video Blockset
WhatIsVideoandImageProcessingBlockset? Video and Image Processing Blockset is a tool used for the rapid design, prototyping, graphical simulation, and efficient code generation of video processingalgorithms.VideoandImageProcessingBlocksetblockscanimport streaming video into the Simulink environment and perform twodimensional filtering, geometric and frequency transforms, block processing, motion estimation,edgedetectionandothersignalprocessingalgorithms.Youcanalso use the blockset in conjunction with RealTime Workshop to automatically generate embeddable C code for realtime execution.Video and Image ProcessingBlocksetblockssupportfloatingpoint,integer,andfixedpointdata types. To use any data type other than doubleprecision and singleprecision floatingpoint,youmustinstallSimulinkFixedPoint.
1
Thisblocksetcanloadpapers.pngfilebydefault.Tochangeparametersvalue, youmustdoubleclickonthecomponent.
LoadNewImage
IfyouwanttoaccessaRGBlayer,inimagesignalcomboboxselectSeparate ColorSignalitem.
Afterthisstep,youhavethreeseparateRGBsignal.
Methodfordisplayinganimageorvideosignalsiseasyasloadingimage.Drag a Video Display component on the page. By default Input signal in this componentismultidimensionalsignal.Itmeansthatyoucanconnectanykind of multi dimensional signal to this component, and system can detect it automatically. If you need three separate RGB signal, go to properties and change the Image signal to Separated Color Signal, similar process to the previousstep. Nextstepiswiringthesetwocomponents.Connectsthecomponentsameas belowimage.AndpressF5toseetheresult.
3
Result:GrayScaleImage
Sample4:EmbeddingMatlabCodeinSimulink
AnEmbeddedMATLABFunctionblockletsyoucomposeaMATLABfunctionin Simulinklikethefollowingexample:
This capability is useful for coding algorithms that are better stated in the textual language of MATLAB than in the graphical language of Simulink. This block works with a subset of the MATLAB language called the Embedded MATLAB subset, which provides optimizations for generating efficient, productionqualityCcodeforembeddedapplications.
6
First of all, drag and drop Embedded Matlab Function on the page, and doubleclickonit.ItwillopenanewMatlabCodeEditor.Changethefunction content,accordingtotheRGBtoGrayScaleequation.
Afterthisstep,ifyouclosetheeditorpage,thecomponentschematicIO,will changeaccordingtothefunctioninputandoutputparameters.
DoubleClickonitand ChangetheCode
Homework1: DesignaprojectinSimulinkforloadinganddisplayinganimage,after that embed a Matlab Code for Image Thresholding. Only Display pixelsvaluesmallerthan127andfiltertherest.Thescaleisbetween 0and255.Assignzeroforthosepixelsvaluewhicharegreaterthan 127. Hint:Dontforgettochangethedatatypeparameterstouchar8.
ResultmustbesimilartothisImage. Reference:
MatlabRev.2007HelpandMathworksCompanyWebsite.
8