Пример #1
0
void MainWindow::on_showImageCustomFilterButton_clicked()
{
    if(ui->spinBox_51->value() != 0)
    {
        int ** conversionMatrix;
        conversionMatrix = new int * [5];
        for(int i = 0; i<5 ; i++)
        {
            conversionMatrix [i] = new int[5];
        }
        conversionMatrix[0][0] = (int)ui->spinBox->value();
        conversionMatrix[0][1] = (int)ui->spinBox_2->value();
        conversionMatrix[0][2] = (int)ui->spinBox_3->value();
        conversionMatrix[0][3] = (int)ui->spinBox_4->value();
        conversionMatrix[0][4] = (int)ui->spinBox_5->value();

        conversionMatrix[1][0] = (int)ui->spinBox_6->value();
        conversionMatrix[1][1] = (int)ui->spinBox_7->value();
        conversionMatrix[1][2] = (int)ui->spinBox_8->value();
        conversionMatrix[1][3] = (int)ui->spinBox_9->value();
        conversionMatrix[1][4] = (int)ui->spinBox_10->value();

        conversionMatrix[2][0] = (int)ui->spinBox_11->value();
        conversionMatrix[2][1] = (int)ui->spinBox_12->value();
        conversionMatrix[2][2] = (int)ui->spinBox_13->value();
        conversionMatrix[2][3] = (int)ui->spinBox_14->value();
        conversionMatrix[2][4] = (int)ui->spinBox_15->value();

        conversionMatrix[3][0] = (int)ui->spinBox_16->value();
        conversionMatrix[3][1] = (int)ui->spinBox_17->value();
        conversionMatrix[3][2] = (int)ui->spinBox_18->value();
        conversionMatrix[3][3] = (int)ui->spinBox_19->value();
        conversionMatrix[3][4] = (int)ui->spinBox_20->value();

        conversionMatrix[4][0] = (int)ui->spinBox_21->value();
        conversionMatrix[4][1] = (int)ui->spinBox_22->value();
        conversionMatrix[4][2] = (int)ui->spinBox_23->value();
        conversionMatrix[4][3] = (int)ui->spinBox_24->value();
        conversionMatrix[4][4] = (int)ui->spinBox_25->value();

        Filters * newFilter = new Filters(imageBefore, conversionMatrix);
        newFilter->setSizeMatrix(5);
        newFilter->customFilter(ui->spinBox_51->value(), ui->spinBox_52->value());

        for(int i = 0; i<5; i++)
            delete []conversionMatrix[i];
        delete []conversionMatrix;

        imageAfter = newFilter->getImageAfter();
        showImageAfter();
    }
    else
    {
        QMessageBox::information(this, tr("Wrong scale value"),tr("Scale = \"0\"! Division by 0... Format C: in 3... 2... 1..."));
    }
}
Пример #2
0
void MainWindow::denoisingFilter()
{
    Filters * newFilter = new Filters();
    newFilter->setSizeMatrix(7);
    newFilter->denoisingFilter(imageBefore);
    for(int i = 0 ; i < 1 ; i++)
    {
        imageAfter = newFilter->getImageAfter();
        newFilter->denoisingFilter(imageAfter);
    }
    imageAfter = newFilter->getImageAfter();
    showImageAfter();
}