反色的OpenCV的Java API [英] Invert colors OpenCV Java Api

查看:279
本文介绍了反色的OpenCV的Java API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何反转存储在垫图片的OpenCV的Java API中的图像的颜色吗?使用 image.inv()让我一个错误。

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.

推荐答案

INV()方法将尝试采取这就是为什么它是失败的矩阵的逆(最有可能图像矩阵不是可逆)。

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

您可以从彼此减去两个图像,因此所有的值是255,你可以创建一个图像,然后从中提取原始,如果你是倒置的颜色是什么意思。

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.

这篇关于反色的OpenCV的Java API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆