Record Class ConnectedComponentsOp.Result

java.lang.Object
java.lang.Record
cloud.opencode.base.image.analysis.ConnectedComponentsOp.Result
Record Components:
labels - 2D label matrix where labels[y][x] is the component label (0 = background) | 二维标签矩阵,labels[y][x] 为连通域标签(0 = 背景)
components - the list of detected components sorted by label | 按标签排序的检测到的连通域列表
Enclosing class:
ConnectedComponentsOp

public static record ConnectedComponentsOp.Result(int[][] labels, List<ConnectedComponentsOp.Component> components) extends Record
The result of connected component analysis. 连通域分析结果。
Since:
JDK 25, opencode-base-image V2.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Result

      public Result(int[][] labels, List<ConnectedComponentsOp.Component> components)
      Create a result with defensive copy of the component list. 创建结果,对连通域列表进行防御性拷贝。
      Parameters:
      labels - the label matrix | 标签矩阵
      components - the component list | 连通域列表
  • Method Details

    • componentCount

      public int componentCount()
      Get the number of connected components found. 获取找到的连通域数量。
      Returns:
      the component count | 连通域数量
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • labels

      public int[][] labels()
      Returns the value of the labels record component.
      Returns:
      the value of the labels record component
    • components

      public List<ConnectedComponentsOp.Component> components()
      Returns the value of the components record component.
      Returns:
      the value of the components record component