org.opencv.core.Size类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.opencv.core.Size类的一些代码示例,展示了Size类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Size类的具体详情如下:
包路径:org.opencv.core.Size
类名称:Size

Size介绍

[英]template class CV_EXPORTS Size_ ``

// C++ code:

public:

typedef _Tp value_type;

//! various constructors

Size_();

Size_(_Tp _width, _Tp _height);

Size_(const Size_& sz);

Size_(const CvSize& sz);

Size_(const CvSize2D32f& sz);

Size_(const Point_& pt);

Size_& operator = (const Size_& sz);

//! the area (width*height)

_Tp area() const;

//! conversion of another data type.

template operator Size_() const;

//! conversion to the old-style OpenCV types

operator CvSize() const;

operator CvSize2D32f() const;

_Tp width, height; // the width and the height

};

Template class for specifying the size of an image or rectangle. The class includes two members called width and height. The structure can be converted to and from the old OpenCV structures

CvSize and CvSize2D32f. The same set of arithmetic and comparison operations as for Point_ is available. OpenCV defines the following Size_<> aliases: ``

// C++ code:

typedef Size_ Size2i;

typedef Size2i Size;

typedef Size_ Size2f;
[中]模板类CV_导出大小_//C++代码: 公众: typedef_Tp value_type; //! 各种建设者 大小_uuz(); 尺寸(宽度、高度); 尺寸(const Size_uz&sz); 尺寸(const CvSize&sz); 尺寸(常数CvSize2D32f和sz); 尺寸(常数点); 大小和运算符=(常量大小和大小); //! 面积(宽*高) _Tp面积()常数; //! 另一种数据类型的转换。 模板运算符大小_uuz()常量; //! 转换为旧式OpenCV类型 运算符CvSize()常量; 运算符CvSize2D32f()常量; _Tp宽度、高度;//宽度和高度 }; 用于指定图像或矩形大小的模板类。该课程包括两名成员,分别为`width`和`height`。该结构可以与旧的OpenCV结构进行转换 `CvSize`和[$4$]。与`Point_`相同的一组算术和比较操作可用。OpenCV定义了以下`Size_<>`别名:
//C++代码:
typedef Size_u2i;
typedef Size 2i Size;
typedef Size_u2f;

代码示例

代码示例来源:origin: RaiMan/SikuliX2

public Mat getResizedMat(double factor) {
 Mat newMat = getContent();
 if (isValid()) {
  newMat = getNewMat();
  Size newS = new Size(w * factor, h * factor);
  Imgproc.resize(getContent(), newMat, newS, 0, 0, Imgproc.INTER_AREA);
 }
 return newMat;
}

代码示例来源:origin: kongqw/OpenCVForAndroid

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

代码示例来源:origin: RaiMan/SikuliX2

for (double factor : resizeLevels) {
 rfactor = factor * imgFactor;
 sizeBase = new Size(this.mBase.cols() / rfactor, this.mBase.rows() / rfactor);
 sizePattern = new Size(target.getContent().cols() / rfactor, target.getContent().rows() / rfactor);
 Imgproc.resize(this.mBase, mBase, sizeBase, 0, 0, Imgproc.INTER_AREA);
 Imgproc.resize(target.getContentBGR(), mPattern, sizePattern, 0, 0, Imgproc.INTER_AREA);
if (mBase.size().equals(target.getContent().size())) {

代码示例来源:origin: kongqw/OpenCVForAndroid

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: farkam135/GoIV

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: RaiMan/SikuliX2

public static Mat detectEdges(Mat mSource) {
 Mat mSourceGray = Element.getNewMat();
 Mat mDetectedEdges = Element.getNewMat();
 int edgeThresh = 1;
 int lowThreshold = 100;
 int ratio = 3;
 int kernelSize = 5;
 int blurFilterSize = 3;
 if (mSource.channels() == 1) {
  mSourceGray = mSource;
 } else {
  Imgproc.cvtColor(mSource, mSourceGray, toGray);
 }
 Imgproc.blur(mSourceGray, mDetectedEdges, new Size(blurFilterSize, blurFilterSize));
 Imgproc.Canny(mDetectedEdges, mDetectedEdges,
     lowThreshold, lowThreshold * ratio, kernelSize, false);
 return mDetectedEdges;
}
//</editor-fold>

代码示例来源:origin: tz28/Chinese-number-gestures-recognition

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: com.sikulix/sikulixapi

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

代码示例来源:origin: RaiMan/SikuliX2

public static List<Element> detectChanges(Mat base, Mat mChanged) {
 int PIXEL_DIFF_THRESHOLD = 3;
 int IMAGE_DIFF_THRESHOLD = 5;
 Mat mBaseGray = Element.getNewMat();
 Mat mChangedGray = Element.getNewMat();
 Mat mDiffAbs = Element.getNewMat();
 Mat mDiffTresh = Element.getNewMat();
 Mat mChanges = Element.getNewMat();
 List<Element> rectangles = new ArrayList<>();
 Imgproc.cvtColor(base, mBaseGray, toGray);
 Imgproc.cvtColor(mChanged, mChangedGray, toGray);
 Core.absdiff(mBaseGray, mChangedGray, mDiffAbs);
 Imgproc.threshold(mDiffAbs, mDiffTresh, PIXEL_DIFF_THRESHOLD, 0.0, Imgproc.THRESH_TOZERO);
 if (Core.countNonZero(mDiffTresh) > IMAGE_DIFF_THRESHOLD) {
  Imgproc.threshold(mDiffAbs, mDiffAbs, PIXEL_DIFF_THRESHOLD, 255, Imgproc.THRESH_BINARY);
  Imgproc.dilate(mDiffAbs, mDiffAbs, Element.getNewMat());
  Mat se = Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(5, 5));
  Imgproc.morphologyEx(mDiffAbs, mDiffAbs, Imgproc.MORPH_CLOSE, se);
  List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
  Mat mHierarchy = Element.getNewMat();
  Imgproc.findContours(mDiffAbs, contours, mHierarchy, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
  rectangles = contoursToRectangle(contours);
  Core.subtract(mDiffAbs, mDiffAbs, mChanges);
  Imgproc.drawContours(mChanges, contours, -1, new Scalar(255));
  //logShow(mDiffAbs);
 }
 return rectangles;
}

代码示例来源:origin: leadrien/opencv_native_androidstudio

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: nroduit/Weasis

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

代码示例来源:origin: kongqw/OpenCVForAndroid

public Size size()
{
  Size retVal = new Size(n_size(nativeObj));
  return retVal;
}

代码示例来源:origin: nu.pattern/opencv

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: farkam135/GoIV

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

代码示例来源:origin: kongqw/OpenCVForAndroid

public  Size get_blockSize()
{
  
  Size retVal = new Size(get_blockSize_0(nativeObj));
  
  return retVal;
}

代码示例来源:origin: nroduit/Weasis

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: imistyrain/EasyPR4Android

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

代码示例来源:origin: kongqw/OpenCVForAndroid

public RotatedRect() {
  this.center = new Point();
  this.size = new Size();
  this.angle = 0;
}

代码示例来源:origin: com.sikulix/sikulixapi

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (!(obj instanceof RotatedRect)) return false;
  RotatedRect it = (RotatedRect) obj;
  return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
}

代码示例来源:origin: tz28/Chinese-number-gestures-recognition

public RotatedRect(Point c, Size s, double a) {
  this.center = c.clone();
  this.size = s.clone();
  this.angle = a;
}

相关文章