1
votes

Can't find Simulink block to perform blurring. May be it is intended to construct this functionality from existing blocks?

But straight approaches failed for me.

For example, the following model

enter image description here

causes an error

The dimension dependency rule specified for 'Test_Blur/2-D Convolution' is invalid. The input port 2 cannot have a fixed-size mode.

UPDATE

Matlab contains strange, hanging-in-the-air example vipeffects_win, which contains block named Effects but it does not work out of the box due to absence of 'imgSize` function.

1
What size and data types are the inputs to the 2-D convolution block? I don't know anything about computer vision, but looking at the doc, it seems that the inputs to the block must be 2 matrices of intensity values or planes of RGB video stream, of the same data type (floating-point, fixed-point, etc...). The output of the fspecial function, however, returns a 2-D filter, which I understand needs to be used with imfilter. Maybe that's the source of the error?am304
fspecial result is just a matrix, which I treat as convolution kernelSuzan Cioc
"Matlab contains strange, hanging-in-the-air example vipeffects_win, which contains block named Effects but it does not work out of the box due to absence of 'imgSize` function." This demo should work out of the box. It it doesn't, it's a bug and should be reported to MathWorks: mathworks.co.uk/support/service_requests/contact_support.doam304
The demo itself works, but if I take block from it and put it into my own model, it doesn't workSuzan Cioc
Where is the imgSize function used in the demo model? It might be worth checking the model callbacks in the demo to see if it gets defined there.am304

1 Answers

4
votes

imgSize is a variable defined in the model workspace. To avoid using it, you can simply look under the mask of the Effects subsystem. It's a block composed of smaller blocks. You can navigate under its mask and extract what you need.

Back to the original question: to blur, just use fspecial with the 2-D FIR block from the Filtering library. You can use a 2-D gaussian mask returned by the fspecial command or you can grab a 1-D filter and use the separable option on the 2-D FIR block in order to accelerate the computation since the 2-D gaussian is separable.