欢迎光临
我们一直在努力

图片数组泛洪算法,8邻域泛洪算法

递归函数

void flood_array8(int x, int y, int width, int height,unsigned char * buf)
{
if(x >= 0 && x < height && y >= 0 && y < width && buf[x * width + y] == 4)
{
num+=1;
buf[x * width + y] = 99;//标记被泛洪的像素
flood_array8(x + 1, y,     width, height, buf);
flood_array8(x - 1, y,     width, height, buf);
flood_array8(x,     y + 1, width, height, buf);
flood_array8(x,     y - 1, width, height, buf);
flood_array8(x + 1, y + 1, width, height, buf);
flood_array8(x - 1, y - 1, width, height, buf);
flood_array8(x - 1, y + 1, width, height, buf);
flood_array8(x + 1, y - 1, width, height, buf);
}
}
赞(0) 打赏
未经允许不得转载:huangea的博客 » 图片数组泛洪算法,8邻域泛洪算法

评论 1

  1. #1

    很荣幸来到这里参观!

    衣皇后7年前 (2017-05-31)回复

有趣的网站

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

联系我们联系我们

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册