| [Top] [Up] [Prev] [Next] | [Up] [Tutorial] | mmtutor V1.0 30abr2001 |
mm020complement
f=imread('pcb_bin.tif');
mmshow(f);
fneg=mmneg(f);
mmshow(fneg);
|
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
|
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);
|
The duality between the Union and the Intersection is know as the De Morgan formula.

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
|
| [Top] [Up] [Prev] [Next] | [Up] [Tutorial] |
|
| Copyright (c) 1998-20001 by SDC Information SystemsCopyright (c) 1998-20001 by SDC Information Systems | ||