c++ - Image processing with openCV, color change -
i doing image processing , have black shape on white image. use findcontours()
need white shape on black image.
- is there way change opencv settings track black shapes on white background instead ?
- i managed find white part of image using
inrange()
change other color, change black part white, , again first part black usinginrange()
. there easier way convert black white , white black on image @ same time ?
starting binary_image
of type cv_8uc1
:
you can use
binary_not
(as suggested @zdar):binary_not(binary_image, binary_image);
invert values aritmtetic operation (as suggested @sunreef):
binary_image = 255 - binary_image;
or use not logical operator
~
.binary_image = ~binary_image;
this can nice shortcut if need invert values particular function, e.g.:
findcontours(~binary_image, ... );
Comments
Post a Comment