public void resetHoleBoundary() { if (this.state == CONTROLLER_STATE.CONTROLLER_BOUNDARY) { if ((this.counterPixelsHistory != null) && (this.counterPixelsHistory.size() > 0)) { for (Pixel p : this.counterPixelsHistory) { Grid.getInstance().setPixel(p, p.getValue()); } refreshView(); } this.state = CONTROLLER_STATE.CONTROLLER_HOLE; } }
public void markBoundary() { if (this.state == CONTROLLER_STATE.CONTROLLER_HOLE) { ArrayList<Pixel> boundaryPixels = this.gridAlgorithm2.findBoundary(); this.counterPixelsHistory = new ArrayList<Pixel>(); for (Pixel p : boundaryPixels) { this.counterPixelsHistory.add(new Pixel(p.getX(), p.getY(), p.getValue())); } Grid.getInstance().markBoundary(boundaryPixels); refreshView(); this.state = CONTROLLER_STATE.CONTROLLER_BOUNDARY; } }
public void markBoundary1() { if (this.state == CONTROLLER_STATE.CONTROLLER_HOLE) { this.holePixelsInfo = this.gridAlgorithm.findBoundaryAndHoles(); this.counterPixelsHistory = new ArrayList<Pixel>(); for (Pixel p : holePixelsInfo.getBoundaryPixels()) { this.counterPixelsHistory.add(new Pixel(p.getX(), p.getY(), p.getValue())); } Grid.getInstance().markBoundary(this.holePixelsInfo.getBoundaryPixels()); refreshView(); this.state = CONTROLLER_STATE.CONTROLLER_BOUNDARY; } }
private PictureView refreshMatrix() { Grid gridInstance = Grid.getInstance(); this.mat = new Mat(Grid.getInstance().getCols(), gridInstance.getRows(), CvType.CV_32SC1); for (int i = 0; i < Grid.getInstance().getRows(); i++) { for (int j = 0; j < gridInstance.getCols(); j++) { this.mat.put(i, j, gridInstance.getPixel(i, j).getValue()); } } PictureView image = null; try { image = new PictureView(this.mat, ".jpg"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return image; }
/** ***********private start******************* */ private Grid initGrid() { Grid gridInstance = Grid.getInstance(config.getImageRows(), config.getImageCols()); gridInstance.initGrid(); return gridInstance; }