本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}