save hair demo
This commit is contained in:
@@ -7,7 +7,8 @@ RESIZE_TO = (256, 256)
|
||||
LARGE_IMAGE_SIZE = (2048, 2048)
|
||||
IMAGE_COUNT = 64
|
||||
|
||||
ROOT_DIR = '../example/src/main/assets/pic'
|
||||
#ROOT_DIR = '../example/src/main/assets/pic'
|
||||
ROOT_DIR = 'D:/face_sdk/example/src/main/assets/pic'
|
||||
|
||||
def load_json(file_path):
|
||||
with open(file_path, 'r') as file:
|
||||
@@ -54,7 +55,8 @@ def remove_white_border(image):
|
||||
def resize_image(image_path):
|
||||
image = Image.open(image_path).convert('RGBA')
|
||||
image = remove_white_border(image)
|
||||
return image.resize(RESIZE_TO)
|
||||
image = image.resize(RESIZE_TO)
|
||||
return image
|
||||
|
||||
def main(json_file_path):
|
||||
# 确保使用完整路径
|
||||
@@ -92,4 +94,4 @@ def main(json_file_path):
|
||||
json.dump(new_data, outfile, indent=4)
|
||||
|
||||
# 使用示例
|
||||
main('motion_data.json')
|
||||
main('motion_data_ex2.json')
|
||||
+3
-2
@@ -120,6 +120,7 @@ def collect_png_from_subfolders(base_path=".", output_file="../example/src/main/
|
||||
# 使用方法
|
||||
if __name__ == "__main__":
|
||||
# 可以指定要遍历的基础路径,默认为当前目录
|
||||
base_path_to_scan = '../example/src/main/assets/pic' # 当前目录
|
||||
# base_path_to_scan = '../example/src/main/assets/pic' # 当前目录
|
||||
base_path_to_scan = 'D:/face_sdk/example/src/main/assets/pic' # 当前目录
|
||||
|
||||
collect_png_from_subfolders(base_path_to_scan)
|
||||
collect_png_from_subfolders(base_path_to_scan, 'D:/face_sdk/example/src/main/assets/pic/motion_data_ex2.json')
|
||||
Reference in New Issue
Block a user