面积计算.py 843 B

1234567891011121314151617181920212223
  1. from app.utils.arean_anylize_draw import DefectProcessor, to_json_serializable
  2. import json
  3. if __name__ == '__main__':
  4. json_path = r"C:\Code\ML\Project\CheckCardBoxAndDefectServer\temp\corner_no_reflect\00006_250805_pokemon_0001_bottom_grid_r0_c5.json"
  5. with open(json_path, 'r', encoding='utf-8') as f:
  6. labelme_data = json.load(f)
  7. processor = DefectProcessor(pixel_resolution=24.54)
  8. result = processor.analyze_from_json(labelme_data)
  9. print(result)
  10. print(type(result))
  11. # with open('result.json', 'w', encoding='utf-8') as f:
  12. # f.write(result_json)
  13. # result_json = to_json_serializable(result.to_dict())
  14. # print(result_json)
  15. # print(json.loads(result_json))
  16. # with open('result.json', 'w', encoding='utf-8') as f:
  17. # json.dump(result_json, f, ensure_ascii=False, indent=2)