资源简介
Visual C++.NET图像处理编程源代码 陆宗骐,非常使用的代码,图像处理经典

代码片段和文件信息
/******************************************************************
CreatePal.cpp
Performing Color Quantization algorithm
******************************************************************/
#include “stdafx.h“
#ifndef _CREATEPAL_C
#define _CREATEPAL_C
typedef struct _NODE
{
BOOL bIsLeaf; // TRUE if node has no children
UINT nPixelCount; // Number of pixels represented by this leaf
UINT nRedSum; // Sum of red components
UINT nGreenSum; // Sum of green components
UINT nBlueSum; // Sum of blue components
struct _NODE* pChild[8]; // Pointers to child nodes
struct _NODE* pNext; // Pointer to next reducible node
} NODE;
void AddColor (NODE** BYTE BYTE BYTE UINT UINT UINT* NODE**);
NODE* CreateNode (UINT UINT UINT* NODE**);
void ReduceTree (UINT UINT* NODE**);
void DeleteTree (NODE**);
void GetPaletteColors (NODE* RGBQUAD* UINT*);
void TrueColorToIndex(CImage *pImg0CImage *pImg1)
{
struct IMAGEPARAMENT P;
CImage gpImg;
RGBQUAD ColorTab[256];
HDC hMemDC;
GetImageParament(pImg1&P);
gpImg.Create(P.nWidthP.nHeight80);
Create8TreePal(pImg1ColorTab2568);
SetAllPalette(&gpImgColorTab);
hMemDC = gpImg.GetDC();
pImg1->BitBlt(hMemDC00P.nWidthP.nHeight00SRCCOPY);
gpImg.ReleaseDC();
ImageCopy(pImg0&gpImg);
gpImg.Destroy();
}
// local function to build optimal palette from CImage
void Create8TreePal(CImage *pImgRGBQUAD *Pal UINT nMaxColors UINT nColorBits)
{
struct IMAGEPARAMENT P;
int i j;
BYTE *pbBits;
BYTE r g b;
NODE *pTree;
UINT nLeafCountnIndex;
NODE *pReducibleNodes[9];
GetImageParament(pImg&P);
// Initialize octree variables
pTree = NULL;
nLeafCount = 0;
for (i=0; i<=(int) nColorBits; i++) pReducibleNodes[i] = NULL;
for (i=0; i pbBits = (BYTE*) pImg->GetPixelAddress(0i);
for (j=0; j b = *pbBits++;
g = *pbBits++;
r = *pbBits++;
if (P.nBitCount==32) pbBits++;
AddColor (&pTree r g b nColorBits 0 &nLeafCount
pReducibleNodes);
while (nLeafCount > nMaxColors)
ReduceTree (nColorBits &nLeafCount pReducibleNodes);
}
}
nIndex = 0;
GetPaletteColors (pTree Pal &nIndex);
DeleteTree (&pTree);
}
// local function to add a color to octree
void AddColor (NODE** ppNode BYTE r BYTE g BYTE b UINT nColorBits
UINT nLevel UINT* pLeafCount NODE** pReducibleNodes)
{
int nIndex shift;
static BYTE mask[8] = {0x800x400x200x100x080x040x020x01};
// If the node doesn‘t exist create it
if (*ppNode == NULL)
*ppNode = CreateNode (nLevel nColorBits pLeafCount
pReducibleNodes);
// Update color information
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6339 2005-09-23 12:45 IProcessN\CreatePal.cpp
文件 413 2005-09-01 22:42 IProcessN\CreatePal.h
文件 3315 2005-11-26 20:32 IProcessN\Debug\BuildLog.htm
文件 43218 2005-11-26 20:32 IProcessN\Debug\CreatePal.obj
文件 56508 2005-11-26 20:32 IProcessN\Debug\IProcessB.obj
文件 75064 2005-11-26 20:32 IProcessN\Debug\IProcessC.obj
文件 118874 2005-11-26 20:32 IProcessN\Debug\IProcessD.obj
文件 58425 2005-11-26 20:32 IProcessN\Debug\IProcessE.obj
文件 39793 2005-11-26 20:32 IProcessN\Debug\IProcessF.obj
文件 2404352 2005-11-26 20:32 IProcessN\Debug\IProcessN.exe
文件 5377496 2005-11-26 20:32 IProcessN\Debug\IProcessN.ilk
文件 28377 2005-11-26 20:32 IProcessN\Debug\IProcessN.obj
文件 7449600 2005-11-26 20:32 IProcessN\Debug\IProcessN.pdb
文件 47060 2005-11-26 20:32 IProcessN\Debug\IProcessN.res
文件 283927 2005-11-26 20:32 IProcessN\Debug\IProcessNDoc.obj
文件 407276 2005-11-26 20:32 IProcessN\Debug\IProcessNView.obj
文件 27316 2005-11-26 20:32 IProcessN\Debug\MainFrm.obj
文件 205336 2005-11-26 20:32 IProcessN\Debug\Process.obj
文件 299035 2005-11-26 20:32 IProcessN\Debug\Stdafx.obj
文件 855040 2005-11-26 20:32 IProcessN\Debug\vc70.idb
文件 782336 2005-11-26 20:32 IProcessN\Debug\vc70.pdb
文件 12889 2005-11-26 17:06 IProcessN\IProcessB.cpp
文件 1299 2005-09-27 20:43 IProcessN\IProcessB.h
文件 13875 2005-11-26 17:02 IProcessN\IProcessC.cpp
文件 701 2005-09-27 20:43 IProcessN\IProcessC.h
文件 13570 2009-03-08 23:07 IProcessN\IProcessD.cpp
文件 1012 2005-09-27 20:51 IProcessN\IProcessD.h
文件 9783 2005-11-21 13:50 IProcessN\IProcessE.cpp
文件 584 2005-09-27 20:51 IProcessN\IProcessE.h
文件 3189 2005-09-27 20:51 IProcessN\IProcessF.cpp
............此处省略53个文件信息
相关资源
- C++获取计算机的CPU ID,硬盘序列号等
- C++头文件转delphi工具 + 源码
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 用C语言进行数字图像处理
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 基于esp32的摄像头采集图像代码
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
评论
共有 条评论