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

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(88)

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

Range介绍

[英]Template class specifying a continuous subsequence (slice) of a sequence.

class CV_EXPORTS Range ``

// C++ code:

public:

Range();

Range(int _start, int _end);

Range(const CvSlice& slice);

int size() const;

bool empty() const;

static Range all();

operator CvSlice() const;

int start, end;

};

The class is used to specify a row or a column span in a matrix (

"Mat") and for many other purposes. Range(a,b) is basically the same as a:b in Matlab or a..b in Python. As in Python, start is an inclusive left boundary of the range and end is an exclusive right boundary of the range. Such a half-opened interval is usually denoted as [start,end). The static method Range.all() returns a special variable that means "the whole sequence" or "the whole range", just like " : " in Matlab or " ... " in Python. All the methods and functions in OpenCV that take Range support this special Range.all() value. But, of course, in case of your own custom processing, you will probably have to check and handle it explicitly: ``

// C++ code:

void my_function(..., const Range& r,....)

if(r == Range.all()) {

// process all the data

else {

// process [r.start, r.end)
[中]指定序列的连续子序列(切片)的模板类。
类别CV_出口范围//C++代码: 公众: 范围(); 范围(整数开始,整数结束); 范围(const CvSlice&slice); int size()常量; bool empty()常量; 静态范围全部(); 运算符CvSlice()常量; int开始,结束; }; 该类用于指定矩阵中的行或列范围( “垫子”)以及许多其他用途。`Range(a,b)`与Matlab中的`a:b`或Python中的`a..b`基本相同。在Python中,`start`是范围的包含左边界,`end`是范围的独占右边界。这种半开区间通常表示为*[start,end)*。静态方法`Range.all()`返回一个表示“整个序列”或“整个范围”的特殊变量,就像Matlab中的“`:`”或Python中的“[$8$]”。OpenCV中所有采用`Range`的方法和函数都支持这个特殊的`Range.all()`值。但是,当然,对于您自己的自定义处理,您可能需要显式地检查和处理它:
//C++代码:
void my_函数(…,const Range&r…)
如果(r==Range.all()){
//处理所有数据
否则{
//过程[r.开始,r.结束)

代码示例

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

public Element next() {
 Element match = null;
 if (hasNext()) {
  match = new Element(new Element(currentX + offX, currentY + offY, target.w, target.h), currentScore);
  int margin = getPurgeMargin();
  Range rangeX = new Range(Math.max(currentX - margin, 0), currentX + 1);
  Range rangeY = new Range(Math.max(currentY - margin, 0), currentY + 1);
  result.colRange(rangeX).rowRange(rangeY).setTo(new Scalar(0f));
 }
 return match;
}

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

public MatOfPoint3f(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public MatOfPoint3(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public MatOfFloat6(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfDouble(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfRect(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfPoint2f(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfByte(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

代码示例来源:origin: ctodobom/OpenCV-3.1.0-Android

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfInt(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfFloat(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfInt4(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

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

public Range intersection(Range r1) {
  Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
  r.end = Math.max(r.end, r.start);
  return r;
}

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

public MatOfFloat4(Mat m) {
  super(m, Range.all());
  if( !empty() && checkVector(_channels, _depth) < 0 )
    throw new IllegalArgumentException("Incompatible Mat");
  //FIXME: do we need release() here?
}

相关文章

微信公众号

最新文章

更多