本文整理汇总了C++中scaleImage函数的典型用法代码示例。如果您正苦于以下问题:C++ scaleImage函数的具体用法?C++ scaleImage怎么用?C++ scaleImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scaleImage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]);
}
开发者ID:OsipovStas,项目名称:ImageAnalysis,代码行数:32,代码来源:main.cpp
示例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();
}
开发者ID:boiarino17,项目名称:epics,代码行数:25,代码来源:imagewidget.cpp
示例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
}
开发者ID:siewertserau,项目名称:Examples-Imageproc-Unit-Test,代码行数:33,代码来源:imagetest.c
示例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();
}
开发者ID:sapr-bntu,项目名称:Pr51,代码行数:27,代码来源:mainwindow.cpp
示例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);
}
开发者ID:frederikgruell,项目名称:LocalizationMicroscopyViewer,代码行数:14,代码来源:locmicview.cpp
示例6: scaleImage
void ProtoWindow::zoomIn()
{
scaleImage(1.25);
this->imageLabel->update();
updateUI();
}
开发者ID:Guldenbart,项目名称:Projects,代码行数:7,代码来源:protowindow.cpp
示例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;
}
}
开发者ID:oscoder,项目名称:QCameraDecoder,代码行数:29,代码来源:cameravideosurface.cpp
示例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();
}
开发者ID:Guldenbart,项目名称:Projects,代码行数:30,代码来源:protowindow.cpp
示例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;
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:28,代码来源:RenderThemeSymbian.cpp
示例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");
}
开发者ID:DeaDiana,项目名称:_Graphics,代码行数:27,代码来源:mainwindow.cpp
示例11: scaleImage
void ScrollRedDotLabel::zoomOut()
{
if(ZoomOutBool)
{
scaleImage(0.8);
}
}
开发者ID:abdoudellal,项目名称:MSG2,代码行数:7,代码来源:scrollreddotlabel.cpp
示例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();
}
开发者ID:KDE,项目名称:pairs,代码行数:8,代码来源:mainwindowview.cpp
示例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;
}
开发者ID:z80,项目名称:avrusb,代码行数:8,代码来源:img_button.cpp
示例14: scaleLabelToFit
void SmartScrollArea::fitToWindow(bool checked) {
fittingwin=checked;
if (checked)
scaleLabelToFit();
else
// restore to the previous zoom factor
scaleImage(1);
}
开发者ID:adrianogebertgomes,项目名称:BUG,代码行数:8,代码来源:smart_scroll_area.cpp
示例15: scaleImage
void ImageWidget::zoomIn()
{
if(m_scaleFactor > 3)
{
return;
}
scaleImage(1.25);
}
开发者ID:zhming0,项目名称:Modernization-Traffic-Monitoring-System,代码行数:8,代码来源:imagewidget.cpp
示例16: scaleImage
void PreviewWidget::wheelEvent(QWheelEvent *event){
if (!preViewer->pixmap()) return;
if(event->modifiers()==Qt::ControlModifier){
float numDegrees = event->delta() / 8.0f;
float numSteps = numDegrees / 15.0f;
scaleImage(pow(1.4,numSteps));
event->accept();
} else QScrollArea::wheelEvent(event);
}
开发者ID:Axure,项目名称:TeXstudio,代码行数:9,代码来源:toolwidgets.cpp
示例17: scaleImage
void MainWindow::zoomOut()
{
if( ui->actionFitToWindow->isChecked() == true)
{
ui->actionFitToWindow->setChecked(false);
//fitToWindow();
}
scaleImage(0.95);
}
开发者ID:sapr-bntu,项目名称:Pr51,代码行数:9,代码来源:mainwindow.cpp
示例18: prepareSurface
static QImage prepareSurface(QImage img, int w, int h)
{
img = scaleImage(img, w, h);
// slightly larger, to accomodate for the reflection
int hs = h * 2;
int hofs = h / 3;
// offscreen buffer: black is sweet
QImage result(hs, w, QImage::Format_RGB32);
result.fill(0);
// transpose the image, this is to speed-up the rendering
// because we process one column at a time
// (and much better and faster to work row-wise, i.e in one scanline)
for(int x = 0; x < w; x++)
for(int y = 0; y < h; y++)
result.setPixel(hofs + y, x, img.pixel(x, y));
// create the reflection
int ht = hs - h - hofs;
int hte = ht;
for(int x = 0; x < w; x++)
for(int y = 0; y < ht; y++)
{
QRgb color = img.pixel(x, img.height()-y-1);
int a = qAlpha(color);
int r = qRed(color) * a / 256 * (hte - y) / hte * 3/5;
int g = qGreen(color) * a / 256 * (hte - y) / hte * 3/5;
int b = qBlue(color) * a / 256 * (hte - y) / hte * 3/5;
result.setPixel(h+hofs+y, x, qRgb(r, g, b));
}
#ifdef PICTUREFLOW_BILINEAR_FILTER
int hh = BILINEAR_STRETCH_VER*hs;
int ww = BILINEAR_STRETCH_HOR*w;
result = scaleImage(result, hh, ww);
#endif
return result;
}
开发者ID:ashang,项目名称:fqterm,代码行数:41,代码来源:pictureflow.cpp
示例19: qMin
void MainWindow::fitToWindow() {
if (!imageLabel->pixmap()) {
return;
}
double factor = qMin(
ui->scrollArea->width()/((double)inputImage->width()),
ui->scrollArea->height()/((double)inputImage->height()));
if (factor > 1) {
factor = 1;
}
scaleImage(factor);
}
开发者ID:413x,项目名称:SmartDeblur,代码行数:13,代码来源:MainWindow.cpp
示例20: scaleImage
void rescalethread::run()
{
//this is the routine that will run when the thread is triggered by start() method in the parent
for(int index=0;index<imageFilesList.count();index++)
{
//call the method to scale image, pass the current filename from the list
scaleImage(QDir::toNativeSeparators(imageFilesList.at(index)), index);
}
//re-implemented finished signal emited when all the image resizing was done succesfully
emit finished();
}
开发者ID:krithik,项目名称:qt-image-resizer,代码行数:14,代码来源:rescalethread.cpp
注:本文中的scaleImage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论