bitwise_not()을 사용하여 두 이미지 간의 비트 연결을 계산할 수 있습니다. org.opencv.core.Core 메소드 수업.
이 방법은 두 개의 매트 원본 및 대상 행렬을 나타내는 개체는 원본 행렬의 각 요소에 대한 역수를 계산하고 결과를 대상 행렬에 저장합니다.
예시
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
public class BitwiseNOTExample {
public static void main(String args[]) throws Exception {
//Loading the OpenCV core library
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
//Reading the Image
String file ="D://images//elephant.jpg";
Mat src = Imgcodecs.imread(file);
HighGui.imshow("Grayscale Image", src);
//Creating an empty matrix to store the result
Mat dst = new Mat(src.rows(), src.cols(), src.type());
//Applying bitwise not operation
Core.bitwise_not(src, dst);
HighGui.imshow("Bitwise NOT operation", dst);
HighGui.waitKey();
}
} 입력 이미지

출력
실행 시 위의 프로그램은 다음과 같은 창을 생성합니다. -
