3 Star 4 Fork 4

破竹 / bitmap_play

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
识别.cpp 2.40 KB
一键复制 编辑 原始数据 按行查看 历史
破竹 提交于 2019-11-29 10:58 . bitmap
/************************************
图像处理系统,ReadBitMap
*************************************/
#include"bm.h"
#include<math.h>
void main()
{
int be = 2;
long poitn = 0;
BITMAP_PZ bm = CreMap_pz("27.bmp");
BITMAP_PZ bm1 = CreMap_pz("22.bmp");
int *fill = (int*)malloc(bm.BitInfoHead.biWidth*bm.BitInfoHead.biHeight*sizeof(int));
memset(fill, 0, bm.BitInfoHead.biWidth*bm.BitInfoHead.biHeight*sizeof(int));
FILE *poit, *rgb;
poit = fopen("poit.h", "w");
rgb = fopen("rgb.h", "w");
int m = bm.BitInfoHead.biWidth / 2;
int n = bm.BitInfoHead.biHeight / 2 ;
int x, y, z;
int kk = 0;
initgraph(bm.BitInfoHead.biWidth, bm.BitInfoHead.biHeight);
for (int j = 0; j < bm.BitInfoHead.biHeight; j += 1)
{
for (int i = 0; i < bm.BitInfoHead.biWidth; i += 1)
{
RGBQUAd rgbb = GetPix(&bm, i, j);
{
//if (rgbb.rgbRed*0.299 + rgbb.rgbGreen*0.578 + rgbb.rgbBlue*0.114 <= 192)
if (shibie(&bm,fill,i,j))
//if (sqrt(pow((double)(i - m), 2) + pow((double)(j - n), 2)) < 130)
//{
// int jk, kl;
// toSpin(m, n, i-m, j-n, 60, &jk, &kl);
// putpixel(jk, kl, RGB(255, 255,255));
//}
//int b[6][2] = { { 1, -1 }, { -1, 1 }, { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } };
//for (int h = 0; h < 6;h++)
//{
// if (fill[(i + b[h][0] + (j + b[h][1])*bm.BitInfoHead.biWidth)] == 1)
// {
// setlinestyle(PS_SOLID, 10); //设置画线的大小
// setcolor(LIGHTGRAY);
// line(i, j, 600, 135);
// break;
// }
//}
kk++;
}
}
}
int color = 0,ke=1;
for (int j = 0; j < bm.BitInfoHead.biHeight; j++)
{
for (int i = 0; i < bm.BitInfoHead .biWidth; i++)
{
if (fill[(i + (j)*bm.BitInfoHead.biWidth)] == 1)
{
//if ((sqrt(pow((double)(i - m), 2) + pow((double)(j + 60 - n), 2)) > 60) && j < n - 20)
//continue;
putpixel(i, j, RGB(i, 255, j));
}
else
{
//putpixel(i, j, RGB(0, 0, color));
}
fprintf(rgb, "%d", fill[(i + (j)*bm.BitInfoHead.biWidth)]);
color+=ke;
if (color >= 255||color==0)
ke = -ke;
}
fprintf(rgb, "\n");
}
//for (int i = 0; i < 360; i +=60)
//{
// int jk, kl;
// toSpin(m, n, 3, 3, i, &jk, &kl);
//// putpixel(jk, kl, RGB(255, 5, 0));
//}
RGBQUAd rgbp;
fprintf(rgb, " poit number %d", poitn);
fclose(poit);
fclose(rgb);
CloseBM_pz(bm); //关闭位图
getchar();
getchar();
closegraph();
printf("\n");
}
C++
1
https://gitee.com/pozhu15/bitmap_play.git
git@gitee.com:pozhu15/bitmap_play.git
pozhu15
bitmap_play
bitmap_play
master

搜索帮助