commit
c14fd239ee
@ -0,0 +1,33 @@
|
||||
package org.wlld.imageRecognition;
|
||||
|
||||
import org.wlld.imageRecognition.modelEntity.RegressionBody;
|
||||
|
||||
public class XYBody {
|
||||
private double[] X;
|
||||
private double[] Y;
|
||||
private RegressionBody regressionBody;
|
||||
|
||||
public RegressionBody getRegressionBody() {
|
||||
return regressionBody;
|
||||
}
|
||||
|
||||
public void setRegressionBody(RegressionBody regressionBody) {
|
||||
this.regressionBody = regressionBody;
|
||||
}
|
||||
|
||||
public double[] getX() {
|
||||
return X;
|
||||
}
|
||||
|
||||
public void setX(double[] x) {
|
||||
X = x;
|
||||
}
|
||||
|
||||
public double[] getY() {
|
||||
return Y;
|
||||
}
|
||||
|
||||
public void setY(double[] y) {
|
||||
Y = y;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package org.wlld.imageRecognition.segmentation;
|
||||
|
||||
import org.wlld.MatrixTools.Matrix;
|
||||
import org.wlld.imageRecognition.ThreeChannelMatrix;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lidapeng
|
||||
* @description 阈值分区
|
||||
* @date 10:25 上午 2020/1/13
|
||||
*/
|
||||
public class ImageSegmentation {
|
||||
private Matrix matrixR;
|
||||
private Matrix matrixG;
|
||||
private Matrix matrixB;
|
||||
private Map<Integer, RegionBody> regionBodyList = new HashMap<>();
|
||||
private int id = 1;
|
||||
|
||||
public ImageSegmentation(ThreeChannelMatrix threeChannelMatrix) throws Exception {
|
||||
matrixR = threeChannelMatrix.getMatrixR();
|
||||
matrixG = threeChannelMatrix.getMatrixG();
|
||||
matrixB = threeChannelMatrix.getMatrixB();
|
||||
int x = matrixR.getX();
|
||||
int y = matrixR.getY();
|
||||
for (int i = 0; i < x; i++) {
|
||||
for (int j = 0; j < y; j++) {
|
||||
double r = matrixR.getNumber(i, j);
|
||||
double g = matrixG.getNumber(i, j);
|
||||
double b = matrixB.getNumber(i, j);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMin(double[] array) {
|
||||
double min = array[0];
|
||||
int minIdx = 0;
|
||||
for (int i = 1; i < array.length; i++) {
|
||||
if (array[i] < min) {
|
||||
minIdx = i;
|
||||
min = array[i];
|
||||
}
|
||||
}
|
||||
return minIdx;
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,46 @@
|
||||
package org.wlld.imageRecognition.segmentation;
|
||||
|
||||
import org.wlld.MatrixTools.Matrix;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lidapeng
|
||||
* @description 分区实体
|
||||
*/
|
||||
public class RegionBody {
|
||||
private int minX = -1;
|
||||
private int minY = -1;
|
||||
private int maxX;
|
||||
private int maxY;
|
||||
|
||||
public void setX(int x) {
|
||||
if (x < minX || minX == -1) {
|
||||
minX = x;
|
||||
}
|
||||
if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
if (y < minY || minY == -1) {
|
||||
minY = y;
|
||||
}
|
||||
if (y > maxY) {
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMinX() {
|
||||
return minX;
|
||||
}
|
||||
|
||||
public int getMinY() {
|
||||
return minY;
|
||||
}
|
||||
|
||||
public int getMaxX() {
|
||||
return maxX;
|
||||
}
|
||||
|
||||
public int getMaxY() {
|
||||
return maxY;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.wlld.imageRecognition.segmentation;
|
||||
|
||||
public class Specifications {
|
||||
private double width;
|
||||
private double height;
|
||||
|
||||
public double getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(double width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue