private void Esqueleto_Click(object sender, EventArgs e) { Imagem process = new Imagem(); Imagem entrada = new Imagem(); Imagem op = new Imagem(); Imagem saida = new Imagem(); saida.CreatePlainImage(imagens[count - 1].MatrizCor.Width, imagens[count - 1].MatrizCor.Height, 0); process.Clone(imagens[count - 1]); //armazena a saida entrada.Clone(imagens[count - 1]); //armazena a entrada erodida op.Clone(imagens[count - 1]); //Imagem que sofre abertura while (!entrada.IsNull()) { op.Erosao(ElEst.quadrado, 1, 1, null); op.Dilatacao(ElEst.quadrado, 1, 1, null); process.MathOp(MathOperationType.subtracao, op); saida.LogicOp(LogicOperationType.or, process); entrada.Erosao(ElEst.quadrado, 3, 3, null); process.Clone(entrada); op.Clone(entrada); } Imagem combo = new Imagem(); combo.Clone(imagens[count - 1]); Visualizar(saida, "Esqueletização " + saida.NomeArquivo()); combo.MathOp(MathOperationType.subtracao, saida); combo.CorrecaoMinMax(Correcao.limiar); Visualizar(combo, "Esqueletização " + saida.NomeArquivo()); }
private void MediaImagens_Click(object sender, EventArgs e) { Imagem imagem = new Imagem(); imagem.Clone(imagens[count - 1]); bool cond = true; int k = 1; while (k < count && cond) { cond = imagem.MatrizCor.Width >= imagens[k].MatrizCor.Width && imagem.MatrizCor.Height >= imagens[k++].MatrizCor.Height; } if (cond) { for (k = 1; k < count; k++) { imagem.MathOp(MathOperationType.adicao, imagens[k]); } Imagem divisor = new Imagem(); divisor.CreatePlainImage(imagem.MatrizCor.Width, imagem.MatrizCor.Height, count); imagem.MathOp(MathOperationType.divisao, divisor); Visualizar(imagem, "Média de " + (count) + " imagens"); } else { MessageBox.Show("Imagens possuem resoluções diferentes!"); } }
public void AddBorder(int rx, int ry, int v) { int x, y, c, w = this.MatrizCor.Width + 2 * rx, h = this.MatrizCor.Height + 2 * ry; var aux = new Imagem(); aux.CreatePlainImage(w, h, v); for (x = 0; x < MatrizCor.Width; x++) { for (y = 0; y < MatrizCor.Width; y++) { for (c = 0; c < 3; c++) { aux.MatrizCor.Matriz[x + rx, y + ry, c] = MatrizCor.Matriz[x, y, c]; } } } this.MatrizCor.Matriz = aux.MatrizCor.Matriz; this.MatrizCor.Height = h; this.MatrizCor.Width = w; }