Ask Your Question
0

How to reverse foreground color and background color on mask ?

asked 2018-02-15 14:47:20 -0500

generator gravatar image

updated 2018-02-15 14:50:19 -0500

Hello guys. I have a mask like this :

I want to reverse background color and foreground color for using Morphological Transformations on my image

image description

Before

Background-color:Dark
Foreground color-White

After

Background-color:White
Foreground color-Dark


background[np.where((background > [0,0,0]).all(axis = 2))] =[255,255,255]

I write piece of code on phyton but i can't implement this code on javascript.How can i do with javascript?

edit retag flag offensive close merge delete

Comments

1

simply invert the Image using bitwise_not

Balaji R gravatar imageBalaji R ( 2018-02-16 00:28:13 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-05-15 16:01:13 -0500

kpachinger gravatar image

THRESHOLD_BINARY_INV

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-02-15 14:47:20 -0500

Seen: 1,515 times

Last updated: May 15 '20