Invert colors OpenCV Java Api

后端 未结 3 1252
逝去的感伤
逝去的感伤 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:15

    Just in case:

    Mat invertcolormatrix= new Mat(image.rows(),image.cols(), image.type(), new Scalar(255,255,255));
    
    Core.subtract(invertcolormatrix, image, image);
    

提交回复
热议问题