I'm trying to implement an algorithm that needs a circular sliding window, that goes through all the pixels of the image, and for each window I need to extract only pixels that lay on diameters at different angles of the circle.
I try to explain better with the use of the image above. Imagine that this is the result of a circular sliding window, I want to get only the pixel values that lay on the red line (diameter tilted of pi/8).
So far, I wrote these lines of code:
I= imread('lena.png');
I = im2double(I);
h = fspecial('disk',5);
h = h > 0;
dir = pi/8;
o_image = blockproc(I, [1 1], @(x) MMF2D(x,h,dir), 'BorderSize', [5 5],...
'TrimBorder', false, 'PadPartialBlocks', true);
and the function MMF2D
:
function [ o_pixel ] = MMF2D( i_block, i_window, i_directions)
%MMF2D Summary of this function goes here
% Detailed explanation goes here
new_block = i_block.data .* i_window;
But from here, I don't know how to continue for getting pixels that lay on diameter. The diameter can be tilted of any angle. Any help is greatly appreciated!