Study Dip 13th dayThe opening crap .
In short, the so-called open operation and closed operation is to combine the corrosion and expansion, the first corrosion after the expansion is open, after the expansion of corrosion is off, as to why is open why is off, I can not remember at the beginning, I remember the teacher did not tell me why call Open, why called closed, but in the following introduction, will give the reason
Mathematical Principles
Well, the formula is not ready ...
Propertiesopen operation, usually smooth the outline of the object, the narrower narrow neck (slender white lines), so called Open, and eliminate small protrusion. closed operation, the general will also smooth the outline of the object, but in contrast to the open operation, bridging the narrower gaps and slender ravines, so called closed, eliminating small voids, filling the contour of the break. all the so-called thin and narrow are compared to the structural element se, so the key is SE. idempotent (idempotent): is when the same se on the image to do open (closed) operation, do once and do multiple times, the result is the same. CodeThe code, which is entirely based on corrosion and expansion of the operation, wherein the corrosion and expansion of the concrete implementation, see the previous section:
Open operation Void Open (Iplimage *src,iplimage *dst,iplimage *se,position *center) { Erode (src, DST, SE, center); Dilate (DST, DST, SE, center);} Off operation Void Close (Iplimage *src,iplimage *dst,iplimage *se,position *center) { dilate (src, DST, SE, center); Erode (DST, DST, SE, center); }
Resultsall of the following results of SE are 3x3 all 1, center is the middle element, that is, SE is isotropic. Open Operation: The original image on the left, the left is open operation results, the right is open operation results and the difference between the original, it can be seen that the small white protrusions, slender lines were disposed of, while the narrow Black Gully is retained:
closed operation: The upper left is the original, the left is closed operation results, the upper right is the original and closed operation results of the difference. It can be seen that the original black strips (i.e. black ravines) are filled, but the white projection points are retained.
The following is a Lenna diagram with a threshold value of 100:Open Results for Lena:
close result of Lena
Binary image-Morphological processing 3 open operation and closed operation