rand
rand

Reputation: 515

What does the symbol '~' mean in MATLAB when I use it before an image?

What does ~ mean when I use it before an image?

For example:

K = bwmorph(~J,'thin','inf');

Where J is a binary image.

Upvotes: 1

Views: 186

Answers (2)

fpe
fpe

Reputation: 2750

It is a logical not.

For more detail, please type in

doc ~

EDIT

bwmorph(BW,operation)

works explicitely on binary images, therefore ~BW only implies that zeros are position-changed with one, as some of the other members pointed out.

Please check this out:

A = eye(5)

~A

In your case, black will turn into white and viceversa.

Upvotes: 2

rajb245
rajb245

Reputation: 250

It's the logical not operator in MATLAB. Read more in the MATLAB help:

help not

In your case, it basically inverts the colors of your binary image. This is because not(1) = 0 and not(0) = 1, with the usual interpretations about 0/1 vs. false/true.

Upvotes: 4

Related Questions