Exemplo n.º 1
0
MyImage ReverseProcessor::preProcessImage(const MyImage& image) const
{
  QImage *resultImage = ImageAlgorithm::reverse(image.getImage());
  MyImage result(*resultImage, image.getType());
  delete resultImage;
  return result;
}
MyImage HistogramEqualizationProcessor::preProcessImage(const MyImage& image) const
{
  QImage *resultImage = processImage(image.getImage());
  MyImage result(*resultImage, MyImage::Gray);
  delete resultImage;
  return result;
}
Exemplo n.º 3
0
MyImage ToGrayProcessor::preProcessImage(const MyImage& image) const
{
  QImage *resultImage = ImageAlgorithm::convertToGrayScale(image.getImage(),
                                                           _type);
  MyImage result(*resultImage, MyImage::Gray);
  delete resultImage;
  return result;
}
ToBlackAndWhiteDialog::ToBlackAndWhiteDialog(const MyImage& image,
                                             const Area& area,
                                             QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ToBlackAndWhiteDialog),
    _area(area)
{
  ui->setupUi(this);

  _image = image.getImage();

  changing = false;
  single = true;
  black = true;
  singleThreshold = 0;

  thresholdItem = new ThresholdItem();
  plot = new BasicStatisticPlot(
      ImageAlgorithm::getStatistic(image.getImage(), ImageAlgorithm::Green));
  ui->widget_2->layout()->addWidget(plot);
  plot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
  thresholdItem->attach(plot);
  QVector<int> thresholds;
  thresholds.push_back(0);
  thresholdItem->setThresholds(thresholds);
  connect(thresholdItem,
          SIGNAL(thresholdChanged(QVector<int>)),
          this,
          SLOT(multipleChanged(QVector<int>)));
  xPlotPicker = new XPlotPicker(QwtPlot::xBottom,
                                QwtPlot::yLeft,
                                QwtPlotPicker::VLineRubberBand,
                                QwtPicker::AlwaysOn,
                                plot->canvas());
  xPlotPicker->setRubberBandPen(QColor(0, 0, 255, 160));
  xPlotPicker->setTrackerPen(QColor(0, 0, 255, 160));
  xPlotPicker->setEnabled(true);
  connect(xPlotPicker, SIGNAL(pressAt(int)), this, SLOT(singleChanged(int)));
  connect(ui->thresholdSpinBox,
          SIGNAL(valueChanged(int)),
          this,
          SLOT(singleChanged(int)));
  marker = new QwtPlotMarker();
  marker->setValue(0.0, 0.0);
  marker->setLineStyle(QwtPlotMarker::VLine);
  marker->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
  marker->setLinePen(QPen(Qt::green, 0, Qt::DashDotLine));
  marker->attach(plot);

  connect(ui->thresholdsEdit,
          SIGNAL(textEdited(QString)),
          this,
          SLOT(multipleTextChanged(QString)));
  connect(ui->blackButton,
          SIGNAL(toggled(bool)),
          this,
          SLOT(startWithBlack(bool)));
  connect(ui->whiteButton,
          SIGNAL(toggled(bool)),
          this,
          SLOT(startWithWhite(bool)));
  resetPreview();
}