CxImage使用指南

13 篇文章 0 订阅
6 篇文章 0 订阅

帮助地址:http://www.xdp.it/cximage/

----------------------------------------------------

1、Load:reads from disk the image in a specific format;

2、Save:saves to disk the image in a specific format;

3、Filter:2D linear filter(图像锐化,可提高图像清晰度);

4、Copy:copies the image from an exsisting source;

5、Resample:resizes the image ;

6、Saturate:changes the saturation of the image(调整图像饱和度);

7、GrayScale:图像灰度化;

8、Flip:图像上下翻动;

9、Mirror:图像左右翻动;

10、Negative:颜色取反(255-原值);

11、Dither:converts the image to B&W using the desired method ;

12、Threshold:converts the image to B&W(二值化);

13、AdaptiveThreshold:converts the image to B&W, using an optimal threshold mask(自适应阈值法);

14、Colorize:replaces the original hue and saturation values;

15、Solarize:convert all colors above a given lightness level into their negative ;

16、Light:changes the brightness and the contrast of the image(图像亮度和对比度调整);

17、Threshold2:filters only the pixels with a lightness less (or more) than the threshold level, and preserves the   colors for the unfiltered pixels;
18、Dilate:enhance the light areas of the image;
19、Erode:enhance the dark areas of the image;
20、Contour:enhance the variations between adjacent pixels;similar results can be achieved using Filter(), but the algorithms are different both in Edge() and in Contour();
21、Edge:enhance the variations between adjacent pixels(注意线性和非线性的区别);similar results can be achieved using Filter(), but the algorithms are different both in Edge() and in Contour();
22、Trace:finds the contour of an object with a given color;
23、Noise:adds an uniform noise to the image;
24、Jitter:adds a random offset to each pixel in the image;

25、Draw:draws the image in the specified device context, with support for alpha channel, alpha palette, transparency, opacity;
26、GetWidth:获得图像的宽带;
27、GetHeight:获得图像的高度;
28、GetXDPI:获得图像x轴分辨率(支持TIFF、JPEG、PNG、BMP格式);
29、GetYDPI:获得图像y轴分辨率(支持TIFF、JPEG、PNG、BMP格式);
30、IsValid:checks if the image is correctly initializated;
31、SetJpegQuality:set quality level for JPEG and JPEG2000;
32、GetJpegQuality:get quality level for JPEG and JPEG2000;
33、GetNumColors:returns 2, 16, 256; 0 for RGB images;
34、GetLastError:returns the last reported error;
35、SetPixelColor:设置像素颜色值;

---------------------------------------------------------------

1、打开一张图

bool CxImage::Load(const TCHAR * filename, uint32_t imagetype)

2、保存一张图
bool CxImage::Save(LPCWSTR filename, DWORD imagetype=0)
参数和上面是一样的。
3、得到图形数据,以便在OpenGL中使用材质
 BYTE* CxImage::GetBits(DWORD row = 0);
4、得到图形大小
long GetSize();
5、得到图形高度和宽度
 DWORD CxImage::GetHeight();
 DWORD CxImage::GetWidth();
6、得到文件类型
 DWORD CxImage::GetType()  const;
7、得到最后一个错误
 char* CxImage::GetLastError();
8、在界面中绘制出来
long CxImage::Draw(HDC hdc, const RECT& rect, RECT* pClipRect=NULL)
HDC 绘图设备,rect 绘图的区域,确定绘图的左上角和右下角坐标。pClipRect,裁剪区域,一般可以和绘图区域一样大小,除非特殊需要。

-------------------------------------------------------

class CxImage
{
...
protected:
void* pDib;            //包含文件头,调色板等等
BITMAPINFOHEADER head; //标准的文件头(位图)
CXIMAGEINFO info;      //扩展了的信息
BYTE* pSelection;      //用户选中的区域
BYTE* pAlpha;          //alpha通道
CxImage** pLayers;     //通用层
}
typedef struct tagCxImageInfo {
DWORD   dwEffWidth;       //DWORD 扫描线宽
BYTE*   pImage;           //图像位数
void*   pGhost;           //if this is a ghost, pGhost point to the body
DWORD   dwType;           //原图像的格式
char    szLastError[256]; //出错信息
long    nProgress;        //监视循环的次数
long    nEscape;          //跳出标志
long    nBkgndIndex;      //GIF, PNG, MNG格式使用
RGBQUAD nBkgndColor;      //RGB三原色透明度
BYTE    nQuality;         //JPEG格式使用
long    nFrame;           //TIF, GIF, MNG使用 :实际的帧数
long    nNumFrames;       //TIF, GIF, MNG使用 :帧总数
DWORD   dwFrameDelay;     //GIF, MNG使用
long    xDPI;             //水平分辨率
long    yDPI;             //垂直分辨率
RECT    rSelectionBox;    //选中的矩形区
BYTE    nAlphaMax;        //阴影的最大不透明度
bool    bAlphaPaletteEnabled;  //如果调色板中有Alpha通道则为真
bool    bEnabled;         //打开绘图函数
long    xOffset;
long    yOffset;
DWORD   dwEncodeOption;   //一些编码选项
RGBQUAD last_c;           //一些优化选项
BYTE    last_c_index;
bool    last_c_isvalid;
long    nNumLayers;
DWORD   dwFlags;
} CXIMAGEINFO;


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: CXImage是一个易于使用的C++图像处理库,可以处理多种格式的图像并提供了许多图像编辑功能。如果想在Linux平台上使用CXImage,首先需要从官方网站或GitHub代码仓库下载代码。然后按照以下步骤进行: 1. 将代码解压缩到您想要存放的目录中。 2. 打开终端并进入该目录。 3. 使用make命令生成库文件。 4. 在生成的lib目录中找到生成的库文件。 5. 使用make install命令将库文件安装到系统目录中。 至此,您就可以开始在Linux平台上使用CXImage库进行图像处理了。您可以在代码中引用生成的库文件,并使用CXImage库提供的各种函数来处理不同格式的图像和编辑图像。此外,CXImage库还提供了许多示例代码,您可以使用它们来进一步了解如何使用该库。 ### 回答2: 在Linux系统下下载CXImage,可以按照以下步骤进行: 1. 打开终端,使用命令行工具。 2. 确保您的系统已经安装了Git和CMake。如果没有安装,可以使用以下命令进行安装: ``` sudo apt-get install git cmake ``` 3. 使用Git命令克隆CXImage的源代码仓库。在终端中运行以下命令: ``` git clone https://github.com/ibnudana/cximage.git ``` 4. 进入克隆下来的CXImage目录: ``` cd cximage ``` 5. 创建一个新的目录,用于构建CXImage的对象文件: ``` mkdir build cd build ``` 6. 运行CMake生成Makefile: ``` cmake .. ``` 7. 运行make命令进行编译: ``` make ``` 8. 完成编译后,在build目录中会生成cximage库文件,可以使用它来进行图像处理等操作。 以上是在Linux系统下下载CXImage的基本步骤。根据实际情况,您可能需要解决一些依赖项或配置问题。请确保您的系统满足CXImage的要求,并参考CXImage的文档进行进一步的配置和安装。 ### 回答3: 在 Linux 系统下下载 cximage 需要执行以下步骤: 1. 打开终端(Terminal),使用以下命令安装 git:sudo apt-get install git 2. 使用以下命令克隆 cximage 仓库:git clone https://github.com/Delgan/cximage.git 3. 进入 cximage 目录:cd cximage 4. 使用以下命令编译 cximage:make 5. 编译完成后,在 cximage 目录中将生成可执行文件 cximage
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值