org.opencv.core.Core.bitwise_not()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(278)

本文整理了Java中org.opencv.core.Core.bitwise_not()方法的一些代码示例,展示了Core.bitwise_not()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Core.bitwise_not()方法的具体详情如下:
包路径:org.opencv.core.Core
类名称:Core
方法名:bitwise_not

Core.bitwise_not介绍

[英]Inverts every bit of an array.

The function calculates per-element bit-wise inversion of the input array:

dst(I) = !src(I)

In case of a floating-point input array, its machine-specific bit representation (usually IEEE754-compliant) is used for the operation. In case of multi-channel arrays, each channel is processed independently.
[中]反转数组的每一位。
该函数计算输入数组的每元素逐位反转:
dst(I)=!src(一)
对于浮点输入数组,其机器特定位表示(通常符合IEEE754)用于操作。对于多通道阵列,每个通道都是独立处理的。

代码示例

代码示例来源:origin: nroduit/Weasis

  1. public static ImageCV invertLUT(ImageCV source) {
  2. Objects.requireNonNull(source);
  3. Core.bitwise_not(source, source);
  4. return source;
  5. }

代码示例来源:origin: RaiMan/SikuliX2

  1. private Mat doFindMatch(Element target, Mat mBase, Element probe) {
  2. if (SX.isNull(probe)) {
  3. probe = target;
  4. }
  5. Mat mResult = Element.getNewMat();
  6. Mat mProbe = probe.getContentBGR();
  7. if (!target.isPlainColor()) {
  8. if (probe.hasMask()) {
  9. Mat mMask = matMulti(probe.getMask(), mProbe.channels());
  10. Imgproc.matchTemplate(mBase, mProbe, mResult, Imgproc.TM_CCORR_NORMED, mMask);
  11. } else {
  12. Imgproc.matchTemplate(mBase, mProbe, mResult, Imgproc.TM_CCOEFF_NORMED);
  13. }
  14. } else {
  15. Mat mBasePlain = mBase;
  16. Mat mProbePlain = mProbe;
  17. if (target.isBlack()) {
  18. Core.bitwise_not(mBase, mBasePlain);
  19. Core.bitwise_not(mProbe, mProbePlain);
  20. }
  21. if (probe.hasMask()) {
  22. Mat mMask = matMulti(probe.getMask(), mProbe.channels());
  23. Imgproc.matchTemplate(mBasePlain, mProbePlain, mResult, Imgproc.TM_SQDIFF_NORMED, mMask);
  24. } else {
  25. Imgproc.matchTemplate(mBasePlain, mProbePlain, mResult, Imgproc.TM_SQDIFF_NORMED);
  26. }
  27. Core.subtract(Mat.ones(mResult.size(), CvType.CV_32F), mResult, mResult);
  28. }
  29. return mResult;
  30. }

代码示例来源:origin: nroduit/Weasis

  1. private static void exludePaddingValue(Mat src, Mat mask, int paddingValue, int paddingLimit) {
  2. Mat dst = new Mat();
  3. Core.inRange(src, new Scalar(paddingValue), new Scalar(paddingLimit), dst);
  4. Core.bitwise_not(dst, dst);
  5. Core.add(dst, mask, mask);
  6. }

代码示例来源:origin: com.sikulix/sikulixapi

  1. private Core.MinMaxLocResult doFindMatch(Mat base, Mat probe) {
  2. Mat res = new Mat();
  3. Mat bi = new Mat();
  4. Mat pi = new Mat();
  5. if (!isPlainColor) {
  6. Imgproc.matchTemplate(base, probe, res, Imgproc.TM_CCOEFF_NORMED);
  7. } else {
  8. if (isBlack) {
  9. Core.bitwise_not(base, bi);
  10. Core.bitwise_not(probe, pi);
  11. } else {
  12. bi = base;
  13. pi = probe;
  14. }
  15. Imgproc.matchTemplate(bi, pi, res, Imgproc.TM_SQDIFF_NORMED);
  16. Core.subtract(Mat.ones(res.size(), CvType.CV_32F), res, res);
  17. }
  18. return Core.minMaxLoc(res);
  19. }

代码示例来源:origin: openpnp/openpnp

  1. Core.bitwise_not(mask, mask);

代码示例来源:origin: openpnp/openpnp

  1. Core.bitwise_not(mask, mask);

代码示例来源:origin: openpnp/openpnp

  1. @Override
  2. public Result process(CvPipeline pipeline) throws Exception {
  3. Mat mat = pipeline.getWorkingImage();
  4. Mat mask = mat.clone();
  5. Mat masked = mat.clone();
  6. Scalar color = FluentCv.colorToScalar(Color.black);
  7. mask.setTo(color);
  8. masked.setTo(color);
  9. Imgproc.circle(mask, new Point(mat.cols() / 2, mat.rows() / 2), Math.abs(diameter) / 2, new Scalar(255, 255, 255), -1);
  10. if(diameter < 0) {
  11. Core.bitwise_not(mask,mask);
  12. }
  13. mat.copyTo(masked, mask);
  14. mask.release();
  15. return new Result(masked);
  16. }
  17. }

代码示例来源:origin: openpnp/openpnp

  1. @Override
  2. public Result process(CvPipeline pipeline) throws Exception {
  3. Mat mat = pipeline.getWorkingImage();
  4. Mat mask = mat.clone();
  5. Mat masked = mat.clone();
  6. Scalar color = FluentCv.colorToScalar(Color.black);
  7. mask.setTo(color);
  8. masked.setTo(color);
  9. // FCA Change to have the possibility to work inside the interval or outside (when min>max)
  10. Scalar min;
  11. Scalar max;
  12. if (hueMin <= hueMax) {
  13. min = new Scalar(hueMin, saturationMin, valueMin);
  14. max = new Scalar(hueMax, saturationMax, valueMax);
  15. }
  16. else {
  17. min = new Scalar(hueMax, saturationMin, valueMin);
  18. max = new Scalar(hueMin, saturationMax, valueMax);
  19. }
  20. Core.inRange(mat, min, max, mask);
  21. if (hueMin <= hueMax) {
  22. Core.bitwise_not(mask, mask);
  23. }
  24. mat.copyTo(masked, mask);
  25. return new Result(masked);
  26. }
  27. }

代码示例来源:origin: openpnp/openpnp

  1. @Override
  2. public Result process(CvPipeline pipeline) throws Exception {
  3. Mat mat = pipeline.getWorkingImage();
  4. Mat mask = mat.clone();
  5. Mat masked = mat.clone();
  6. Scalar color = FluentCv.colorToScalar(Color.black);
  7. mask.setTo(color);
  8. masked.setTo(color);
  9. Point low = new Point(mat.cols() / 2 - getWidth() / 2, mat.rows() / 2 - getHeight() / 2);
  10. Point high = new Point(mat.cols() / 2 + getWidth() / 2, mat.rows() / 2 + getHeight() / 2);
  11. Imgproc.rectangle(mask, low, high, new Scalar(255, 255, 255), -1);
  12. if (getWidth() * getHeight() < 0) {
  13. Core.bitwise_not(mask, mask);
  14. }
  15. mat.copyTo(masked, mask);
  16. mask.release();
  17. return new Result(masked);
  18. }
  19. }

相关文章

Core类方法