mirror of
https://github.com/ganeshsar/UnityPythonMediaPipeBodyPose.git
synced 2026-03-13 08:00:33 +08:00
fixed float parse bug
made float parsing cultural invariant (caused some problems in non english languages)
This commit is contained in:
@@ -202,6 +202,8 @@ public class PipeServer : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
|
||||
|
||||
body = new Body(lParent,landmarkPrefab,linePrefab,landmarkScale,enableHead?headPrefab:null);
|
||||
|
||||
Thread t = new Thread(new ThreadStart(Run));
|
||||
@@ -233,6 +235,8 @@ public class PipeServer : MonoBehaviour
|
||||
|
||||
void Run()
|
||||
{
|
||||
System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
|
||||
|
||||
// Open the named pipe.
|
||||
server = new NamedPipeServerStream("UnityMediaPipeBody",PipeDirection.InOut, 99, PipeTransmissionMode.Message);
|
||||
|
||||
@@ -240,7 +244,7 @@ public class PipeServer : MonoBehaviour
|
||||
server.WaitForConnection();
|
||||
|
||||
print("Connected.");
|
||||
var br = new BinaryReader(server);
|
||||
var br = new BinaryReader(server, Encoding.UTF8);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ class BodyThread(threading.Thread):
|
||||
for i in range(0,33):
|
||||
self.data += "{}|{}|{}|{}\n".format(i,hand_world_landmarks.landmark[i].x,hand_world_landmarks.landmark[i].y,hand_world_landmarks.landmark[i].z)
|
||||
|
||||
s = self.data.encode('ascii')
|
||||
s = self.data.encode('utf-8')
|
||||
try:
|
||||
self.pipe.write(struct.pack('I', len(s)) + s)
|
||||
self.pipe.seek(0)
|
||||
|
||||
Reference in New Issue
Block a user