7x7 Core Prewitt

I'm pretty new image processing and want to do filtering using the larger Prewitt core. The problem is, I can't find anything more than a 3x3 core on wikipedia. I have also seen a 4x4 core in the class presentation but am completely at a loss as to how this was evaluated. Can anyone help me?

+3


source to share


1 answer


This does not directly answer your question, but I came across this for a while and it might be of interest as it follows @ AnonSubmitter85's comment.

Based on the article that can be found here , there are many ways to define a kernel of a given size, as they are used to describe polynomials (or linear combinations of polynomials) that describe the functions from which directional derivatives of an image are calculated. I admit that I do not understand everything, anyway, these are possible windows that can be created for kernels of size

1) 3x3

enter image description here

or



2) 4x4

enter image description here

So, I think there is no single 7x7 kernel that can be computed. Since Sobel and Prewitt are very similar to each other, there is a presentation on File Sharing that might interest you. Here's some code that's pretty short. It creates a generic Sobel filter of any size (I don't have any advantage to it, I just paste the code to make it easier for you :).

%Program for creating generalised Sobel operator
%Authors : Jeny Rajan, K.Kannan
%Medical Imaging Research Group, NeST, Trivandrum 
%http://jenyrajan.googlepages.com/
%http://kannan.keizer.googlepages.com/kannankeizer 

%This program can be used to generate sobel filter of any order
% Usage  [E Mx My]=Gsobel(img,Wsize)
% eg. [E Mx My]=Gsobel(img,5)
% E - Resultant Edge image generated with sobel filter of window size Wsize
% Mx & My  - Horizontal and Vertical Masks 
% img - input image
% Wsize - Filter window size

function [E Mx My]= GSobel(img,Wsize)
for i=1:Wsize
    Sx(i)=factorial((Wsize-1))/((factorial((Wsize-1)-(i-1)))*(factorial(i-1)));
    Dx(i)=Pasc(i-1,Wsize-2)-Pasc(i-2,Wsize-2);
end
Sy=Sx';
Dy=Dx';
Mx=Sy(:)*Dx;
My=Mx';
Ey=imfilter(double(img),My,'symmetric');
Ex=imfilter(double(img),Mx,'symmetric');
E=sqrt(Ex.^2+Ey.^2);
figure,imshow(img,[]),title('Original Image');
figure,imshow(E,[]),title('Edge Image');

function P=Pasc(k,n)
if (k>=0)&&(k<=n)
    P=factorial(n)/(factorial(n-k)*factorial(k));
else
    P=0;
end

      

Sorry if my answer is rather long and doesn't really solve your problem, but that was too long for a comment! Hope it helps.

+1


source







All Articles