Hit and miss transformation. Hit and miss array masks must not overlap.
function call:
[out_img1]=vsg('HitAndMiss',in_img1,conv_arr1,conv_arr2);
Arguments:
in_img1
mask image, 3 channel RGB, 1 channel greyscale or binary image, or DICOM
image.
conv_arr1
– the “hit” array specifying the mask
with which the input image will be processed.
conv_arr2
– the “miss” array specifying the mask
with which the input image will be processed.
Description:
The HitAndMiss morphological transform is used to select pixels with
certain geometric properties (e.g. corners) while ignoring others.
out_img1
– An image which
has dimensions the same as the input image. This is the result of
finding the “hit” and “miss values.
Example:
img = imread('A.jpg');
[out_img1]=vsg('Threshold',img,100);
h=figure;image(uint8(out_img1));set(h,'Name','Threshold');
H1 = [0,1,0;
0,1,1;
0,0,0];
H2 = [0,0,0;
1,1,0;
0,1,0];
H3 = [0,1,0;
1,1,0;
0,0,0];
H4 = [0,0,0;
0,1,1;
0,1,0];
M1 =[0,0,0;
1,0,0;
1,1,0];
M2 =[0,1,1;
0,0,1;
0,0,0];
M3 =[0,0,0;
0,0,1;
0,1,1];
M4 =[1,1,0;
1,0,0;
0,0,0];
[out_img2]=vsg('HitAndMiss',out_img1,H1,M1);
[out_img3]=vsg('HitAndMiss',out_img1,H2,M2);
[out_img4]=vsg('HitAndMiss',out_img1,H3,M3);
[out_img5]=vsg('HitAndMiss',out_img1,H4,M4);
[out_img6]=vsg('OR',out_img2,out_img3);
[out_img6]=vsg('OR',out_img6,out_img4);
[out_img6]=vsg('OR',out_img6,out_img5);
h=figure;image(uint8(out_img6));set(h,'Name','HitAndMiss');
Notes:
1. For DICOM images, the function operates on all slices separately.
2. For RGB images, the function operates on all colour planes
separately.