对于相关对象的处理首先是写一个存储结构存储,对存储结构进行构造构造完后写getset方法构造器等内容,然后对构造器用集合List或其他存储结构进行存储后再进行添加
package edu.vision.Test;
import org.opencv.core.Point;
/**
* @author :zhaofuh
* @date :Created in 2020/11/23 11:08
* @description:保存标识符的中心位置以及标识符的text
* @modified By:
* @version: 0.1$
*/
public class IdentifierStorage {
//标识符的名称
private String identifierName;
// 标识符的中心点
private Point centerPoint;
public IdentifierStorage() {
this.identifierName = null;
this.centerPoint = null;
}
public IdentifierStorage(String identifierName, Point centerPoint) {
this.identifierName = identifierName;
this.centerPoint = centerPoint;
}
public String getIdentifierName() {
return identifierName;
}
public void setIdentifierName(String identifierName) {
this.identifierName = identifierName;
}
public Point getCenterPoint() {
return centerPoint;
}
public void setCenterPoint(Point centerPoint) {
this.centerPoint = centerPoint;
}
@Override
public String toString() {
return "IdentifierStorage{" +
"identifierName='" + identifierName + '\'' +
", centerPoint=" + centerPoint +
'}';
}
}
使用的时候这样使用
List<IdentifierStorage> identifierStorages = new ArrayList<>();
IdentifierStorage identifierStorage =new IdentifierStorage();
identifierStorage.setIdentifierName(text);
//有疑惑
identifierStorage.setCenterPoint(center);
identifierStorages.add(identifierStorage)
对于复杂对象的存储以及使用