Figure 3.15 - Remove blobs touching the image frame
An example of the a-priori selection is the labeling algorithm where the marker is given by the first pixel in the image. Two further examples in this category are removing blobs from the image frame and hole filling. In both of these examples, the marker is placed at the image frame. Figure 3.15 illustrates the process to remove blobs connected to the image frame: (a) the input image, (b) the marker at the image frame, (c) the result of reconstruction, all blobs touching the image frame have been selected, and (d) the subtraction of the reconstructed image from the input image, which gives all blobs not connected to the marker.
1 import numpy as np 2 import ia870 as MT 3 4 A = adreadgray('blob3.tif') 5 F = MT.iaframe(A) 6 S = MT.iainfrec(F,A,MT.iasebox()) 7 Fs = MT.iaunion(MT.iagray(F),MT.iagray(A,'uint8',150)) 8 Sr = MT.iasubm(A,S) 9 10 adshow(MT.iapad(MT.ianeg(A)),'(a)') 11 adshow(MT.ianeg(Fs),'(b)') 12 adshow(MT.iapad(MT.ianeg(S)),'(c)') 13 adshow(MT.iapad(MT.ianeg(Sr)),'(d)')