Invert colors OpenCV Java Api

后端 未结 3 1276
逝去的感伤
逝去的感伤 2021-01-22 19:41

How do I invert the colors of an image stored in Mat image in the Java API of OpenCV? Using image.inv() gets me an error.

3条回答
  •  不要未来只要你来
    2021-01-22 20:09

    inv() method will try to take inverse of the matrix that's why it is failing (most probably your image matrix is not invertible).

    You can subtract two images from each other, so you can create an image with all values are 255 and then extract original one from it, if that is what you mean by invert the colors.

提交回复
热议问题