Log in

View Full Version : mt_convolution: How do I keep negative results ?


Emulgator
8th March 2021, 14:51
From the few documentation lines:
If saturate is true, the result of the convolution is clipped to [0..255], else the absolute value of the result is clipped to [0..255].
I keep getting positive results only, no wonder, results are mapped onto a Y plane which can not go below Y=0.
Since I intend to do something with the negative results of a convolution I don't want any clipping to happen, rather shift zero plane to maybe +127 and map convolutions results onto that shifted plane.
Or is there a straighter way I overlooked ?

AVIL
19th March 2021, 00:13
Hi:

mt_convolution : clip c, string horizontal("1 1 1"), string vertical("1 1 1"), bool saturate(true), float total(1.0f)

An idea (not tested) : With saturate = true, either set the parameter "total" to a negative value, either create two simetrical parameters horizontal and vertical with the opposite values (same absolute value, opposite sign). Then, the former positive values becomes 0 and the negative ones are conservated.

feisty2
19th March 2021, 11:46
you need fp32 samples.