Can we use biger stride than 1 in Conv2, Convn, Imfilter ?
5 views (last 30 days)
Show older comments
Naveed Khan
on 10 Dec 2015
Edited: Matti Kaupenjohann
on 12 Apr 2021
Hi, I want to use conv2, convn, or Imfilter to filter an image, but i want to stride more than 1, So that to have a reduced output filtered image. How can i do that with builtin matlab functions.
0 Comments
Accepted Answer
Image Analyst
on 10 Dec 2015
If you don't want to slide over one pixel, then you can either do the whole thing and subsample the result,
smallResults = fullSizeResult(1:4:end, 1:8:end);
Adjust the step value to whatever you want the jump to be.
Alternatively you can use blockproc(), and I'm attaching some demos for that. blockproc() allows you to scan along your image in "jumps" of a specified step (distance) and process only those window locations.
7 Comments
Image Analyst
on 16 Aug 2018
No, not right. You can specify both the "jump" distance and the overlap independently. See my attached demo.
Matti Kaupenjohann
on 12 Apr 2021
Edited: Matti Kaupenjohann
on 12 Apr 2021
I found this conversation -- while I was looking for a faster implementation for my code -- and was using blockproc before, so I timed it again, but since it was very slow I decided to create my structure by myself and used mexfun. Still not impressing 0.356 seconds for my code but much faster than the 1.6 seconds with blockproc implementation.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!