Skip to content

Multi hmr personal #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated scripts
  • Loading branch information
sebastianopazo1 committed Jul 22, 2024
commit 5deafb25f7546dd2d43a5013a4f74d4c901a2ba9
73 changes: 38 additions & 35 deletions Unity Scripts/JSONReader.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using Newtonsoft.Json;

public class JSONReader
[System.Serializable]
public class HumanParams
{
public class Human
{
public List<float> location { get; set; }
public List<float> translation { get; set; }
public List<List<float>> translation_pelvis { get; set; }
public List<List<float>> rotation_vector { get; set; }
public List<float> expression { get; set; }
public List<float> shape { get; set; }
public List<List<float>> joints_2d { get; set; }
public List<List<float>> joints_3d { get; set; }
}

public class Data
{
public int image_width { get; set; }
public int image_height { get; set; }
public int resized_width { get; set; }
public int resized_height { get; set; }
public int checkpoint_resolution { get; set; }
public List<List<float>> camera_intrinsics { get; set; }
public List<Human> humans { get; set; }
}

private Data data;
public float[] location;
public float[] translation;
public float[][] translation_pelvis;
public float[][] rotation_vector;
public float[] expression;
public float[] shape;
public float[][] joints_2d;
public float[][] joints_3d;
}

public void ReadJSON(string filePath)
{
string json = File.ReadAllText(filePath);
data = JsonConvert.DeserializeObject<Data>(json);
}
[System.Serializable]
public class SMPLXParams
{
//public int image_width;
//public int image_height;
public int resized_width;
public int resized_height;
public int checkpoint_resolution;
public float[][] camera_intrinsics;
public HumanParams[] humans;
}

public Data GetData()
public class JSONReader : MonoBehaviour
{
public static SMPLXParams ReadJSONFile(string filePath)
{
return data;
if (File.Exists(filePath))
{
string jsonContent = File.ReadAllText(filePath);
SMPLXParams parameters = JsonConvert.DeserializeObject<SMPLXParams>(jsonContent);
return parameters;
}
else
{
Debug.LogError("JSON file not found: " + filePath);
return null;
}
}
}
}
Loading