คุณสามารถคำนวณการเชื่อมระดับบิตระหว่างสองภาพโดยใช้ bitwise_not() วิธีการของ org.opencv.core.Core ชั้นเรียน
วิธีนี้ยอมรับ Mat . สองตัว ออบเจ็กต์ที่เป็นตัวแทนของเมทริกซ์ต้นทางและปลายทาง คำนวณค่าผกผันของแต่ละองค์ประกอบในเมทริกซ์ต้นทางและเก็บผลลัพธ์ไว้ในเมทริกซ์ปลายทาง
ตัวอย่าง
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();
}
} ใส่รูปภาพ

ผลลัพธ์
ในการดำเนินการ โปรแกรมดังกล่าวจะสร้างหน้าต่างต่อไปนี้ -
