Example #1
0
void __fastcall TForm5::Button1Click(TObject *Sender)
{
	TImage *First,*Second,*Result;
	switch(RadioGroup1->ItemIndex)
	{
		case 1: First=ImgB;
		break;
		case 2: First=ImgC;
		break;
		default: First=ImgA;
	}
	switch(RadioGroup2->ItemIndex)
	{
		case 0: Second=ImgA;
		break;
		case 2: Second=ImgC;
		break;
		default: Second=ImgB;
	}

	switch(RadioGroup3->ItemIndex)
	{
		case 0: Result=ImgA;
		break;
		case 1: Result=ImgB;
		break;
		default: Result=ImgC;
	}

	if(!(First->Picture->Bitmap->HandleAllocated())||First->Picture->Bitmap->PixelFormat!=pf8bit)
	{
		ShowMessage("First image must contain a grayscale image for this operation");
		return;
	}

	if(!(Second->Picture->Bitmap->HandleAllocated())||Second->Picture->Bitmap->PixelFormat!=pf8bit)
	{
		ShowMessage("Second Image must contain a grayscale image for this operation");
		return;
	}

	if(Result->Picture->Bitmap->HandleAllocated())
	if(mrCancel==MessageDlg("Current image at the resulting image position will be lost. Press OK to continue.",
				mtConfirmation,mbOKCancel,0))return;

	switch(RadioGroup4->ItemIndex)
	{
		case 0: addImages(First,Second,Result);
		break;
		case 1: subtractImages(First,Second,Result);
		break;
		default: averageImages(First,Second,Result);
	}

	Result->Refresh();
	Form5->Hide();
}
Example #2
0
void ScreenieControl::handleFilePathsDrop(QStringList filePaths, QPointF centerPosition)
{
    ScreenieTemplateModel *templateModel;
    if (!d->screenieScene.hasTemplates()) {
        addImages(filePaths, centerPosition);
    } else {
        QList<ScreenieTemplateModel *> templateModels = d->templateOrganizer.getOrderedTemplates();
        int i = 0;
        int n = filePaths.count();
        QList<ScreenieTemplateModel *>::const_iterator it = templateModels.constBegin();
        while (i < n && it != templateModels.constEnd()) {
            templateModel = *it;
            QString filePath = filePaths.at(i);
            updateFilePathModel(filePath, *templateModel);
            i++;
            it++;
        }
    }
}
Example #3
0
void ScreenieControl::handleImageDrop(QList<QImage> images, QPointF centerPosition)
{
    ScreenieTemplateModel *templateModel;
    if (!d->screenieScene.hasTemplates()) {
        addImages(images, centerPosition);
    } else {
        QList<ScreenieTemplateModel *> templateModels = d->templateOrganizer.getOrderedTemplates();
        int i = 0;
        int n = images.count();
        QList<ScreenieTemplateModel *>::const_iterator it = templateModels.constBegin();
        while (i < n && it != templateModels.constEnd()) {
            templateModel = *it;
            QImage image = images.at(i);
            updateImageModel(image, *templateModel);
            i++;
            it++;
        }
    }
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: about(); break;
        case 1: changeStyle((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 2: changeSize((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: changeSize(); break;
        case 4: changeIcon(); break;
        case 5: addImages(); break;
        case 6: removeAllImages(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
IE_Exp_OpenXML_Listener::IE_Exp_OpenXML_Listener(PD_Document* doc)
  : pdoc(doc), 
	tableHelper(doc), 
	document(NULL), 
	section(NULL), 
	savedSection(NULL),
	paragraph(NULL), 
	savedParagraph(NULL),
	hyperlink(NULL),
	textbox(NULL),
	bInHyperlink(false),
	bInTextbox(false),
	idCount(10) //the first ten IDs are reserved for the XML file references
{
	document = OXML_Document::getNewInstance();
	
	if(!pdoc->tellListener(static_cast<PL_Listener *>(this)))
		document = NULL;	

	if(setPageSize() != UT_OK)
	{
		UT_DEBUGMSG(("FRT: ERROR, Setting page size failed\n"));	
	}
	if(addDocumentStyles() != UT_OK)
	{
		UT_DEBUGMSG(("FRT: ERROR, Adding Document Styles Failed\n"));	
		document = NULL;
	}
	if(addLists() != UT_OK)
	{
		UT_DEBUGMSG(("FRT: ERROR, Adding Lists Failed\n"));	
		document = NULL;
	}
	if(addImages() != UT_OK)
	{
		UT_DEBUGMSG(("FRT: ERROR, Adding Images Failed\n"));	
		document = NULL;
	}
}
Example #6
0
flameWindow::flameWindow(QWidget *parent) : QDialog(parent) 
{
	
	setGeometry( 50, 50, 475, 240 );
	setWindowTitle(" AlphaFlame Effect Settings ");
	
	command = new QLineEdit("aftool list.txt 10 output.png");
	slider = new QSlider(Qt::Horizontal);
	slider->setRange(1, 500);
	QLabel *lbl = new QLabel ("Command: ");
	QHBoxLayout *v = new QHBoxLayout;
	command->setFixedSize(140, 23);	
	
	connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
	
	v->addWidget(lbl);
	v->addWidget(command);
	v->addWidget(slider);
	
	QVBoxLayout *vbox = new QVBoxLayout;
	QHBoxLayout *vv = new QHBoxLayout;
	
	QLabel *lbl2 = new QLabel(" Morph: ");
	vv->addWidget(lbl2);
	
	cbox = new QCheckBox("first");
	vv->addWidget(cbox);
	
	add_image = new QPushButton("Add Images");
	clear_list = new QPushButton("Clear List");
	
	vv->addWidget(add_image);
	vv->addWidget(clear_list);
	
	clear_list->setEnabled(false);
	
	cbox->setChecked( true );

	connect(add_image, SIGNAL(clicked()), this, SLOT(addImages()));
	connect(clear_list, SIGNAL(clicked()), this, (SLOT(clrList())));
	
	images = new QListWidget();
	
	QHBoxLayout *vvv = new QHBoxLayout;
	
	vvv->addWidget(images);
	
	QHBoxLayout *v4 = new QHBoxLayout;
	
	flame = new QPushButton(" AlphaFlame It ");
	flame->setEnabled(false);
	
	connect(flame, SIGNAL(clicked()), this, SLOT(flameIt()));
		
	QLabel *l = new QLabel(" Press Button when Ready: ");
	
	v4->addWidget(l);
	v4->addWidget(flame);
		
	vbox->addItem(v);
	vbox->addItem(vv);
	vbox->addItem(vvv);
	vbox->addItem(v4);
	
	setLayout(vbox);
	slider->setSliderPosition(10);
	command->setReadOnly(true);
	
	setWindowIcon(QIcon(pathstr+"img/icon.png"));
	
		
}
Example #7
0
void StereoCalibrationInfo::FromImages(char const* prefix)
{
    int i = 0;
    cv::Mat imageR, imageL;
    while(loadStereoImages(imageR, imageL, prefix, i++)) {
        addImages(imageR, imageL);
    }
	std::cerr << "*** right result of calibrateCamera:" << std::endl;
    bool calR = r.calibrate();
	std::cerr << "*** left result of calibrateCamera:" << std::endl;
    bool calL = l.calibrate();
    if(calR && calL) {
        cameraMatrixR = r.CameraMatrix().clone();
        distCoeffsR = r.DistCoeffs().clone();
        cameraMatrixL = l.CameraMatrix().clone();
        distCoeffsL = l.DistCoeffs().clone();

        std::cerr << "*** result of stereoCalibrate:" << std::endl;
        double reprojectionError = cv::stereoCalibrate(r.ObjectPoints(),
                this->l.ImagePoints(), this->r.ImagePoints(),
                this->cameraMatrixL, this->distCoeffsL,
                this->cameraMatrixR, this->distCoeffsR,
                this->r.ImageSize(),
                this->R, this->T, this->E, this->F);
        std::cerr << "reprojection error: " << reprojectionError << std::endl;
        std::cerr << "cameraMatrixR : " << std::endl << this->cameraMatrixR << std::endl;
        std::cerr << "distCoeffsR : " << std::endl << this->distCoeffsR << std::endl;
        std::cerr << "cameraMatrixL : " << std::endl << this->cameraMatrixL << std::endl;
        std::cerr << "distCoeffsL : " << std::endl << this->distCoeffsL << std::endl;
        std::cerr << "R: " << std::endl << this->R << std::endl;
        std::cerr << "T: " << std::endl << this->T << std::endl;
        std::cerr << "E: " << std::endl << this->E << std::endl;
        std::cerr << "F: " << std::endl << this->F << std::endl;

        cv::stereoRectify(
                this->cameraMatrixL, this->distCoeffsL,
                this->cameraMatrixR, this->distCoeffsR,
                this->r.ImageSize(), this->R, this->T,
                this->R1, this->R2, this->P1, this->P2, this->Q);
        std::cerr << "*** result of stereoRectify:" << std::endl;
        std::cerr << "R1: " << std::endl << this->R1 << std::endl;
        std::cerr << "R2: " << std::endl << this->P2 << std::endl;
        std::cerr << "P1: " << std::endl << this->R1 << std::endl;
        std::cerr << "P2: " << std::endl << this->P2 << std::endl;
        std::cerr << "Q: " << std::endl << this->Q << std::endl;

        cv::initUndistortRectifyMap(
                this->cameraMatrixR, this->distCoeffsR, this->R2,
                this->P2, this->r.ImageSize(), CV_32FC1,
                this->mapR1, this->mapR2);
        std::cerr << "*** right result of initUndistortRectifyMap:" << std::endl;
        std::cerr << "mapR1.cols: " << this->mapR1.cols << std::endl;
        std::cerr << "mapR1.rows: " << this->mapR1.rows << std::endl;
        std::cerr << "mapR2.cols: " << this->mapR2.cols << std::endl;
        std::cerr << "mapR2.rows: " << this->mapR2.rows << std::endl;

        cv::initUndistortRectifyMap(
                this->cameraMatrixL, this->distCoeffsL, this->R1,
                this->P1, this->l.ImageSize(), CV_32FC1,
                this->mapL1, this->mapL2);
        std::cerr << "*** left result of initUndistortRectifyMap:" << std::endl;
        std::cerr << "mapL1.cols: " << this->mapL1.cols << std::endl;
        std::cerr << "mapL1.rows: " << this->mapL1.rows << std::endl;
        std::cerr << "mapL2.cols: " << this->mapL2.cols << std::endl;
        std::cerr << "mapL2.rows: " << this->mapL2.rows << std::endl;
    }
}
Example #8
0
void ScreenieControl::addImage(QImage image, QPointF centerPosition)
{
    QList<QImage> images;
    images.append(image);
    addImages(images, centerPosition);
}
Example #9
0
void ScreenieControl::addImage(QString filePath, QPointF centerPosition)
{
    QStringList filePaths(filePath);
    addImages(filePaths, centerPosition);
}
Example #10
0
NewGameTab::NewGameTab(const QStringList& files, QDialog* parent)
	: QWidget(parent)
{
	// Add image filter
	m_image_tags = new TagManager(this);
	connect(m_image_tags, &TagManager::filterChanged, this, &NewGameTab::filterImages);
	connect(m_image_tags, &TagManager::tagsChanged, this, &NewGameTab::updateTagsStrings);

	// Add image selector
	m_images = new ToolBarList(this);
	m_images->setViewMode(QListView::IconMode);
	m_images->setIconSize(QSize(74, 74));
	m_images->setMinimumSize(460 + m_images->verticalScrollBar()->sizeHint().width(), 230);
	m_images->setItemDelegate(new ThumbnailDelegate(m_images));
	connect(m_images, &ToolBarList::currentItemChanged, this, &NewGameTab::imageSelected);
	connect(m_images, &ToolBarList::itemActivated, this, &NewGameTab::editImageProperties);

	// Add image actions
	QAction* add_action = new QAction(m_images->fetchIcon("list-add"), tr("Add Image"), this);
	m_images->addToolBarAction(add_action);
	connect(add_action, &QAction::triggered, this, &NewGameTab::addImageClicked);

	m_remove_action = new QAction(m_images->fetchIcon("list-remove"), tr("Remove Image"), this);
	m_images->addToolBarAction(m_remove_action);
	connect(m_remove_action, &QAction::triggered, this, &NewGameTab::removeImage);

	m_tag_action = new QAction(m_images->fetchIcon("image-x-generic"), tr("Image Properties"), this);
	m_images->addToolBarAction(m_tag_action);
	connect(m_tag_action, &QAction::triggered, this, &NewGameTab::editImageProperties);

	// Add image splitter
	m_image_contents = new QSplitter(this);
	m_image_contents->addWidget(m_image_tags);
	m_image_contents->addWidget(m_images);
	m_image_contents->setStretchFactor(0, 0);
	m_image_contents->setStretchFactor(1, 1);
	m_image_contents->setSizes(QList<int>() << 130 << m_images->minimumWidth());

	// Add pieces slider
	m_slider = new QSlider(Qt::Horizontal, this);
	m_slider->setRange(1, 1);
	connect(m_slider, &QSlider::valueChanged, this, &NewGameTab::pieceCountChanged);

	m_count = new QLabel(this);
	m_count->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	m_count->setMinimumWidth(m_count->fontMetrics().boundingRect(tr("%L1 pieces").arg(9999)).width());

	// Add buttons
	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
	connect(buttons, &QDialogButtonBox::accepted, this, &NewGameTab::accept);
	connect(buttons, &QDialogButtonBox::rejected, parent, &QDialog::reject);

	m_accept_button = buttons->button(QDialogButtonBox::Ok);
	m_accept_button->setEnabled(false);

	// Arrange widgets
	QGridLayout* layout = new QGridLayout(this);
	layout->setColumnStretch(1, 1);
	layout->setRowStretch(0, 1);
	layout->addWidget(m_image_contents, 0, 0, 1, 2);
	layout->setRowMinimumHeight(1, 12);
	layout->addWidget(m_count, 2, 0);
	layout->addWidget(m_slider, 2, 1);
	layout->setRowMinimumHeight(3, 12);
	layout->addWidget(buttons, 4, 0, 1, 2);

	// Load images
	QSettings details(Path::image("details"), QSettings::IniFormat);
	QListWidgetItem* item = 0;
	for (const QString& image : QDir(Path::images(), "*.*").entryList(QDir::Files, QDir::Time | QDir::Reversed)) {
		item = createItem(image, details);
	}
	m_images->sortItems();

	// Load values
	QSettings settings;
	item = m_images->item(0);
	QString image = settings.value("NewGame/Image").toString();
	if (!image.isEmpty()) {
		for (int i = m_images->count() - 1; i >= 0; --i) {
			item = m_images->item(i);
			if (item->data(ImageRole) == image) {
				break;
			}
		}
	}
	m_images->setCurrentItem(item);
	m_slider->setValue(settings.value("NewGame/Pieces", 2).toInt());
	pieceCountChanged(m_slider->value());

	// Add new images
	addImages(files);

	// Resize contents
	m_image_contents->restoreState(settings.value("NewGame/SplitterSizes").toByteArray());
}
Example #11
0
void NewGameTab::addImageClicked()
{
	addImages(AddImage::getOpenFileNames(this));
}