dst(x,y) = { 0 if src(x,y) > thresh src(x,y) otherwise }
I'm looking for:
dst(x,y) = { maxvalue if src(x,y) > thresh src(x,y) otherwise }
Is there an option like that?
If you use THRESH_BINARY
first, with a maxval of 1
then you will get a binary matrix with 0
s and 1
s. Call this matrix M
. It has a 1
where src(x,y) > thresh
and a 0
everywhere else.
Now compute
maxvalue * M + src * (1-M)
where *
is the element-wise matrix-product and 1-M
means a matrix with all 1
s minus M, ie invert the binary matrix M
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.