using convolution on a basic matrix block

2 views (last 30 days)
TZ
TZ on 17 Dec 2017
Edited: Matt J on 17 Dec 2017
Hi, In my program I have to use a mask and use conv2 on a big matrix (can be 20,000x20,000). this big matrix is built from smaller basic matrix, where i use the repmat to create the bigger one. I want to find a way to use conv2 on the smaller matix to save computing time and the use the repmat fuction. the problem is that the result in not the same even if I use 'same'. the reason is that at the boundries of the smaller matrix the mask only "feels" the end of the matrix thus the overlap becomes smaller, while in the bigger one the mask will also "feels" the continuation. I have thought of using a bigger basic matrix and after convolution take only the inner part of it and the duplicating it, but i fear of discontinuation. What I need is that the end of the top and bottom boundaries to be a continuation of each other, and the same goes for left and right boundaries. suggestions???

Answers (2)

Matt J
Matt J on 17 Dec 2017
Edited: Matt J on 17 Dec 2017

Image Analyst
Image Analyst on 17 Dec 2017
Not sure what you want. Do you want that the window shrinks as you get close to the edge? Or it pretends that there is data outside the image? Both conv2() and imfilter() have a number of options for handling computation near the edges. Perhaps you want the 'replicate', 'circular', or 'symmetric' option of imfilter().

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!