java类org.opencv.core.Scalar的实例源码

OpenCVNonMavenExamples.java 文件源码 项目:Java-for-Data-Science 阅读 22 收藏 0 点赞 0 评论 0
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);
    }
Imgproc.java 文件源码 项目:opencv-documentscanner-android 阅读 22 收藏 0 点赞 0 评论 0
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;
}
Dnn.java 文件源码 项目:NotifyTools 阅读 23 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:DNNLibrary 阅读 20 收藏 0 点赞 0 评论 0
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;
}
Aruco.java 文件源码 项目:MOAAP 阅读 19 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:EyeShopping 阅读 23 收藏 0 点赞 0 评论 0
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;
}
ColorBlobDetector.java 文件源码 项目:RobotIGS 阅读 26 收藏 0 点赞 0 评论 0
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);
}
Imgproc.java 文件源码 项目:fingerblox 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:real_time_circle_detection_android 阅读 27 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:opencv-documentscanner-android 阅读 24 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:mao-android 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Android-Code-Demos 阅读 27 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Ftc2018RelicRecovery 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:OpenCV 阅读 31 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:android-imaging-utils 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Team9261-2017-2018 阅读 26 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:renderscript_examples 阅读 20 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Image-Detection-Samples 阅读 27 收藏 0 点赞 0 评论 0
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;
}
ColorRGBA.java 文件源码 项目:RobotIGS 阅读 23 收藏 0 点赞 0 评论 0
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));
}
Imgproc.java 文件源码 项目:react-native-scan-doc 阅读 23 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Sikulix2opencv 阅读 23 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:Sikulix2opencv 阅读 31 收藏 0 点赞 0 评论 0
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;
}
HSVFilter.java 文件源码 项目:Robot-Vision-API 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
Imgproc.java 文件源码 项目:Checkerboard-IMU-Comparator 阅读 21 收藏 0 点赞 0 评论 0
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;
}
Imgproc.java 文件源码 项目:fingerblox 阅读 21 收藏 0 点赞 0 评论 0
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;
}
Features2d.java 文件源码 项目:MOAAP 阅读 26 收藏 0 点赞 0 评论 0
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;
}
Processing.java 文件源码 项目:SudoCAM-Ku 阅读 26 收藏 0 点赞 0 评论 0
public static Scalar getNumberColor(){
    return Processing.numberColor;
}
Imgproc.java 文件源码 项目:EyeShopping 阅读 22 收藏 0 点赞 0 评论 0
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;
}
Core.java 文件源码 项目:OpenCV 阅读 23 收藏 0 点赞 0 评论 0
public static Scalar mean(Mat src, Mat mask)
{

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

    return retVal;
}
Core.java 文件源码 项目:Team9261-2017-2018 阅读 25 收藏 0 点赞 0 评论 0
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;
}


问题


面经


文章

微信
公众号

扫码关注公众号