當前位置: 首頁>>代碼示例>>Java>>正文


Java Scalar類代碼示例

本文整理匯總了Java中org.opencv.core.Scalar的典型用法代碼示例。如果您正苦於以下問題:Java Scalar類的具體用法?Java Scalar怎麽用?Java Scalar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Scalar類屬於org.opencv.core包,在下文中一共展示了Scalar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: denoise

import org.opencv.core.Scalar; //導入依賴的package包/類
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);
    }
 
開發者ID:PacktPublishing,項目名稱:Java-for-Data-Science,代碼行數:17,代碼來源:OpenCVNonMavenExamples.java

示例2: floodFill

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:vulovicv23,項目名稱:opencv-documentscanner-android,代碼行數:8,代碼來源:Imgproc.java

示例3: blobFromImages

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:8,代碼來源:Dnn.java

示例4: drawContours

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:daquexian,項目名稱:DNNLibrary,代碼行數:9,代碼來源:Imgproc.java

示例5: drawDetectedMarkers

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:johnhany,項目名稱:MOAAP,代碼行數:8,代碼來源:Aruco.java

示例6: setColorRadius

import org.opencv.core.Scalar; //導入依賴的package包/類
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);
}
 
開發者ID:TheBigBombman,項目名稱:RobotIGS,代碼行數:9,代碼來源:ColorBlobDetector.java

示例7: polylines

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:jorenham,項目名稱:fingerblox,代碼行數:9,代碼來源:Imgproc.java

示例8: drawContours

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:ahmetozlu,項目名稱:real_time_circle_detection_android,代碼行數:9,代碼來源:Imgproc.java

示例9: fillPoly

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:vulovicv23,項目名稱:opencv-documentscanner-android,代碼行數:9,代碼來源:Imgproc.java

示例10: fillConvexPoly

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:8,代碼來源:Imgproc.java

示例11: polylines

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:9,代碼來源:Imgproc.java

示例12: drawContours

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:trc492,項目名稱:Ftc2018RelicRecovery,代碼行數:9,代碼來源:Imgproc.java

示例13: fillPoly

import org.opencv.core.Scalar; //導入依賴的package包/類
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;
}
 
開發者ID:ravindu1024,項目名稱:android-imaging-utils,代碼行數:9,代碼來源:Imgproc.java

示例14: parseHexCode

import org.opencv.core.Scalar; //導入依賴的package包/類
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));
}
 
開發者ID:TheBigBombman,項目名稱:RobotIGS,代碼行數:16,代碼來源:ColorRGBA.java

示例15: filter

import org.opencv.core.Scalar; //導入依賴的package包/類
@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;
}
 
開發者ID:kylecorry31,項目名稱:Robot-Vision-API,代碼行數:10,代碼來源:HSVFilter.java


注:本文中的org.opencv.core.Scalar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。