亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? raster.cpp

?? 微軟的基于HMM的人臉識(shí)別原代碼, 非常經(jīng)典的說(shuō)
?? CPP
字號(hào):
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                        Intel License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of Intel Corporation may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/// RasterDoc.cpp : implementation file
//

#include "stdafx.h"
#include "Raster.h"

 
/////////////////////////////////////////////////////////////////////////////
// CRaster

/*======================================================================================*/

CRaster::CRaster()
{
    imgDataSave     = NULL;
    imgData         = NULL;
    imgInfo         = NULL;
    pal             = NULL;

    XDest           = 0;
    YDest           = 0;
    DestWidth       = 0;
    DestHeight      = 0;
    XSrc            = 0;
    YSrc            = 0;
    SrcWidth        = 0;
    SrcHeight       = 0;

    fileName        = "Default.bmp";
    flag            = 0;
}/* CRaster::CRaster */


/*======================================================================================*/

CRaster::~CRaster()
{
    DeleteAllData();
}/* CRaster::~CRaster */


/*======================================================================================*/

int CRaster::CreateRaster(DWORD width, DWORD height, int bitPerPixel)
{
    DWORD               numColor;
    LOGPALETTE          *logPal;
    switch(bitPerPixel) {
    case 1:
        shiftPixel  = (width + 7) / 8;
        break;
    case 4:
        shiftPixel  = (width + 1) / 2;
        break;
    case 8:
        shiftPixel  = width;
        break;
    case 24:
        shiftPixel  = width * 3;
        break;
    default:
        return -1;
    }/* switch */

    if(flag) {
        DeleteAllData();
    }/* if */

    numColor = 1 << bitPerPixel;

    if(	bitPerPixel == 1 ||
        bitPerPixel == 4 ||
        bitPerPixel == 8) { // type of bitmap

        imgInfo = (BITMAPINFO*)malloc(  sizeof(BITMAPINFO) 
                                        + sizeof(RGBQUAD) * numColor);
    // Create Palette for 1<<bitCount colors
        pal     = new CPalette();
        logPal  = (LOGPALETTE*)calloc(  1, sizeof(LOGPALETTE) 
                                        + sizeof(PALETTEENTRY) * numColor);
        logPal->palVersion      = 0x300;
        logPal->palNumEntries   = (WORD)numColor;

        for(DWORD Index = 0; Index < numColor; Index++) {
            logPal->palPalEntry[Index].peRed    = (BYTE)Index;
            logPal->palPalEntry[Index].peGreen  = (BYTE)Index;
            logPal->palPalEntry[Index].peBlue   = (BYTE)Index;
        }/* for */

        pal->CreatePalette(logPal);
        free(logPal);
    } else
        if( bitPerPixel == 24 ) {
            imgInfo = (BITMAPINFO*)malloc(  sizeof(BITMAPINFO) 
                                            + sizeof(RGBQUAD));
    }/* if */

    sizeString  = (shiftPixel + 3) / 4 * 4; // Attention !!! divided 4 !!!;

    imgInfo = (BITMAPINFO*)calloc(  sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
    imgInfo->bmiHeader.biSize           = sizeof(BITMAPINFOHEADER);
    imgInfo->bmiHeader.biWidth          = width;
    imgInfo->bmiHeader.biHeight         = -(int)(height);
    imgInfo->bmiHeader.biPlanes         = 1;
    imgInfo->bmiHeader.biBitCount       = WORD(bitPerPixel);
    imgInfo->bmiHeader.biCompression    = BI_RGB;
    imgInfo->bmiHeader.biSizeImage      = sizeString*height;

    imgDataSave     = new BYTE[sizeString*height];
    imgData         = new BYTE[sizeString*height];

    return 1;
}/* CRaster::CreateRaster */


/*======================================================================================*/

int CRaster::UpdateImage(BYTE* imgSrc)
{
    BYTE* imgDst = imgData;
    if(!imgSrc){
        imgSrc = imgDataSave;
    }/* if */

    for(DWORD index = 0; index < (DWORD)abs(imgInfo->bmiHeader.biHeight); index++){
        memcpy( imgDst, imgSrc, shiftPixel);
        imgDst  +=  sizeString;
        imgSrc  +=  sizeString;
    }/* for */
    return 1;
}/* CRaster::UpdateImage */


/*======================================================================================*/

int CRaster::LoadBMP(const char* cfileName)
{
    CFile   file;
    BITMAPFILEHEADER    fileHeader;
    BITMAPINFOHEADER    infoHeader;
    DWORD               width, height;

    LOGPALETTE          *logPal;

    DWORD               Index;
    WORD                bitCount;
    BYTE*               tempImage;

    if(flag) {
        DeleteAllData();
    }/* if */

    if(file.Open(cfileName, CFile::modeRead, NULL) == 0)
        return -1;

    fileName    = cfileName; 

    file.Read(&fileHeader, sizeof(BITMAPFILEHEADER));
    if(fileHeader.bfType != 0x4d42) {
        file.Close();
        return -1;
    } /* if... it's not BMP */

// Load bitmap info
    file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
    bitCount    = infoHeader.biBitCount;
    if(infoHeader.biCompression != BI_RGB ) {
        file.Close();
        return -2;
    }/* if */
    if( bitCount == 1 ||
        bitCount == 4 ||
        bitCount == 8) { // type of bitmap

        DWORD numColor = infoHeader.biClrUsed;
        if(numColor == 0) {
            numColor = 1<<bitCount;
        }

        imgInfo = (BITMAPINFO*)malloc(  sizeof(BITMAPINFO) 
                                        + sizeof(RGBQUAD) * (1<<bitCount));
        file.Read(imgInfo->bmiColors, sizeof(RGBQUAD) * numColor);

    // Create Palette for 1<<bitCount colors
        pal     = new CPalette();
        logPal  = (LOGPALETTE*)
                    calloc( 1,  sizeof(LOGPALETTE) 
                                    + sizeof(PALETTEENTRY) * (1<<bitCount));

        logPal->palVersion      = 0x300;
        logPal->palNumEntries   = BYTE(1<<bitCount);

        for(Index = 0; Index < numColor; Index++) {

            logPal->palPalEntry[Index].peRed    =
                imgInfo->bmiColors[Index].rgbRed;

            logPal->palPalEntry[Index].peGreen	=
                imgInfo->bmiColors[Index].rgbGreen;

            logPal->palPalEntry[Index].peBlue   =
                imgInfo->bmiColors[Index].rgbBlue;
        }/* for */

        pal->CreatePalette(logPal);
        free(logPal);
    } else if(  bitCount == 24 ) {
        imgInfo = (BITMAPINFO*)malloc(  sizeof(BITMAPINFO) 
                                        + sizeof(RGBQUAD));
    } else {
        file.Close();
        return -2;
    } /* if... not support BMP */

    imgInfo->bmiHeader	= infoHeader;

// Load image data
    width   = imgInfo->bmiHeader.biWidth;
    height  = abs(imgInfo->bmiHeader.biHeight);

    switch(bitCount) {
    case 1:
        shiftPixel  = (width + 7) / 8;
        break;
    case 4:
        shiftPixel  = (width + 1) / 2;
        break;
    case 8:
        shiftPixel  = width;
        break;
    case 24:
        shiftPixel  = width * 3;
        break;
    }/* switch */

    DestWidth   = width;
    DestHeight  = height;
    SrcWidth    = width;
    SrcHeight   = height;

    sizeString  = (shiftPixel + 3) / 4 * 4;	// Attention !!! divided 4 !!!;

    tempImage       = new BYTE[sizeString*height];
    imgData         = new BYTE[sizeString*height];
    imgDataSave     = tempImage;

    for(Index = 0; Index < height; Index++) {
        file.Read(tempImage, sizeString);
        tempImage+=sizeString;
    }/* for */

    imgInfo->bmiHeader.biHeight = -abs(imgInfo->bmiHeader.biHeight);

    UpdateImage(0);
    flag    = 1;
    file.Close();
    return 1;
}/* CRaster::LoadBMP */


/*======================================================================================*/

int CRaster::Draw(CDC* pDC) 
{
    HDC         hDC;
    CPalette*   oldPal;

    oldPal  = 0;
    hDC     =   pDC->m_hDC;
    if(pal) {
        oldPal  =   pDC->SelectPalette(pal, TRUE);
    }/* if */

    pDC->SetStretchBltMode(COLORONCOLOR);

    StretchDIBits(  hDC, 
                    XDest,          YDest, 
                    DestWidth,      DestHeight,
                    XSrc,           YSrc,
                    SrcWidth,       SrcHeight,
                    imgData,        imgInfo,
                    DIB_RGB_COLORS, SRCCOPY);

    if(pal) {
        pDC->SelectPalette(oldPal, TRUE);
    }/* if */

    return 1;
}/* CRaster::Draw */


/*======================================================================================*/
int CRaster::Draw(CDC* pDC, RECT , RECT) 
{
    HDC         hDC;
    CPalette*   oldPal;

    oldPal  = 0;

    hDC     =   pDC->m_hDC;
    if(pal) {
        oldPal  =   pDC->SelectPalette(pal, TRUE);
    }/* if */

    pDC->SetStretchBltMode(COLORONCOLOR);

    StretchDIBits(  hDC, 
                    XDest,          YDest, 
                    DestWidth,      DestHeight,
                    XSrc,           YSrc,
                    SrcWidth,       SrcHeight,
                    imgData,        imgInfo,
                    DIB_RGB_COLORS, SRCCOPY);

    if(pal) {
        pDC->SelectPalette(oldPal, TRUE);
    }/* if */

    return 1;
}/* CRaster::Draw */


/*======================================================================================*/

int CRaster::Draw(CDC* pDC, SIZE dstSize) 
{
    HDC         hDC;
    CPalette*   oldPal;

    oldPal  = 0;

    hDC     =   pDC->m_hDC;
    if(pal) {
        oldPal  =   pDC->SelectPalette(pal, TRUE);
    }/* if */

    pDC->SetStretchBltMode(COLORONCOLOR);

    ::StretchDIBits(  hDC, 
                    0,          0, 
                    dstSize.cx,     dstSize.cy,
                    0,          0,
                    GetWidth(),     GetHeight(),
                    imgData,        imgInfo,
                    DIB_RGB_COLORS, SRCCOPY);

    if(pal) {
        pDC->SelectPalette(oldPal, TRUE);
    }/* if */

    return 1;
}/* CRaster::Draw */


/*======================================================================================*/

int CRaster::Draw(CDC* pDC, POINT point,SIZE size) 
{
    HDC         hDC;
    CPalette*   oldPal;

    oldPal  = 0;

    hDC     =   pDC->m_hDC;
    if(pal) {
        oldPal  =   pDC->SelectPalette(pal, TRUE);
    }/* if */

    pDC->SetStretchBltMode(COLORONCOLOR);

    StretchDIBits(  hDC, 
                    point.x,        point.y, 
                    size.cx,        size.cy,
                    XSrc,           YSrc,
                    SrcWidth,       SrcHeight,
                    imgData,        imgInfo,
                    DIB_RGB_COLORS, SRCCOPY);

    if(pal) {
        pDC->SelectPalette(oldPal, TRUE);
    }/* if */

    return 1;
}/* CRaster::Draw */


/*======================================================================================*/

void CRaster::DeleteAllData()
{
    if(imgData)
        delete imgData;

    if(imgDataSave)
        delete imgDataSave;

    if(imgInfo)
        free(imgInfo);

    if(pal)
        delete pal;

    imgData         = NULL;
    imgDataSave     = NULL;
    imgInfo         = NULL;
    pal             = NULL;
    flag            = 0;
}/* CRaster::DeleteAllData */


/*======================================================================================*/

unsigned long CRaster::GetWidth()
{
    return imgInfo->bmiHeader.biWidth;
}/* CRaster::GetWidth */


/*======================================================================================*/

unsigned long CRaster::GetHeight()
{
    return abs(imgInfo->bmiHeader.biHeight);
}/* CRaster::GetHeight */


/*======================================================================================*/

unsigned long CRaster::GetSizeString()
{
    return sizeString;
}/* CRaster::GetSizeString */


/*======================================================================================*/

BYTE* CRaster::GetImage()
{
    return imgData;
}/* CRaster::GetImage */


/*======================================================================================*/

int CRaster::GetNumBitPerPixel()
{
    return imgInfo->bmiHeader.biBitCount;
}/* CRaster::GetNumBitPerPixel */


/*======================================================================================*/

BITMAPINFO* CRaster::GetBitmapInfo()
{
    return imgInfo;
}/* CRaster::GetBitmapInfo */


/*======================================================================================*/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩一区二区三区性色av| 色综合天天在线| 亚洲人妖av一区二区| 欧美一区二区三区免费大片 | 日韩精品一区二区三区中文不卡| 亚洲成人精品一区| 97久久人人超碰| 韩国女主播一区二区三区| 成人网在线免费视频| 日韩国产一二三区| 亚洲精品一二三四区| 久久亚洲欧美国产精品乐播| 欧美视频在线观看一区二区| 岛国精品在线观看| 激情综合网天天干| 三级不卡在线观看| 一区二区在线观看免费 | 色综合天天综合| 国产伦精一区二区三区| 日韩中文欧美在线| 亚洲国产欧美一区二区三区丁香婷| 亚洲国产电影在线观看| 久久久久久日产精品| 欧美一个色资源| 91精品国产手机| 欧美日本乱大交xxxxx| 在线观看不卡视频| 色婷婷亚洲婷婷| 91在线免费播放| 99re6这里只有精品视频在线观看| 国产精品12区| 高清beeg欧美| 国产a视频精品免费观看| 久久疯狂做爰流白浆xx| 免费在线观看一区二区三区| 日韩黄色免费网站| 石原莉奈一区二区三区在线观看 | 中文字幕一区二区在线观看 | 精品不卡在线视频| 欧美videos大乳护士334| 日韩小视频在线观看专区| 在线不卡的av| 69精品人人人人| 日韩一区二区三区三四区视频在线观看 | 国产精品日韩精品欧美在线| 久久精品欧美日韩| 国产精品美日韩| 亚洲图片激情小说| 一色桃子久久精品亚洲| 亚洲视频免费观看| 一区二区三区日韩精品| 亚洲国产欧美另类丝袜| 日韩激情一二三区| 激情丁香综合五月| 国产成人精品三级| 成人aa视频在线观看| 色综合色综合色综合色综合色综合| 91免费版在线| 欧美三级电影在线看| 91精品国产免费久久综合| 日韩视频国产视频| 国产日韩精品视频一区| 亚洲日本一区二区| 亚洲第一精品在线| 久久国产精品72免费观看| 欧美mv和日韩mv国产网站| 国产午夜精品理论片a级大结局| 国产精品色在线观看| 亚洲永久免费视频| 免费xxxx性欧美18vr| 成人国产精品免费观看| 在线观看日韩电影| 日韩女优av电影| 日韩一区中文字幕| 婷婷久久综合九色国产成人| 韩国视频一区二区| 一本色道久久综合精品竹菊| 51精品视频一区二区三区| 久久免费偷拍视频| 一区二区三区日韩精品| 国产一区二三区好的| 99在线精品免费| 91精品国产综合久久精品麻豆 | 日韩精品专区在线| 国产精品网站在线播放| 婷婷国产v国产偷v亚洲高清| 国产美女娇喘av呻吟久久| 91视频观看免费| 日韩欧美国产综合| 一区二区三区丝袜| 国产大陆精品国产| 在线不卡一区二区| 中文字幕视频一区| 九色porny丨国产精品| 91污在线观看| 26uuu欧美| 亚洲福利电影网| 国产清纯美女被跳蛋高潮一区二区久久w| 1区2区3区精品视频| 蜜臀久久99精品久久久久久9 | 国产盗摄精品一区二区三区在线| 在线观看国产日韩| 国产欧美一区在线| 麻豆精品一二三| 欧美日韩免费高清一区色橹橹| 久久久精品tv| 蜜桃在线一区二区三区| 日本韩国精品在线| 国产精品欧美一级免费| 久久99热国产| 555www色欧美视频| 一区二区三区精品视频在线| 高清在线观看日韩| 久久奇米777| 久久99深爱久久99精品| 欧美男男青年gay1069videost| 亚洲欧美在线视频观看| 国产盗摄一区二区三区| 精品精品国产高清一毛片一天堂| 亚洲成a天堂v人片| 欧美熟乱第一页| 亚洲精品午夜久久久| 北条麻妃国产九九精品视频| 国产色一区二区| 国产一区二区三区久久久| 日韩一区二区三区视频在线| 午夜精品在线看| 在线观看区一区二| 一区二区高清在线| 91福利国产成人精品照片| 亚洲欧美日韩电影| 色综合色综合色综合色综合色综合| 亚洲欧洲在线观看av| 99久久精品免费看| 亚洲人成小说网站色在线| 99久久精品免费| 亚洲日本电影在线| 91美女片黄在线| 一区二区三区色| 欧美日韩国产精选| 日韩国产在线一| 日韩亚洲欧美一区二区三区| 日本aⅴ免费视频一区二区三区| 日韩一区二区三区视频| 美女mm1313爽爽久久久蜜臀| 欧美本精品男人aⅴ天堂| 韩国三级中文字幕hd久久精品| 久久久激情视频| 成人精品视频.| 亚洲激情成人在线| 欧美日韩激情在线| 麻豆91在线观看| 久久久久久久久久看片| 不卡电影一区二区三区| 亚洲女同ⅹxx女同tv| 欧美日韩中字一区| 麻豆视频观看网址久久| 国产三级精品三级| 色欧美日韩亚洲| 琪琪一区二区三区| 久久久国际精品| 91麻豆精品在线观看| 五月婷婷激情综合| 日韩欧美国产电影| 高清在线观看日韩| 亚洲综合色噜噜狠狠| 日韩一区二区三区观看| 国产一二三精品| 亚洲影院在线观看| 欧美精品一区二区三区一线天视频| 丰满放荡岳乱妇91ww| 一区二区在线观看视频在线观看| 制服丝袜一区二区三区| 国产成人av网站| 一区二区三区在线观看国产| 欧美一区二区三区日韩视频| 国产一区二区伦理| 亚洲高清视频的网址| 久久欧美中文字幕| 欧美色图在线观看| 国产精品1区2区3区| 亚洲国产精品久久艾草纯爱 | 日韩一级二级三级精品视频| 国产福利一区二区| 亚洲成人在线免费| 欧美激情一区二区三区全黄| 欧美日韩aaaaa| a美女胸又www黄视频久久| 日韩av一区二| 亚洲人123区| 欧美精品一区二区三区高清aⅴ | 中文字幕巨乱亚洲| 5858s免费视频成人| 99久久99久久综合| 免费成人av在线播放| 玉足女爽爽91| 国产精品久久久久国产精品日日 | 亚洲人被黑人高潮完整版| 精品国产乱码久久久久久免费| 色婷婷亚洲婷婷|