Java 类org.opencv.core.Scalar 实例源码

项目:Java-for-Data-Science    文件:OpenCVNonMavenExamples.java   
public static void denoise() {
        String imgInPath = "captchaExample.jpg";
        imgInPath = "MyCaptcha.PNG";
        imgInPath = "blurredtext.jpg";
        String imgOutPath = "captchaNoiseRemovedExample.png";
        imgOutPath = "MyNoiseRemovedCaptcha.PNG";

        Mat image = Imgcodecs.imread(imgInPath);
        Mat out = new Mat();
        Mat tmp = new Mat();
        Mat kernel = new Mat(new Size(3, 3), CvType.CV_8UC1, new Scalar(255));
//        Mat kernel = new Mat(image.size(), CvType.CV_8UC1, new Scalar(255));
        Imgproc.morphologyEx(image, tmp, Imgproc.MORPH_OPEN, kernel);
        Imgproc.morphologyEx(tmp, out, Imgproc.MORPH_CLOSE, kernel);
        Imgcodecs.imwrite(imgOutPath, out);
    }
项目:opencv-documentscanner-android    文件:Imgproc.java   
public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff, int flags)
{
    double[] rect_out = new double[4];
    int retVal = floodFill_0(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3], upDiff.val[0], upDiff.val[1], upDiff.val[2], upDiff.val[3], flags);
    if(rect!=null){ rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; } 
    return retVal;
}
项目:NotifyTools    文件:Dnn.java   
public static Mat blobFromImages(List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop)
{
    Mat images_mat = Converters.vector_Mat_to_Mat(images);
    Mat retVal = new Mat(blobFromImages_0(images_mat.nativeObj, scalefactor, size.width, size.height, mean.val[0], mean.val[1], mean.val[2], mean.val[3], swapRB, crop));

    return retVal;
}
项目:DNNLibrary    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel, Point offset)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_0(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj, maxLevel, offset.x, offset.y);

    return;
}
项目:MOAAP    文件:Aruco.java   
public static void drawDetectedMarkers(Mat image, List<Mat> corners, Mat ids, Scalar borderColor)
{
    Mat corners_mat = Converters.vector_Mat_to_Mat(corners);
    drawDetectedMarkers_0(image.nativeObj, corners_mat.nativeObj, ids.nativeObj, borderColor.val[0], borderColor.val[1], borderColor.val[2], borderColor.val[3]);

    return;
}
项目:EyeShopping    文件:Imgproc.java   
public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff, int flags)
{
    double[] rect_out = new double[4];
    int retVal = floodFill_0(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3], upDiff.val[0], upDiff.val[1], upDiff.val[2], upDiff.val[3], flags);
    if(rect!=null){ rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; } 
    return retVal;
}
项目:RobotIGS    文件:ColorBlobDetector.java   
private void setColorRadius(Color lowerBound, Color upperBound) {
    isRadiusSet = false;
    Scalar lower = lowerBound.convertColorScalar(ColorSpace.HSV);
    Scalar upper = upperBound.convertColorScalar(ColorSpace.HSV);

    this.lowerBound = new ColorHSV(lower);
    this.upperBound = new ColorHSV(upper);
}
项目:fingerblox    文件:Imgproc.java   
public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness, int lineType, int shift)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    polylines_0(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);

    return;
}
项目:real_time_circle_detection_android    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_2(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:opencv-documentscanner-android    文件:Imgproc.java   
public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType, int shift, Point offset)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    fillPoly_0(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType, shift, offset.x, offset.y);

    return;
}
项目:mao-android    文件:Imgproc.java   
public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
{
    Mat points_mat = points;
    fillConvexPoly_1(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:Android-Code-Demos    文件:Imgproc.java   
public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    polylines_1(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
项目:Ftc2018RelicRecovery    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_1(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
项目:OpenCV    文件:Imgproc.java   
public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
{
    Mat points_mat = points;
    fillConvexPoly_1(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:android-imaging-utils    文件:Imgproc.java   
public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    fillPoly_1(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:Team9261-2017-2018    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_2(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:renderscript_examples    文件:Imgproc.java   
public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
{
    Mat points_mat = points;
    fillConvexPoly_1(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:Image-Detection-Samples    文件:Imgproc.java   
public static void polylines(Mat img, List<MatOfPoint> pts, boolean isClosed, Scalar color, int thickness)
{
    List<Mat> pts_tmplm = new ArrayList<Mat>((pts != null) ? pts.size() : 0);
    Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
    polylines_1(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
项目:RobotIGS    文件:ColorRGBA.java   
private static Scalar parseHexCode(String hexCode) {
    //remove hex key #
    if (!hexCode.startsWith("#"))
        hexCode = "#" + hexCode;
    //ensure that the length is correct
    if (hexCode.length() != 7 && hexCode.length() != 9)
        throw new IllegalArgumentException("Hex code must be of length 6 or 8 characters.");
    //get the integer representation
    int color = android.graphics.Color.parseColor(hexCode);
    //get the r,g,b,a values
    return new Scalar(android.graphics.Color.red(color),
            android.graphics.Color.green(color),
            android.graphics.Color.blue(color),
            android.graphics.Color.alpha(color));
}
项目:react-native-scan-doc    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_2(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:Sikulix2opencv    文件:Imgproc.java   
public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff, int flags)
{
    double[] rect_out = new double[4];
    int retVal = floodFill_0(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3], upDiff.val[0], upDiff.val[1], upDiff.val[2], upDiff.val[3], flags);
    if(rect!=null){ rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; } 
    return retVal;
}
项目:Sikulix2opencv    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_2(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:Robot-Vision-API    文件:HSVFilter.java   
@Override
public Mat filter(Mat image) {
    Mat hsvImg = new Mat();
    Imgproc.cvtColor(image, hsvImg, Imgproc.COLOR_BGR2HSV);
    Scalar lower = new Scalar(hue.getLow(), saturation.getLow(), value.getLow());
    Scalar upper = new Scalar(hue.getHigh(), saturation.getHigh(), value.getHigh());
    Core.inRange(hsvImg, lower, upper, hsvImg);
    return hsvImg;
}
项目:Checkerboard-IMU-Comparator    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel, Point offset)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_0(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj, maxLevel, offset.x, offset.y);

    return;
}
项目:fingerblox    文件:Imgproc.java   
public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness)
{
    List<Mat> contours_tmplm = new ArrayList<Mat>((contours != null) ? contours.size() : 0);
    Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
    drawContours_1(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
项目:MOAAP    文件:Features2d.java   
public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage, Scalar color, int flags)
{
    Mat keypoints_mat = keypoints;
    drawKeypoints_0(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], flags);

    return;
}
项目:SudoCAM-Ku    文件:Processing.java   
public static Scalar getNumberColor(){
    return Processing.numberColor;
}
项目:EyeShopping    文件:Imgproc.java   
public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift)
{

    rectangle_0(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);

    return;
}
项目:OpenCV    文件:Core.java   
public static Scalar mean(Mat src, Mat mask)
{

    Scalar retVal = new Scalar(mean_0(src.nativeObj, mask.nativeObj));

    return retVal;
}
项目:Team9261-2017-2018    文件:Core.java   
public static void absdiff(Mat src1, Scalar src2, Mat dst)
{

    absdiff_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);

    return;
}
项目:DNNLibrary    文件:Core.java   
public static void multiply(Mat src1, Scalar src2, Mat dst, double scale)
{

    multiply_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);

    return;
}
项目:Sikulix2opencv    文件:Imgproc.java   
public static void line(Mat img, Point pt1, Point pt2, Scalar color)
{

    line_2(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3]);

    return;
}
项目:EyeShopping    文件:Imgproc.java   
public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness)
{

    ellipse_1(img.nativeObj, center.x, center.y, axes.width, axes.height, angle, startAngle, endAngle, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}
项目:fingerblox    文件:Core.java   
public static Scalar mean(Mat src, Mat mask)
{

    Scalar retVal = new Scalar(mean_0(src.nativeObj, mask.nativeObj));

    return retVal;
}
项目:MOAAP    文件:Imgproc.java   
public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal)
{

    int retVal = floodFill_1(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3]);

    return retVal;
}
项目:real_time_circle_detection_android    文件:Core.java   
public static void min(Mat src1, Scalar src2, Mat dst)
{

    min_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);

    return;
}
项目:Android-Code-Demos    文件:Core.java   
public static Scalar sumElems(Mat src)
{

    Scalar retVal = new Scalar(sumElems_0(src.nativeObj));

    return retVal;
}
项目:OpenCV_Android_Plus    文件:Imgproc.java   
/**
* <p>Applies a perspective transformation to an image.</p>
*
* <p>The function <code>warpPerspective</code> transforms the source image using
* the specified matrix:</p>
*
* <p><em>dst(x,y) = src((M_11 x + M_12 y + M_13)/(M_(31) x + M_32 y +
* M_33),&ltBR&gt(M_21 x + M_22 y + M_23)/(M_(31) x + M_32 y + M_33))</em></p>
*
* <p>when the flag <code>WARP_INVERSE_MAP</code> is set. Otherwise, the
* transformation is first inverted with "invert" and then put in the formula
* above instead of <code>M</code>.
* The function cannot operate in-place.</p>
*
* @param src input image.
* @param dst output image that has the size <code>dsize</code> and the same
* type as <code>src</code>.
* @param M <em>3x 3</em> transformation matrix.
* @param dsize size of the output image.
* @param flags combination of interpolation methods (<code>INTER_LINEAR</code>
* or <code>INTER_NEAREST</code>) and the optional flag <code>WARP_INVERSE_MAP</code>,
* that sets <code>M</code> as the inverse transformation (<em>dst->src</em>).
* @param borderMode pixel extrapolation method (<code>BORDER_CONSTANT</code> or
* <code>BORDER_REPLICATE</code>).
* @param borderValue value used in case of a constant border; by default, it
* equals 0.
*
* @see <a href="http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#warpperspective">org.opencv.imgproc.Imgproc.warpPerspective</a>
* @see org.opencv.imgproc.Imgproc#warpAffine
* @see org.opencv.imgproc.Imgproc#remap
* @see org.opencv.core.Core#perspectiveTransform
* @see org.opencv.imgproc.Imgproc#getRectSubPix
* @see org.opencv.imgproc.Imgproc#resize
*/
   public static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode, Scalar borderValue)
   {

       warpPerspective_0(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags, borderMode, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);

       return;
   }
项目:mao-android    文件:Core.java   
public static void inRange(Mat src, Scalar lowerb, Scalar upperb, Mat dst)
{

    inRange_0(src.nativeObj, lowerb.val[0], lowerb.val[1], lowerb.val[2], lowerb.val[3], upperb.val[0], upperb.val[1], upperb.val[2], upperb.val[3], dst.nativeObj);

    return;
}
项目:Microsphere    文件:Imgproc.java   
public static void putText(Mat img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness)
{

    putText_1(img.nativeObj, text, org.x, org.y, fontFace, fontScale, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

    return;
}