资源简介

基于颜色特征的图像检索系统源代码。积分已调到最低,网站不让免费

资源截图

代码片段和文件信息

/******************************************************************
CqOctree.CPP

  Performing Color Quantization using Octree algorithm

  The 2 functions for global use is
  HPALETTE CreateOctreePalette (HBITMAP hImage UINT nMaxColors UINT nColorBits)
  HPALETTE CreateOctreePalette (LPSTR lpDIB UINT nMaxColors UINT nColorBits)
  For using convenience define it in DIBAPI.H
******************************************************************/

#include “stdafx.h“
#include “dibapi.h“

// structure use internally
// store the necessary info of a node in octree
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;

// Function prototypes
//Global use define it in dibapi.h
//HPALETTE CreateOctreePalette (HDIB hDIB UINT nMaxColors UINT nColorBits)
//HPALETTE CreateOctreePalette (LPSTR lpDIB UINT nMaxColors UINT nColorBits)
//Local use only
HPALETTE BuildOctreePalette(HANDLE hImage UINT nMaxColors UINT nColorBits);
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* PALETTEENTRY* UINT*);
int GetRightShiftCount (DWORD);
int GetLeftShiftCount (DWORD);

// Function body

/************************************************************************* 
 * 
 * CreateOctreePalette() 
 * 
 * Parameters: 
 * 
 * HDIB hDIB        - Handle to source DIB 
 * UINT nMaxColors  - destination color number
 * UINT nColorBits  - destination color bits
 * 
 * Return Value: 
 * 
 * HPALETTE         - Handle to the result palette
 * 
 * Description: 
 * 
 * This function use Octree color quantization algorithm to get
 * optimal m kinds of color to represent total n kinds of color 
 * in a DIB and use the m kinds of color to build a palette.
 * With the palette we can display the DIB on reasonable accuracy.
 * 
 ************************************************************************/ 
HPALETTE CreateOctreePalette(HDIB hDIB UINT nMaxColors UINT nColorBits)
{
HANDLE hImage;

hImage = DIBToDIBSection(hDIB);
if (! hImage)
return NULL;
return BuildOctreePalette(hImage nMaxColors nColorBits);
}

/************************************************************************* 
 * 
 * CreateOctreePalette() 
 * 
 * Parameters: 
 * 
 * LPBYTE lpDIB     - Pointer to DIB data buffer
 * UINT nMaxColors  - destination color number
 * UINT nColorBits  - destination color bits
 * 
 * Return Value: 
 * 
 * HPALETTE       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-03-20 13:33  基于颜色特征的图像检索系统源代码\
     目录           0  2010-06-18 09:33  基于颜色特征的图像检索系统源代码\image.orig\
     文件       35612  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\0.jpg
     文件       24182  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\1.jpg
     文件       32244  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\10.jpg
     文件       46832  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\100.jpg
     文件       28823  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\101.jpg
     文件       26552  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\102.jpg
     文件       24453  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\103.jpg
     文件       35137  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\104.jpg
     文件       30241  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\105.jpg
     文件       28958  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\191.jpg
     文件       24858  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\192.jpg
     文件       45954  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\193.jpg
     文件       23703  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\194.jpg
     文件       27456  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\195.jpg
     文件       49191  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\196.jpg
     文件       27869  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\197.jpg
     文件       28652  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\198.jpg
     文件       18617  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\199.jpg
     文件       42708  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\2.jpg
     文件       28978  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\20.jpg
     文件       28968  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\200.jpg
     文件       24443  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\201.jpg
     文件       25964  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\202.jpg
     文件       35462  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\203.jpg
     文件       35069  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\204.jpg
     文件       26014  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\205.jpg
     文件       32661  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\206.jpg
     文件       23251  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\207.jpg
     文件       24239  2001-07-07 04:02  基于颜色特征的图像检索系统源代码\image.orig\208.jpg
............此处省略197个文件信息

评论

共有 条评论