예제 #1
0
 private void edges() {
   int[] greypxls = imageUtils.convertToGrey(img);
   int[] edgepxls = imageUtils.edges(greypxls, img.getWidth(), img.getHeight());
   BufferedImage greyimg = imageUtils.intToImage(greypxls, img.getWidth(), img.getHeight());
   picLabel.setIcon(new ImageIcon(greyimg));
   panel.repaint();
   BufferedImage edgeimg = imageUtils.intToImage(edgepxls, img.getWidth(), img.getHeight());
   picLabel1.setIcon(new ImageIcon(edgeimg));
   panel_1.repaint();
 }
예제 #2
0
  private void recordCtr() {
    int[] greypxls = imageUtils.convertToGrey(img);
    ctrMatrix = imageUtils.convertToMatrix(greypxls, img.getWidth(), img.getHeight());
    BufferedImage gi = imageUtils.intToImage(greypxls, img.getWidth(), img.getHeight());

    // put red dot in ctr
    int red = (255 << 16) + (0 << 8) + 0;
    int x = img.getWidth() / 2 + imageUtils.matrixres / 2;
    int y = img.getHeight() / 2 + imageUtils.matrixres / 2;
    gi.setRGB(x, y, red);
    gi.setRGB(x - 1, y, red);
    gi.setRGB(x + 1, y, red);
    gi.setRGB(x, y - 1, red);
    gi.setRGB(x, y + 1, red);

    picLabel.setIcon(new ImageIcon(gi));
    panel.repaint();
  }
예제 #3
0
  private void findCtr() {
    int[] greypxls = imageUtils.convertToGrey(img);
    int[][] matrix = imageUtils.convertToMatrix(greypxls, img.getWidth(), img.getHeight());
    int[] ctr = imageUtils.findCenter(matrix, ctrMatrix, img.getWidth(), img.getHeight());
    BufferedImage imgwithctr = imageUtils.intToImage(greypxls, img.getWidth(), img.getHeight());

    // put red dot at returned point
    if (ctr[0] > 0 && ctr[0] < img.getWidth() && ctr[1] > 0 && ctr[1] < img.getHeight()) {
      int red = (255 << 16) + (0 << 8) + 0;
      imgwithctr.setRGB(ctr[0], ctr[1], red);
      imgwithctr.setRGB(ctr[0] - 1, ctr[1], red);
      imgwithctr.setRGB(ctr[0] + 1, ctr[1], red);
      imgwithctr.setRGB(ctr[0], ctr[1] - 1, red);
      imgwithctr.setRGB(ctr[0], ctr[1] + 1, red);
    }

    picLabel1.setIcon(new ImageIcon(imgwithctr));
    panel_1.repaint();
  }