当前位置: 首页 > news >正文

网站源码对应的数据库怎么做深圳建设交易中心网站首页

网站源码对应的数据库怎么做,深圳建设交易中心网站首页,郑州市建设工程信息网官网,济南网站建设 首选搜点网络老板给了张没有atlas文件的图集让我拆图,简单写了一版凑合用。 存在的问题: 可能会拆出来一些小尺寸的透明像素图片;可能会拆出来一些偏大的小图的整体集合;可能会把应该是一块的小图批成两半,不过不多;其…

老板给了张没有atlas文件的图集让我拆图,简单写了一版凑合用。

存在的问题:

  • 可能会拆出来一些小尺寸的透明像素图片;
  • 可能会拆出来一些偏大的小图的整体集合;
  • 可能会把应该是一块的小图批成两半,不过不多;
  • 其他未知的问题...

小图目测基本齐全,没用的图...手删一下趴

有改正的同学烦请告知,比个♥

from PIL import Image  
import numpy as np  
import timedef split_image_into_blocks(image_path, threshold=0):  img = Image.open(image_path)  if img.mode != 'RGBA':  img = img.convert('RGBA')  # 转换到RGBA模式以获取alpha通道  img_data = np.array(img)  width, height = img.size  output_index = 0col_start_index = np.zeros(height, dtype=int)  # 弃用,有问题,应该划分块regions = []def detect_bounding_box(row, col):# 初始化包围盒  min_row, max_row = row, row  min_col, max_col = col, col  if min_row == height:return min_row, min_col, max_row, max_coldef extern_bottom_left_right(row, min_col, max_col):# 最大行向下扩展max_row = row# 最小列向左扩展if min_col > 0:for col in range(min_col - 1, -1, -1):if img_data[row, col, 3] != threshold and col < min_col:min_col = colelse:break# 最大列向右扩展if max_col < width:for col in range(max_col + 1, width):if img_data[row, col, 3] != threshold and col > max_col:max_col = colelse:breakreturn min_col, max_row, max_col# 开始向下拓展for row in range(min_row + 1, height):# 非透明像素if img_data[row, min_col, 3] != threshold:min_col, max_row, max_col = extern_bottom_left_right(row, min_col, max_col)# 当前行最小列是透明像素else:# 向右判断当前行包围盒是否全为透明像素row_all_0_flag = Truefor col in range(min_col + 1, max_col):if img_data[row, col, 3] != threshold:row_all_0_flag = Falsemin_col, max_row, max_col = extern_bottom_left_right(row, min_col, max_col)break# 当前行包围盒全透明,封闭包围盒if row_all_0_flag:breakreturn min_row, min_col, max_row, max_col# 遍历图像以找到非“透明”区域  for row in range(height):  col = 0while col < width:if img_data[row, col, 3] != threshold:  # 假设threshold是“透明”的替代值  bounding_box = detect_bounding_box(row, col)print(f'第{output_index}张图片包围盒:{bounding_box}')min_row, min_col, max_row, max_col = bounding_box# 获取包围盒后置位透明img_data[min_row : max_row + 1, min_col : max_col + 1, 3] = 0# 裁剪并保存图像块  cropped_img = img.crop((min_col, min_row, max_col + 1, max_row + 1))  cropped_img.save(f"output3/output_{output_index}.png")  print(f'第{output_index}张图片保存成功,路径:output2/output_{output_index}.png')output_index += 1  col = col + 1# 使用示例  
start_time = time.time()
split_image_into_blocks("texture_00.png", threshold=0)  # 假设0是“透明”的替代值
end_time = time.time()
usage_time = int(end_time - start_time)
m = usage_time // 60
s = usage_time % 60
print(f'任务执行完成,耗时:{m}分{s}秒')

http://www.yayakq.cn/news/263392/

相关文章:

  • 机关作风建设网站佛山新网站制作市场
  • 深圳营销型网站建设价格销售产品网站有哪些
  • 海外域名网站厦门seo推广外包
  • 怎样在别人网站做加强链接网站首页 栏目页 内容页
  • 企业注册网站自己做网站什么网站比较好
  • 网站建站ddpwordpress编码修改
  • 网站地址栏图标制作信用门户网站建设
  • 内蒙古住房城乡建设厅网站安康市住房和城乡建设局网站
  • 响应式网站的设计趋势组织架构及营销网络怎么填写
  • 做一个公司网站公共资源交易中心属于哪个部门
  • 发布的手机网站是乱码用 可以做网站软件吗
  • 鞋子的网站策划方案模板酒店软装设计公司官网
  • 架设网站 软件wordpress4.9.4 安装
  • 工信部网站备案查询 手机c 用mysql做的网站
  • asp跳转到别的网站seo排名点击软件运营
  • 手机网站建设效果网页qq登录保护怎么关
  • 网站制作哪家最好用家用电脑建设网站
  • 企业网站建设感想做net网站
  • 金华网站建设多少钱中小企业网站建设需要注意什么
  • iis配置wap网站响应式做的好的网站有哪些
  • 怎么给客户推网站建设百度客户端在哪里打开
  • 网站设计制作一般多少钱seo优化提升排名
  • 网站点击率穿衣打扮 wordpress
  • html5浏览器seo技术服务外包公司
  • 中小企业网站建设渠道seo优化技巧
  • 网站开发个人工作室江苏市场监督管理局旗舰店
  • 寻找扬中网站建设在局网站 作风建设
  • 烟台网站建设科技把里面的dede和plugins这2个文件夹覆盖到你的网站根目录
  • 做网站和网站页面设计用html做的网站步骤
  • 网站策划书是什么pc端网站建设相关查阅资料