def iatoggle(f, f1, f2, OPTION="GRAY"): from ia870.iabinary import iabinary from ia870.iasubm import iasubm from ia870.iagray import iagray from ia870.iaunion import iaunion from ia870.iaintersec import iaintersec from ia870.ianeg import ianeg y = iabinary(iasubm(f, f1), iasubm(f2, f)) if OPTION.upper() == 'GRAY': t = iagray(y) y = iaunion(iaintersec(ianeg(t), f1), iaintersec(t, f2)) return y
def iahmax(f, h=1, Bc=iasecross()): from ia870.iasubm import iasubm from ia870.iainfrec import iainfrec g = iasubm(f, h) y = iainfrec(g, f, Bc) return y
def iaedgeoff(f, Bc=iasecross()): from ia870.iaframe import iaframe from ia870.iasubm import iasubm from ia870.iainfrec import iainfrec edge = iaframe(f) return iasubm( f, iainfrec(edge, f, Bc))
def iaregmax(f, Bc=iasecross()): from ia870.iasubm import iasubm from ia870.iahmax import iahmax from ia870.iabinary import iabinary from ia870.iaregmin import iaregmin from ia870.ianeg import ianeg y = iasubm(f, iahmax(f, 1, Bc)) return iabinary(y)
def iacloseth(f, b=None): from ia870.iasubm import iasubm from ia870.iaclose import iaclose from ia870.iasecross import iasecross if b is None: b = iasecross() y = iasubm(iaclose(f, b), f) return y
def iaopenrecth(f, bero=None, bc=None): from ia870.iasubm import iasubm from ia870.iaopenrec import iaopenrec from ia870.iasecross import iasecross if bero is None: bero = iasecross() if bc is None: bc = iasecross() y = iasubm(f, iaopenrec( f, bero, bc)) return y
def iaregmin(f, Bc=iasecross(), option="binary"): from ia870.iahmin import iahmin from ia870.iaaddm import iaaddm from ia870.iasubm import iasubm from ia870.iabinary import iabinary from ia870.iasuprec import iasuprec from ia870.iaunion import iaunion from ia870.iathreshad import iathreshad if option != "binary": raise Exception("iaregmin accepts only binary option") return iabinary(iasubm(iahmin(f,1,Bc), f))
def iacbisector(f, B, n): from ia870.iaintersec import iaintersec from ia870.iasesum import iasesum from ia870.iaero import iaero from ia870.iacdil import iacdil from ia870.iasubm import iasubm from ia870.iaunion import iaunion y = iaintersec(f, 0) for i in range(n): nb = iasesum(B, i) nbp = iasesum(B, i + 1) f1 = iaero(f, nbp) f2 = iacdil(f1, f, B, n) f3 = iasubm(iaero(f, nb), f2) y = iaunion(y, f3) return y
def iacthin(f, g, Iab=None, n=-1, theta=45, DIRECTION="CLOCKWISE"): from ia870.iaisbinary import iaisbinary from ia870.iasupgen import iasupgen from ia870.iainterot import iainterot from ia870.iaunion import iaunion from ia870.iasubm import iasubm from ia870.iaisequal import iaisequal from ia870.iahomothin import iahomothin if Iab is None: Iab = iahomothin() DIRECTION = DIRECTION.upper() assert iaisbinary(f), 'f must be binary image' if n == -1: n = product(f.shape) y = f old = y for i in range(n): for t in range(0, 360, theta): sup = iasupgen(y, iainterot(Iab, t, DIRECTION)) y = iaunion(iasubm(y, sup), g) if iaisequal(old, y): break old = y return y
def iacloserecth(f, bdil=iasecross(), bc=iasecross()): from ia870.iasubm import iasubm from ia870.iacloserec import iacloserec y = iasubm( iacloserec(f,bdil,bc), f) return y
def iasymdif(f1, f2): from ia870.iaunion import iaunion from ia870.iasubm import iasubm y = iaunion(iasubm(f1, f2), iasubm(f2, f1)) return y