Partial convolution in MATLAB

I have a large matrix (image) and a small template. I would like to drill a small die with a larger die. For example, the blue area is the section that I want to use for folding. In other words, I can convolve the entire image, but as the cpu time increases, so I would just like to focus on the blue part I want.

Is there any command in MATLAB that can be used for this convolution? Or, how can I get the fold function to just use that particular irregular section for the fold.

enter image description here

+3


source to share


2 answers


I doubt you can do the wrong shape (fast convolution is done with a 2D FFT, which requires a square area). You can optimize it by finding a bounding box and thereby discarding the empty box.



0


source


@Nicole I would go for fft2 (im). * fft (smallIm) which is equivalent to conv2 (im, smallIm).
since irregular shape recognition you can use edge detection like canny and find the values โ€‹โ€‹of the most (left, right, top, bottom) points, since canny returns a binary (1,0) image and creates a bounding using the values. however, it will take some time to create.
and I'm not sure how much faster it will be.



0


source







All Articles