博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
QImage
阅读量:4159 次
发布时间:2019-05-26

本文共 7558 字,大约阅读时间需要 25 分钟。

支持的图像格式:

BMP ,GIF , JPG , JPEG, PNG, PBM, PGM, PPM, XBM, XPM




//使用给定的大小和格式构造图像

QImage(const QSize &size, Format format)



//使用给定的大小和格式构造图像

QImage(int width, int height, Format format)



//用给定的宽度、高度和格式构造图像,使用一个已有的内存缓冲区、数据。宽度和高度必须指定像素,数据必须是32位对齐,每个扫描线的图像数据中也必须是32位对齐。

QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR)

QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR)

QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR)

QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR)



//从给定的xpm图像构造图像

QImage(const char * const[] xpm)



//从给定的文件名加载图像

QImage(const QString &fileName, const char *format = Q_NULLPTR)



//如果这是灰度图像返回真,否则为假

bool allGray() const



//返回图像位数

int bitPlaneCount() const



//获取图像首地址

uchar *bits()



//获取图像首地址,不进行深度拷贝

const uchar *bits() const



//图像总字节数

int byteCount() const



//图像每行字节数

int bytesPerLine() const



//返回标识该QImage对象的内容数量

qint64 cacheKey() const



//返回颜色表中的颜色

QRgb color(int i) const



//返回颜色表大小

int colorCount() const



//返回图像在颜色表中包含的颜色的列表

QVector<QRgb> colorTable() const



//返回像素首地址,该函数不进行深度拷贝

const uchar *constBits() const



//返回从I开始的指向扫描线的指针

const uchar *constScanLine(int i) const



//返回指定格式的图像

QImage convertToFormat(Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) const

QImage convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const



//返回图像的子区域作为一个新图像

QImage copy(const QRect &rectangle = QRect()) const

QImage copy(int x, int y, int width, int height) const



//按指定格式返回一个遮罩图像

QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const



//创建遮罩

QImage createHeuristicMask(bool clipTight = true) const



//根据给定的颜色创建遮罩

QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const



//返回图片深度

int depth() const



//返回图像的设备像素比例

qreal devicePixelRatio() const



//返回X的像素数

int dotsPerMeterX() const



//返回Y的像素数

int dotsPerMeterY() const



//以给定的值填充整个图像

void fill(uint pixelValue)

void fill(const QColor &color)

void fill(Qt::GlobalColor color)



//返回图像格式

Format format() const



//是否有Alpha通道

bool hasAlphaChannel() const



//图像高度

int height() const



//反转图像的像素,只有当图像的深度为32位,给定的反转模式才有意义

void invertPixels(InvertMode mode = InvertRgb)



//如果是灰度图像

bool isGrayscale() const



//图像是否为空

bool isNull() const



//加载图像

bool load(const QString &fileName, const char *format = Q_NULLPTR)

bool load(QIODevice *device, const char *format)



//从第Len个字节的二进制数据加载一个图像

bool loadFromData(const uchar *data, int len, const char *format = Q_NULLPTR)

bool loadFromData(const QByteArray &data, const char *format = Q_NULLPTR)



//返回图像镜像

QImage mirrored(bool horizontal = false, bool vertical = true) const



//返回图像偏移量

QPoint offset() const



//返回指定坐标像素的RGB

QRgb pixel(const QPoint &position) const

QRgb pixel(int x, int y) const



//返回指定坐标像素的Color

QColor pixelColor(const QPoint &position) const

QColor pixelColor(int x, int y) const



//返回像素格式

QPixelFormat pixelFormat() const



//返回给定位置的像素索引

int pixelIndex(const QPoint &position) const

int pixelIndex(int x, int y) const



//返回图像矩形

QRect rect() const



//红色和蓝色交换,返回交换后的图像

QImage rgbSwapped() const



//使用给定的文件名格式和质量因子,把图像保存到给定文件名中,返回TRUE

bool save(const QString &fileName, const char *format = Q_NULLPTR, int quality = -1) const

bool save(QIODevice *device, const char *format = Q_NULLPTR, int quality = -1) const



//返回缩放后的图像

//Qt::IgnoreAspectRatio
忽略纵横比,拉伸到指定大小

//Qt::KeepAspectRatio
保持纵横比,宽度与矩形对齐

//Qt::KeepAspectRatioByExpanding
保持纵横比,高度与矩形对齐

QImage scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode =Qt::FastTransformation)const



//返回图像缩放副本,该函数会自动按比例缩放宽度

QImage scaledToHeight(int height, Qt::TransformationMode mode = Qt::FastTransformation) const

QImage scaledToWidth(int width, Qt::TransformationMode mode = Qt::FastTransformation) const



//返回扫描线,第一条扫描线在索引0

uchar *scanLine(int i)

const uchar *scanLine(int i) const



//在给定的索引设置颜色

void setColor(int index, QRgb colorValue)



//扩展颜色表的颜色数目

void setColorCount(int colorCount)



//设置颜色表

void setColorTable(const QVector<QRgb> &colors)



//设置设备像素比

void setDevicePixelRatio(qreal scaleFactor)



//定义的纵横比,通过设置在一个物理表中的像素的数目,以适应水平。

void setDotsPerMeterX(int x)

void setDotsPerMeterY(int y)



//设置图像的像素的数目

void setOffset(const QPoint &offset)



//设置像素颜色

void setPixel(const QPoint &position, uint index_or_rgb)

void setPixel(int x, int y, uint index_or_rgb)

void setPixelColor(const QPoint &position, const QColor &color)

void setPixelColor(int x, int y, const QColor &color)



//嵌入字符串

void setText(const QString &key, const QString &text)



//返回图像大小

QSize size() const



//图像互换,该函数比较快

void swap(QImage &other)



//返回与图像关联的文本

QString text(const QString &key = QString()) const



//返回该图像的文本键。

QStringList textKeys() const



//返回使用给定的转换矩阵和转换模式转换的图像的副本。

QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const

QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const



//如果该坐标有效,返回true

bool valid(const QPoint &pos) const

bool valid(int x, int y) const



//图像宽度

int width() const









Static Public Members

//从size字节开始二进制文本以指定格式构建QImage

QImage fromData(const uchar *data, int size, const char *format = Q_NULLPTR)

QImage fromData(const QByteArray &data, const char *format = Q_NULLPTR)



//转换格式到QImage::Format

QImage::Format toImageFormat(QPixelFormat format)



//转换格式到QPixelFormat 

QPixelFormat toPixelFormat(QImage::Format format)



//返回给定宽度。高度和矩阵的图像的实际矩阵

QMatrix trueMatrix(const QMatrix &matrix, int width, int height)



/返回给定宽度。高度和矩阵的图像的实际矩阵,可以用来透视变换的图像

QTransform trueMatrix(const QTransform &matrix, int width, int height)




Protected Functions

//返回图像的平滑缩放副本

QImage smoothScaled(int w, int h) const





enum QImage::Format

QImage::Format_Invalid
图像无效

QImage::Format_Mono
存储使用1位每像素的图像,字节填充最重要位第一

QImage::Format_MonoLSB
存储使用1位每像素的图像,字节填充不显著位第一

QImage::Format_Indexed8
图像存储使用8位指标转化成Colormap

QImage::Format_RGB32
存储使用32位RGB格式的图像(0xffrrggbb)

QImage::Format_ARGB32
存储使用32为ARGB格式的图像(0xaarrggbb)

QImage::Format_ARGB32_Premultiplied
图像存储使用一个自左乘32位ARGB格式

QImage::Format_RGB16
图像存储使用5-6-5 16位RGB格式

QImage::Format_ARGB8565_Premultiplied
图像存储使用一个自左乘24位ARGB格式8-5-6-5

QImage::Format_RGB666
图像存储使用6-6-6 24位RGB格式,未使用的最重要的位总是为零

QImage::Format_ARGB6666_Premultiplied
图像存储使用一个自左乘24位ARGB格式6-6-6-6

QImage::Format_RGB555
图像存储使用16位RGB格式(5-5-5),位置用的最重要的始终为零

QImage::Format_ARGB8555_Premultiplied
图像存储使用一个自左乘24位ARGB格式8-5-5-5

QImage::Format_RGB888
图像存储使用8-8-8 24位RGB格式

QImage::Format_RGB444
图像存储使用16位RGB格式(4-4-4)未使用的位始终为零

QImage::Format_ARGB4444_Premultiplied
图像存储使用一个自左乘16位ARGB格式4-4-4-4

QImage::Format_RGBX8888
图像存储使用32位字节命令RGB(x)格式8-8-8-8

QImage::Format_RGBA8888
存储使用32位字节命令RGBA格式(8-8-8-8)的的图像

QImage::Format_RGBA8888_Premultiplied
图像存储使用一个自左乘32位字节命令RGBA格式8-8-8-8

QImage::Format_BGR30
存储使用32位BGR格式(x-10-10-10)的的图像

QImage::Format_A2BGR30_Premultiplied
图像存储使用32位自左乘abgr格式2-10-10-10

QImage::Format_RGB30
存储使用32位RGB格式(x-10-10-10)的的图像

QImage::Format_A2RGB30_Premultiplied
图像存储使用2-10-10-10 32位自左乘ARGB格式

QImage::Format_Alpha8
该图像是使用一个8位的阿尔法格式存储

QImage::Format_Grayscale8
图像是使用一个8位灰度格式存储




enum QImage::InvertMode

QImage::InvertRgb  反转RGB通道,a通道变

QImage::InvertRgba 反转所有通道

转载地址:http://apdxi.baihongyu.com/

你可能感兴趣的文章
CDT: Cooperative Detection and Tracking for Tracing Multiple Objects in Video Sequences
查看>>
Improving Multi-frame Data Association with Sparse Representations for Robust Near-online Multi-ob
查看>>
Virtual Worlds as Proxy for Multi-Object Tracking Analysis
查看>>
Multi-view People Tracking via Hierarchical Trajectory Composition
查看>>
Online Multi-Object Tracking via Structural Constraint Event Aggregation
查看>>
The Solution Path Algotithm for Identity-Aware Multi-Object Tracking
查看>>
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>
Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning
查看>>
Multiple Object Tracking with High Performance Detection and Appearance Feature
查看>>
深度学习入门(上)-第一章 必备基础知识点
查看>>