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

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

本文整理了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

public static ImageCV invertLUT(ImageCV source) {
  Objects.requireNonNull(source);
  Core.bitwise_not(source, source);
  return source;
}

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

private Mat doFindMatch(Element target, Mat mBase, Element probe) {
 if (SX.isNull(probe)) {
  probe = target;
 }
 Mat mResult = Element.getNewMat();
 Mat mProbe = probe.getContentBGR();
 if (!target.isPlainColor()) {
  if (probe.hasMask()) {
   Mat mMask = matMulti(probe.getMask(), mProbe.channels());
   Imgproc.matchTemplate(mBase, mProbe, mResult, Imgproc.TM_CCORR_NORMED, mMask);
  } else {
   Imgproc.matchTemplate(mBase, mProbe, mResult, Imgproc.TM_CCOEFF_NORMED);
  }
 } else {
  Mat mBasePlain = mBase;
  Mat mProbePlain = mProbe;
  if (target.isBlack()) {
   Core.bitwise_not(mBase, mBasePlain);
   Core.bitwise_not(mProbe, mProbePlain);
  }
  if (probe.hasMask()) {
   Mat mMask = matMulti(probe.getMask(), mProbe.channels());
   Imgproc.matchTemplate(mBasePlain, mProbePlain, mResult, Imgproc.TM_SQDIFF_NORMED, mMask);
  } else {
   Imgproc.matchTemplate(mBasePlain, mProbePlain, mResult, Imgproc.TM_SQDIFF_NORMED);
  }
  Core.subtract(Mat.ones(mResult.size(), CvType.CV_32F), mResult, mResult);
 }
 return mResult;
}

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

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

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

private Core.MinMaxLocResult doFindMatch(Mat base, Mat probe) {
 Mat res = new Mat();
 Mat bi = new Mat();
 Mat pi = new Mat();
 if (!isPlainColor) {
  Imgproc.matchTemplate(base, probe, res, Imgproc.TM_CCOEFF_NORMED);
 } else {
  if (isBlack) {
   Core.bitwise_not(base, bi);
   Core.bitwise_not(probe, pi);
  } else {
   bi = base;
   pi = probe;
  }
  Imgproc.matchTemplate(bi, pi, res, Imgproc.TM_SQDIFF_NORMED);
  Core.subtract(Mat.ones(res.size(), CvType.CV_32F), res, res);
 }
 return Core.minMaxLoc(res);
}

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

Core.bitwise_not(mask, mask);

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

Core.bitwise_not(mask, mask);

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

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    Mat mat = pipeline.getWorkingImage();
    Mat mask = mat.clone();
    Mat masked = mat.clone();
    Scalar color = FluentCv.colorToScalar(Color.black);
    mask.setTo(color);
    masked.setTo(color);
    Imgproc.circle(mask, new Point(mat.cols() / 2, mat.rows() / 2),  Math.abs(diameter) / 2, new Scalar(255, 255, 255), -1);
    if(diameter < 0) {
      Core.bitwise_not(mask,mask);
    }
    mat.copyTo(masked, mask);
    mask.release();
    return new Result(masked);
  }
}

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

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    Mat mat = pipeline.getWorkingImage();
    Mat mask = mat.clone();
    Mat masked = mat.clone();
    Scalar color = FluentCv.colorToScalar(Color.black);
    mask.setTo(color);
    masked.setTo(color);
    // FCA Change to have the possibility to work inside the interval or outside (when min>max)
    Scalar min;
    Scalar max;
    if (hueMin <= hueMax) {
      min = new Scalar(hueMin, saturationMin, valueMin);
      max = new Scalar(hueMax, saturationMax, valueMax);
    }
    else {
      min = new Scalar(hueMax, saturationMin, valueMin);
      max = new Scalar(hueMin, saturationMax, valueMax);
    }
    Core.inRange(mat, min, max, mask);

    if (hueMin <= hueMax) {
      Core.bitwise_not(mask, mask);
    }

    mat.copyTo(masked, mask);
    return new Result(masked);
  }
}

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

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    Mat mat = pipeline.getWorkingImage();
    Mat mask = mat.clone();
    Mat masked = mat.clone();
    Scalar color = FluentCv.colorToScalar(Color.black);
    mask.setTo(color);
    masked.setTo(color);
    Point low = new Point(mat.cols() / 2 - getWidth() / 2, mat.rows() / 2 - getHeight() / 2);
    Point high = new Point(mat.cols() / 2 + getWidth() / 2, mat.rows() / 2 + getHeight() / 2);
    Imgproc.rectangle(mask, low, high, new Scalar(255, 255, 255), -1);
    if (getWidth() * getHeight() < 0) {
      Core.bitwise_not(mask, mask);
    }
    mat.copyTo(masked, mask);
    mask.release();
    return new Result(masked);
  }
}

相关文章

Core类方法