本文整理了Java中org.opencv.core.Core.multiply()
方法的一些代码示例,展示了Core.multiply()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Core.multiply()
方法的具体详情如下:
包路径:org.opencv.core.Core
类名称:Core
方法名:multiply
[英]Calculates the per-element scaled product of two arrays.
The function multiply
calculates the per-element product of two arrays:
dst(I)= saturate(scale * src1(I) * src2(I))
There is also a "MatrixExpressions" -friendly variant of the first function. See "Mat.mul".
For a not-per-element matrix product, see "gemm".
Note: Saturation is not applied when the output array has the depth CV_32S
. You may even get result of an incorrect sign in the case of overflow.
[中]计算两个阵列的每元素比例积。
函数multiply
计算两个数组的每元素乘积:
dst(I)=饱和(标度src1(I)src2(I))
还有一个“MatrixExpressions”——第一个函数的友好变体。参见“Mat.mul”。
对于非每元素矩阵乘积,请参见“gemm”。
注意:当输出数组的深度为CV_32S
时,不应用饱和度。在溢出的情况下,您甚至可能会得到错误符号的结果。
代码示例来源:origin: ytai/IOIOPlotter
Core.multiply(procImage_, new Scalar(0.25, 0.25, 0.25), procImage_);
Core.add(procImage_, new Scalar(192, 192, 192), procImage_);
代码示例来源:origin: JavaOpenCVBook/code
protected void processOperation() {
Imgproc.Canny(originalImage, image, 220, 255, 3, false);
Imgproc.threshold(image, image, 100, 255, Imgproc.THRESH_BINARY_INV);
Imgproc.distanceTransform(image, image, Imgproc.CV_DIST_L2, 3);
image.convertTo(image, CvType.CV_8UC1);
Core.multiply(image, new Scalar(20), image);
updateView();
}
代码示例来源:origin: ytai/IOIOPlotter
private void clear() {
// Resize to native resolution divided by blur factor.
float scale = LINE_WIDTH_TO_IMAGE_WIDTH / blur_ / srcImage_.cols();
Imgproc.resize(srcImage_, imageResidue_, new Size(), scale, scale, Imgproc.INTER_AREA);
// Negative.
final Mat scalar = new Mat(1, 1, CvType.CV_64FC1).setTo(new Scalar(255));
Core.subtract(scalar, imageResidue_, imageResidue_);
// Convert to S16.
imageResidue_.convertTo(imageResidue_, CvType.CV_16SC1);
// Full scale is now blur * GRAY_RESOLUTION.
Core.multiply(imageResidue_, new Scalar(blur_ * GRAY_RESOLUTION / 255), imageResidue_);
// Clear map.
curves_.clear();
kernelFactory_.setDimensions(imageResidue_.width(), imageResidue_.height());
}
代码示例来源:origin: nroduit/Weasis
multiply(histogram, scalar, histogram);
代码示例来源:origin: nroduit/Weasis
public Mat getMaskedDosePlaneHist(double slicePosition, Mat mask, int maxDose) {
DicomImageElement dosePlane = (DicomImageElement) this.getDosePlaneBySlice(slicePosition);
int rows = dosePlane.getImage().toMat().rows();
int cols = dosePlane.getImage().toMat().cols();
// Calculate dose matrix for OpenCV
Mat src = new Mat(rows, cols, CvType.CV_32FC1);
dosePlane.getImage().toMat().convertTo(src, CvType.CV_32FC1);
Scalar scalar = new Scalar(this.doseGridScaling * 100);
Mat doseMatrix = new Mat(rows, cols, CvType.CV_32FC1);
multiply(src, scalar, doseMatrix);
List<Mat> doseMatrixVector = new ArrayList<>();
doseMatrixVector.add(doseMatrix);
// Masked dose plan histogram
Mat hist = new Mat();
// Number of histogram bins
MatOfInt histSize = new MatOfInt(maxDose);
// Dose varies from 0 to maxDose
MatOfFloat histRange = new MatOfFloat(0, maxDose);
// Only one 0-th channel
MatOfInt channels = new MatOfInt(0);
// Ned to change the structure dose mask type vor OpenCV histogram calculation
Mat maskSrc = new Mat(mask.rows(), mask.cols(), CvType.CV_8U);
mask.convertTo(maskSrc, CvType.CV_8U);
Imgproc.calcHist(doseMatrixVector, channels, maskSrc, hist, histSize, histRange);
return hist;
}
内容来源于网络,如有侵权,请联系作者删除!