[Top] [Up] [Prev] [Next] [Up] [Tutorial] mmtutor V1.0 30abr2001

mm020complement - Complement and Duality.


Synopsis
mm020complement
Description

Complement or Negation

f=imread('pcb_bin.tif');
mmshow(f);
fneg=mmneg(f);
mmshow(fneg);
image
(f)
image
(fneg)

The data type and Negation

The example below presents an application of this function for different data types. Note that the result of this operation changes with the data type used.

mmneg(mmbinary(uint8([0 0 1 1])))

ans =
     1     1     0     0
mmneg(uint8([ 0 1 2 3]))

ans =
   255   254   253   252
mmneg(uint16([ 0 1 2 3]))

ans =
       65535       65534       65533       65532

Processing only a Region of Interest (ROI)

In this example, we read an image and store it in f1, create a subimage of f1 from a region of interest (i.e., f1(11:30,21:40)), complement the subimage, copy the complemented subimage in f1 and, finally, display the new f1 :

f1 = imread('ggray.tif');
mmshow(f1);
f1(11:30,21:40) = mmneg(f1(11:30,21:40));
mmshow(f1);
image
(f1)
image
(f1)

Duality between Union and Intersection

The duality between the Union and the Intersection is know as the De Morgan formula.

equation

f1 = imread('form-1.tif');
f2 = imread('form-ok.tif');
mmshow(f1);
mmshow(f2);
fu=mmunion(f1,f2);
mmshow(fu);
mmisequal(fu, mmneg(mmintersec(mmneg(f1),mmneg(f2))))

ans =
     1
image
(f1)
image
(f2)
image
(fu)

Exercises


[Top] [Up] [Prev] [Next] [Up] [Tutorial] Valid XHTML 1.0!
Copyright (c) 1998-20001 by SDC Information SystemsCopyright (c) 1998-20001 by SDC Information Systems