C++实现的基于内容的图像检索


MFC实现的基于内容的图像检索,主要用到颜色特征,可以作为MFC和图像开发方面的学习资料
资源截图
代码片段和文件信息
/******************************************************************
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       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      14512  2001-11-06 00:53  retrievalCqOctree.cpp

     文件      14875  2010-04-15 19:39  retrievalDebugCqOctree.obj

     文件          0  2010-04-15 19:39  retrievalDebugCqOctree.sbr

     文件     144724  2010-04-15 19:39  retrievalDebugDib.obj

     文件          0  2010-04-15 19:39  retrievalDebugDib.sbr

     文件     174157  2010-04-15 19:39  retrievalDebugdibapi.obj

     文件          0  2010-04-15 19:39  retrievalDebugdibapi.sbr

     文件       4234  2010-04-15 19:39  retrievalDebugHuffman.obj

     文件          0  2010-04-15 19:39  retrievalDebugHuffman.sbr

     文件      60729  2010-04-15 19:39  retrievalDebugIP.obj

     文件          0  2010-04-15 19:39  retrievalDebugIP.sbr

     文件      31549  2010-04-15 19:39  retrievalDebugJpeg.obj

     文件          0  2010-04-15 19:39  retrievalDebugJpeg.sbr

     文件      22242  2010-04-15 19:39  retrievalDebugMainFrm.obj

     文件          0  2010-04-15 19:39  retrievalDebugMainFrm.sbr

     文件      20408  2010-04-15 19:39  retrievalDebugResultView.obj

     文件          0  2010-04-15 19:39  retrievalDebugResultView.sbr

     文件    3834880  2010-04-15 19:39  retrievalDebug
etrieval.bsc

     文件     516170  2010-04-15 19:39  retrievalDebug
etrieval.exe

     文件     714212  2010-04-15 19:39  retrievalDebug
etrieval.ilk

     文件      23232  2010-04-15 19:39  retrievalDebug
etrieval.obj

     文件    6869072  2010-04-15 19:39  retrievalDebug
etrieval.pch

     文件     656384  2010-04-15 19:39  retrievalDebug
etrieval.pdb

     文件       8216  2010-04-15 19:39  retrievalDebug
etrieval.res

     文件          0  2010-04-15 19:39  retrievalDebug
etrieval.sbr

     文件      58872  2010-04-15 19:39  retrievalDebug
etrievalDoc.obj

     文件          0  2010-04-15 19:39  retrievalDebug
etrievalDoc.sbr

     文件      97643  2010-04-15 19:39  retrievalDebugRetrievallView.obj

     文件          0  2010-04-15 19:39  retrievalDebugRetrievallView.sbr

     文件     105670  2010-04-15 19:39  retrievalDebugStdAfx.obj

............此处省略402个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)