From 38ae6a80cd8863667fa916afd8999825d2105e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=AE=B6=E4=B9=90?= <14352673+xujialellll@user.noreply.gitee.com> Date: Mon, 10 Jun 2024 09:50:23 +0000 Subject: [PATCH] update main.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 徐家乐 <14352673+xujialellll@user.noreply.gitee.com> --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index e923a4b..107d525 100644 --- a/main.py +++ b/main.py @@ -188,10 +188,10 @@ class ImageProcessor: filename = os.path.basename(self.image_path) # 计算其他基本信息 - total_pixels = # TODO: 获取图像的总像素数 - shape = # TODO: 获取图像的形状(高度,宽度,通道数) - channels = # TODO: 获取图像的通道数,注意不是维度,而是通道数 - dtype = # TODO: 获取图像像素的数据类型 + total_pixels = self.img.size: 获取图像的总像素数 + shape = self.img.shape : 获取图像的形状(高度,宽度,通道数) + channels = shape[2] if len(shape) > 2 else 1: 获取图像的通道数,注意不是维度,而是通道数 + dtype = self.img.dtype: 获取图像像素的数据类型 # 构建信息字符串,包括文件名 details = language_data[self.current_language]['info_str'].format(filename,total_pixels,shape,channels,dtype) -- Gitee