资源简介
图像处理,本程序实现了用分水岭算法实现图像分割。
代码片段和文件信息
// Imageobject.cpp: implementation of the CImageobject class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “Imageobject.h“
#include “ImageLoad.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE( CImageobject Cobject )
char *CImageobject::pszExtensions[] = { “.bmp“ “.gif“ “.pcx“ “.tga“ “.jpg“ “.tif“ ““ };
//////////////////////////////////////////////////
// Constructor and destructor
//
CImageobject::CImageobject()
{
m_nWidth = m_nHeight = m_nBits = m_nColors = m_nImageType = 0;
m_nX = m_nY = 0;
m_nLastError = 0;
m_hDib = NULL;
m_nPaletteCreationType = JGPT_FIXED_PALETTE;
m_pszFileName = NULL;
m_pLogPalette = NULL;
m_nQuality = 80;
m_pDib = NULL;
m_lBufSize = 0;
}
CImageobject::CImageobject( const char *pszFileName CDC *pDC int nX int nY )
{
m_nWidth = m_nHeight = m_nBits = m_nColors = m_nImageType = 0;
m_nX = m_nY = 0;
m_nLastError = 0;
m_hDib = NULL;
m_nPaletteCreationType = JGPT_FIXED_PALETTE;
m_pszFileName = NULL;
m_pLogPalette = NULL;
m_nQuality = 80;
m_pDib = NULL;
m_lBufSize = 0;
LoadFromFile( pszFileName pDC nX nY );
}
void CImageobject::operator=( const CImageobject &Imageobject )
{
DestroyImage();
m_nLastError = Imageobject.m_nLastError;
m_nWidth = Imageobject.m_nWidth;
m_nHeight = Imageobject.m_nHeight;
m_nPlanes = Imageobject.m_nPlanes;
m_nBits = Imageobject.m_nBits;
m_nColors = Imageobject.m_nColors;
m_nImageType = Imageobject.m_nImageType;
m_nX = Imageobject.m_nX;
m_nY = Imageobject.m_nY;
m_nScreenPlanes = Imageobject.m_nScreenPlanes;
m_nScreenBits = Imageobject.m_nScreenBits;
m_nPaletteInBytes = Imageobject.m_nPaletteInBytes;
m_nQuality = Imageobject.m_nQuality;
m_nPaletteCreationType = Imageobject.m_nPaletteCreationType;
int nNumColors = m_nColors;
int nWidthBytes = GetWidthInBytes( m_nBits m_nWidth );
if( Imageobject.m_hDib != NULL )
{
DWORD dwSize = ::GlobalSize( Imageobject.m_hDib );
char *pData = ( char * )::GlobalLock( Imageobject.m_hDib );
if( pData != NULL )
{
HGLOBAL hGlobal = ::GlobalAlloc( GMEM_MOVEABLE | GMEM_ZEROINIT dwSize );
if( hGlobal != NULL )
{
char *pDestData = ( char * )::GlobalLock( hGlobal );
if( pDestData != NULL )
{
memcpy( pDestData pData dwSize );
if( nNumColors != 0 )
CreatePaletteFromDIB( ( RGBQUAD * )&pData[sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)] nNumColors );
else if( Imageobject.m_pLogPalette != NULL )
{
m_pLogPalette = (LOGPALETTE *) new char[ sizeof( LOGPALETTE ) + Imageobject.m_pLogPalette->palNumEntries * sizeof( PALETTEENTRY ) ];
if( m_pLogPalette != NULL )
{
for( int i=0; iject.m_pLogPalette->palNumEntries; i++ )
m_pLogPalette[i] = Imageobject.m_pLogPalette[i];
m_Palette.CreatePalett
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 741 1999-09-21 14:31 WaterShed\ImageErrors.h
文件 3904 1999-09-22 11:12 WaterShed\Imageload.h
文件 15566 1997-03-26 12:15 WaterShed\ImageLoad.lib
文件 60290 2004-06-05 17:20 WaterShed\Imageob
文件 7435 2004-06-05 17:20 WaterShed\Imageob
文件 2508 2008-05-20 14:21 WaterShed\MainFrm.cpp
文件 1639 2008-05-19 23:34 WaterShed\MainFrm.h
文件 14223 2008-05-19 23:39 WaterShed\MyMath.cpp
文件 3392 2008-05-20 13:18 WaterShed\MyMath.h
文件 4383 2008-05-19 22:08 WaterShed\ReadMe.txt
文件 688 2008-05-20 13:47 WaterShed\Resource.h
文件 211 2008-05-19 22:08 WaterShed\StdAfx.cpp
文件 1054 2008-05-19 22:08 WaterShed\StdAfx.h
文件 32524 2009-03-25 09:38 WaterShed\WaterShed.aps
文件 2378 2009-05-23 22:35 WaterShed\WaterShed.clw
文件 4263 2008-05-19 22:08 WaterShed\WaterShed.cpp
文件 4984 2008-05-20 13:47 WaterShed\WaterShed.dsp
文件 543 2008-05-22 16:18 WaterShed\WaterShed.dsw
文件 1389 2008-05-19 22:08 WaterShed\WaterShed.h
文件 230400 2009-05-23 22:51 WaterShed\WaterShed.ncb
文件 1495 2009-03-25 17:00 WaterShed\WaterShed.plg
文件 11791 2008-05-20 14:21 WaterShed\WaterShed.rc
文件 3192 2008-05-20 15:05 WaterShed\WaterShedDoc.h
文件 4305 2008-05-19 23:53 WaterShed\WaterShedView.cpp
文件 2222 2008-05-19 22:22 WaterShed\WaterShedView.h
文件 33136 2009-03-25 17:00 WaterShed\WaterShedDoc.cpp
文件 147968 2009-05-23 22:51 WaterShed\WaterShed.opt
..A.SHR 9 2009-08-10 17:48 WaterShed\Desktop_1.ini
..A.SHR 9 2009-08-10 17:46 WaterShed\Desktop_2.ini
文件 94678 2004-05-29 19:32 WaterShed\res\bitmap3.bmp
............此处省略48个文件信息
评论
共有 条评论