Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Take every Nth element of a matrix

$
0
0
I am trying to create a block average filter of an image. In Matlab my code looks like: ba=4; %block average block size B = ones(ba)/ba^2; out1 = conv2(double(rgb_img(:,:,1))/255,B,'valid'); out1 = out1(1:ba:end,1:ba:end); out2 = conv2(double(rgb_img(:,:,2))/255,B,'valid'); out2 = out2(1:ba:end,1:ba:end); out3 = conv2(double(rgb_img(:,:,3))/255,B,'valid'); out3 = out3(1:ba:end,1:ba:end); I know how to do the first step using filter2D how do I do the second step (take every 4th element)

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>