91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.13MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-08-29
  • 語言: 其他
  • 標簽: 八邊形??

資源簡介

地圖代數(shù)八邊形距離變換的實現(xiàn)代碼,總體不錯哦

資源截圖

代碼片段和文件信息

#include?“stdio.h“
#include?“Windows.h“

unsigned?char?*Bmp;
unsigned?char?*Mat;
int?bmpWidth;
int?bmpHeight;
RGBQUAD?*ColorTable;
int?biBitCount;

int?Matrix[19];?//定義結果矩陣
int?MatrixDown[19]={3210322122332223333};//定義八邊形左下矩陣
int?MatrixUp[19]={3333222332212230123};//定義八邊形右上矩陣

int?num=0;
int?m_byte=0;
int?m_width=0;
int?loc_x[19]?={?0?0?0?0?1?1?1?1?1?1?1?2?2?2?2?2?3?3?3?};
int?loc_y[19]?={?-3?-2?-1?0?-3?-2?-1?0?1?2?3?-2?-1?0?1?2?-1?0?1?};

int lol_x[19]={?-3-3-3-2-2-2-2-2-1-1-1-1-1-1-10000};
int lol_y[19]=??{-101-2-1012-3-2-101230123};


//位圖的讀取
bool?ReadBmp(char?*bmpName)
{
FILE?*fp=fopen(bmpName“r+b“);
if(fp==0)
return?0;
????fseek(fpsizeof(BITMAPFILEHEADER)0);
????BITMAPINFOHEADER?Infohead;
fread(&Infoheadsizeof(BITMAPINFOHEADER)1fp);
bmpWidth=Infohead.biWidth;
bmpHeight=Infohead.biHeight;
biBitCount=Infohead.biBitCount;
int?lineByte=(bmpWidth*biBitCount/8+3)/4*4;
????if(biBitCount==8)
{
ColorTable=new?RGBQUAD[256];
fread(ColorTablesizeof(RGBQUAD)256fp);
}
Bmp=new?unsigned?char[lineByte*bmpHeight];
Mat=new?unsigned?char[lineByte*bmpHeight];
fread(Bmp1lineByte*bmpHeightfp);
fclose(fp);
return?1;
}


//位圖的寫入
bool?SaveBmp(char?*bmpNameunsigned?char?*OutBmpint?widthint?heightint?biBitCountRGBQUAD?*ColorTable)
{
if(!OutBmp)
return?0;
int?colorTablesize=0;
if(biBitCount==8)
colorTablesize=1024;
int?lineByte=(width*biBitCount/8+3)/4*4;
FILE?*fp=fopen(bmpName“w+b“);
if(fp==0)
return?0;
????BITMAPFILEHEADER?FileHead;
FileHead.bfType=0x4D42;
FileHead.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+colorTablesize+lineByte*height;
FileHead.bfReserved1=0;
FileHead.bfReserved2=0;
FileHead.bfOffBits=54+colorTablesize;
fwrite(&FileHeadsizeof(BITMAPFILEHEADER)1fp);
????BITMAPINFOHEADER?Infohead;?
Infohead.biBitCount=biBitCount;
Infohead.biClrImportant=0;
Infohead.biClrUsed=0;
Infohead.biCompression=0;
Infohead.biHeight=height;
Infohead.biPlanes=1;
Infohead.biSize=40;
Infohead.biSizeImage=lineByte*height;
Infohead.biWidth=width;
Infohead.biXPelsPerMeter=0;
Infohead.biYPelsPerMeter=0;
fwrite(&Infohead?sizeof(BITMAPINFOHEADER)1?fp);
????if(biBitCount==8)
fwrite(ColorTable?sizeof(RGBQUAD)256?fp);
????fwrite(OutBmp?height*lineByte?1?fp);
fclose(fp);

return?1;
}



int?location(int?aint?b)
{
if(a<0||b<0||b>=bmpWidth||a>=bmpHeight)
return?255;
else
return?*(Mat+a*m_byte+b);

}

//最小值的輸出
int?MinArray(int?Arr[19])
{
int?m_min;
m_min=Arr[0];
int?k;
for(k=1;k<19;k++)
{
if(m_min>Arr[k])
{
m_min=Arr[k];
????????????num=k;
}
}
if(m_min>255)
m_min=255;
return?m_min;
}

void?main(int?argc?char*?argv[])
{
printf(“Welcome?to?use?the?Program?of?distance_changing!\n“);
????char?readPath[]=“C:\\Users\\冷冷的世界\\Desktop\\地圖代數(shù)實習報告\\tuxi

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????184374??2012-06-14?12:19??距離變換\Debug\Distance_chg.exe

?????文件?????243740??2012-06-14?12:19??距離變換\Debug\Distance_chg.ilk

?????文件??????20569??2012-06-14?12:19??距離變換\Debug\Distance_chg.obj

?????文件????3660844??2012-05-25?20:33??距離變換\Debug\Distance_chg.pch

?????文件?????484352??2012-06-14?12:19??距離變換\Debug\Distance_chg.pdb

?????文件?????140288??2012-06-14?12:19??距離變換\Debug\vc60.idb

?????文件??????77824??2012-06-14?12:19??距離變換\Debug\vc60.pdb

?????文件???????4479??2012-06-14?12:19??距離變換\Distance_chg.cpp

?????文件???????3473??2012-05-25?20:33??距離變換\Distance_chg.dsp

?????文件????????532??2012-05-25?20:44??距離變換\Distance_chg.dsw

?????文件??????41984??2012-06-14?13:26??距離變換\Distance_chg.ncb

?????文件??????48640??2012-06-14?13:26??距離變換\Distance_chg.opt

?????文件???????1184??2012-06-14?12:19??距離變換\Distance_chg.plg

?????目錄??????????0??2012-06-14?12:19??距離變換\Debug

?????目錄??????????0??2012-06-14?13:26??距離變換

-----------?---------??----------?-----??----

??????????????4912283????????????????????15


評論

共有 條評論

相關資源