% This program finds edges in a grayscale image.
Picture = double(imread("Arm_Fracture.jpg")); % load the image as a double
if length(size(Picture)) == 2
NewImage = uint8(filter(Picture));
else
RedImage = filter(Picture(:,:,1));
BlueImage = filter(Picture(:,:,2));
GreenImage = filter(Picture(:,:,3));
NewImage = scale(0.299 * RedImage + 0.587 * BlueImage + 0.114 * GreenImage);
NewImage = uint8(NewImage);
end
% display it
imshow(NewImage)
function NewImage = filter(Pic2)
x_filter = [ -1, 0, 1; -1, 0, 1; -1, 0, 1 ]; % the vertical edge filter