本文整理汇总了C++中scaleImage函数的典型用法代码示例。如果您正苦于以下问题:C++ scaleImage函数的具体用法?C++ scaleImage怎么用?C++ scaleImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scaleImage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: task1
bool task1(const cv::Mat& image) {
cv::Mat manual, buildIn, diff, tmp;
std::vector<cv::Mat> channels;
scaleImage(image, manual, 2, 100);
image.convertTo(buildIn, -1, 2, 100);
cv::absdiff(manual, buildIn, diff);
cv::split(diff, channels);
std::cout << "Max difference element: ";
for (VMit it = channels.begin(); it != channels.end(); ++it) {
int max = *(std::max_element((*it).begin<uchar>(), (*it).end<uchar>()));
std::cout << max << " ";
}
std::cout << std::endl;
std::vector<cv::Mat> scales(5, cv::Mat());
std::vector<cv::Mat> dst(2, cv::Mat());
for (int i = 0; i < task1c; ++i) {
scaleImage(image, scales[i], task1v[2 * i], task1v[2 * i + 1]);
}
concatImages(scales[0], scales[1], dst[0]);
concatChannels(dst[0], dst[0]);
concatImages(scales[2], scales[3], dst[1]);
concatImages(dst[1], scales[4], dst[1]);
concatChannels(dst[1], dst[1]);
return cv::imwrite(PATH + "Task1Lena01.jpg", dst[0]) && cv::imwrite(PATH + "Task1Lena345.jpg", dst[1]);
}
示例2: scaleImage
void ImageWidget::updateImage(bool zoom, const QImage &image, bool valuesPresent[], int values[])
{
if(zoom) {
QImage imageNew = scaleImage(image);
if(imageNew.isNull()) return;
#ifndef QT_NO_CONCURRENT
QFuture<QImage> future = QtConcurrent::run(this, &ImageWidget::scaleImage, image);
imageNew = future.result();
#else
QImage imageNew = scaleImage(image);
#endif
pixmap = QPixmap::fromImage(imageNew);
} else {
pixmap = QPixmap::fromImage(image);
}
for(int i=0; i<4; i++) {
drawValues[i] = valuesPresent[i];
if(drawValues[i]) geoValues[i] = values[i];
else geoValues[i] = 0;
}
update();
}
示例3: main
void main(int argc, char *argv[])
{
char header[512];
unsigned char img[640*480*3], newimg[640*480*3];
int bufflen, hdrlen; unsigned row=0, col=0, chan=0, pix; int i, j, k;
double alpha=1.25; unsigned char beta=25;
if(argc < 2)
{
printf("Use: brighten inputfile\n");
exit(-1);
}
// TEST CASE #0
//
// Basic PPM file read, scaling and bias test, and write-back
//
header[0]='\0';
readppm(img, &bufflen, header, &hdrlen, &row, &col, &chan, argv[1]);
alpha=1.25, beta =25;
scaleImage(img, newimg, row, col, chan, alpha, beta);
writeppm(newimg, bufflen, header, hdrlen, "brighter-1.25-25.ppm");
alpha=1.5, beta =50;
scaleImage(img, newimg, row, col, chan, alpha, beta);
writeppm(newimg, bufflen, header, hdrlen, "brighter-1.5-50.ppm");
//
// END TEST CASE #0
}
示例4: normalSize
void MainWindow::fitToWindow()
{
bool fitToWindow = ui->actionFitToWindow->isChecked();
ui->scrollArea->setWidgetResizable(fitToWindow);
ui->scrollArea->setWidgetResizable(false);
if (!fitToWindow) {
normalSize();
}
else
{
double ssh=sh*scaleFactor;
double ssw=sh*scaleFactor;
double sch=ui->scrollArea->height();
double scw=ui->scrollArea->width();
double mh=sch/ssh;
double mw=scw/ssw;
if (mh<mw)
{
scaleImage(mh);
}
else
{
scaleImage(mw);
}
}
updateActions();
}
示例5: scaleImage
void LocMicView::wheelEvent(QWheelEvent* event)
{
//std::cerr << "wheelEvent " << event->delta() << std::endl;
if(event->delta() < 0) {
scaleImage(1.0 / scaleStepFactor);
} else {
scaleImage(scaleStepFactor);
}
//QScrollArea::wheelEvent(event);
}
示例6: scaleImage
void ProtoWindow::zoomIn()
{
scaleImage(1.25);
this->imageLabel->update();
updateUI();
}
示例7: surfaceFormat
bool CameraVideoSurface::present (const QVideoFrame &frame)
{
m_frame = frame;
if (surfaceFormat().pixelFormat() != m_frame.pixelFormat() ||
surfaceFormat().frameSize() != m_frame.size()) {
stop();
return false;
} else {
m_frame.map(QAbstractVideoBuffer::ReadOnly);
frWidth = m_frame.width();
frHeight = m_frame.height();
int line = m_frame.bytesPerLine();
// build QImage from frame
m_completeImage = QImage(
m_frame.bits(),
frWidth, frHeight,
line,
m_frame.imageFormatFromPixelFormat(m_frame.pixelFormat()));
m_frame.unmap();
QImage dstImage = scaleImage(m_completeImage);
m_frame = QVideoFrame(dstImage);
// enlarge faces
m_target->updateVideo();
return true;
}
}
示例8: save
/*
* Aktionen, die ausgeführt werden müssen, wenn der 'zurück'-Knopf gedrückt wurde.
*/
void ProtoWindow::on_backPushButton_clicked()
{
// Daten des "alten" Bildes müssen gespeichert werden.
save();
/*
* Textdatei erstellen, falls nicht vorhanden.
*
* Daten in Textdatei schreiben. Dabei werden die alten Daten für dieses Bild überschrieben.
* Die Daten werden in der folgenden Reihenfolge gespeichert:
* "&"Dateiname(mit Endung)$bildbeschreibung"$"x-Koordinate"%"y-Koordinate"%"Text"$"nächstes Quadrat..."&"
*
* Bis auf Weiteres wird der gesamte Inhalt der Datei neu gespeichert.
*/
// current-Counter eins runterzaehlen, damit das naechste Bild angezeigt wird
if (this->currentIndex-1 < 0) {
this->currentIndex = this->dirVec.size()-1;
} else {
this->currentIndex = (this->currentIndex-1) % (this->dirVec.size());
}
QString fileName = this->dirVec[currentIndex];
showNextImage((this->curDir.absoluteFilePath(fileName)));
scaleImage(fittingSize("on_backPushButton_clicked"));
updateUI();
}
示例9: paintButtonDecorations
bool RenderThemeSymbian::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
if (!m_radioButtonOn) {
m_radioButtonOn = Image::loadPlatformResource("radioButtonOn");
m_radioButtonOff = Image::loadPlatformResource("radioButtonOff");
}
paintButtonDecorations(o, i, r);
MScrollView* wv = scrollView(i);
// don't scale the checkbox if scalingFactor is 100% or we are in the process of scaling another image
if (wv->scalingFactor() <= 100 || m_bitmapScaler) {
i.context->drawImage(isChecked(o)?m_radioButtonOn:m_radioButtonOff,r);
}
// use the cached scaled image if it has the same scaling factor
else if (wv->scalingFactor() == (isChecked(o) ? m_scalingForRadioOn : m_scalingForRadioOff)) {
i.context->drawImage(isChecked(o) ? m_scaledRadioOn : m_scaledRadioOff, r);
}
// scale
else {
scaleImage(isChecked(o) ? ERadioOn : ERadioOff, wv->scalingFactor());
if (wv->scalingFactor() == (isChecked(o) ? m_scalingForRadioOn : m_scalingForRadioOff)) {
i.context->drawImage(isChecked(o) ? m_scaledRadioOn : m_scaledRadioOff, r);
}
else {
i.context->drawImage(isChecked(o)?m_radioButtonOn:m_radioButtonOff,r);
}
}
return false;
}
示例10: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
default_scale = 1;
current_scale = 1;
image.load(":/aliceA.png");
scaled = image;
files_names = QStringList();
pImage_lbl = new QLabel();
pImage_lbl->setAlignment(Qt::AlignCenter);
ui->imageArea->setWidget(pImage_lbl);
ui->imageArea->setBackgroundRole(QPalette::NoRole);
loadListOfFiles();
setAcceptDrops(true);
connect(&interpret, SIGNAL(ready(QImage)), this, SLOT(updateImage(QImage)));
connect(ui->gammaSlider, SIGNAL(sliderReleased()), this, SLOT(refreshGamma()));
connect(ui->zoomSlider, SIGNAL(sliderReleased()), this, SLOT(scaleImage()));
connect(ui->filesList, SIGNAL(itemSelectionChanged()), this, SLOT(restoreDefaultScale()));
connect(ui->filesList, SIGNAL(currentTextChanged(QString)), this, SLOT(updateImage(QString)));
updateImage("aliceA.png");
}
示例11: scaleImage
void ScrollRedDotLabel::zoomOut()
{
if(ZoomOutBool)
{
scaleImage(0.8);
}
}
示例12: image
void MainWindowView::backSelected()
{
QString newFile = m_parent->copyFile(m_ui->backKurl);
m_ui->backKurl->setText(m_ui->backKurl->url().fileName());
QPixmap image(newFile);
m_ui->pixLabel->setPixmap(scaleImage(image, 100));
emit changed();
}
示例13: scaleImage
const QPixmap & CImgButton::image( const QString & name, qint64 & cacheKey ) const
{
if ( m_picsSz.contains( cacheKey ) )
return *m_picsSz[ cacheKey ];
const QPixmap & pm = scaleImage( name );
cacheKey = pm.cacheKey();
return pm;
}
示例14: scaleLabelToFit
void SmartScrollArea::fitToWindow(bool checked) {
fittingwin=checked;
if (checked)
scaleLabelToFit();
else
// restore to the previous zoom factor
scaleImage(1);
}
示例15: scaleImage
void ImageWidget::zoomIn()
{
if(m_scaleFactor > 3)
{
return;
}
scaleImage(1.25);
}