diff --git a/.gitignore b/.gitignore index 8695a4c..bb21f45 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,6 @@ crashlytics-build.properties # Temporary auto-generated Android Assets /[Aa]ssets/[Ss]treamingAssets/aa.meta -/[Aa]ssets/[Ss]treamingAssets/aa/* \ No newline at end of file +/[Aa]ssets/[Ss]treamingAssets/aa/* + +.DS_Store \ No newline at end of file diff --git a/Assets/Accounts/Scripts/UserList.cs b/Assets/Accounts/Scripts/UserList.cs index 6f47c9e..3e423ee 100644 --- a/Assets/Accounts/Scripts/UserList.cs +++ b/Assets/Accounts/Scripts/UserList.cs @@ -43,7 +43,7 @@ public class UserList : ScriptableObject /// void OnEnable() { - PATH = $"{Application.dataPath}/users.json"; + PATH = $"{Application.persistentDataPath}/users.json"; Load(); } diff --git a/Assets/Common/Models/FingerSpelling/model_A-L.onnx b/Assets/Common/Models/FingerSpelling/model_A-L.onnx index f10f15c..19893c4 100644 Binary files a/Assets/Common/Models/FingerSpelling/model_A-L.onnx and b/Assets/Common/Models/FingerSpelling/model_A-L.onnx differ diff --git a/Assets/Common/Models/FingerSpelling/model_A-L.onnx.meta b/Assets/Common/Models/FingerSpelling/model_A-L.onnx.meta index 901e23b..f7cf75b 100644 --- a/Assets/Common/Models/FingerSpelling/model_A-L.onnx.meta +++ b/Assets/Common/Models/FingerSpelling/model_A-L.onnx.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2594d8a9acfef6c4b88ce2618c4169cb +guid: e6d85df707405ad4f97c23b07227ee99 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/Assets/Common/Models/FingerSpelling/model_A-Z.onnx b/Assets/Common/Models/FingerSpelling/model_A-Z.onnx deleted file mode 100644 index cfa9938..0000000 Binary files a/Assets/Common/Models/FingerSpelling/model_A-Z.onnx and /dev/null differ diff --git a/Assets/Common/Models/FingerSpelling/model_A-Z.onnx.meta b/Assets/Common/Models/FingerSpelling/model_A-Z.onnx.meta deleted file mode 100644 index f7cf75b..0000000 --- a/Assets/Common/Models/FingerSpelling/model_A-Z.onnx.meta +++ /dev/null @@ -1,16 +0,0 @@ -fileFormatVersion: 2 -guid: e6d85df707405ad4f97c23b07227ee99 -ScriptedImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 2 - userData: - assetBundleName: - assetBundleVariant: - script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3} - optimizeModel: 1 - forceArbitraryBatchSize: 1 - treatErrorsAsWarnings: 0 - importMode: 1 - weightsTypeMode: 0 - activationTypeMode: 0 diff --git a/Assets/Common/ScriptableObjects/FingerspellingTheme.asset b/Assets/Common/ScriptableObjects/FingerspellingTheme.asset index ab8bf81..6e91a5a 100644 --- a/Assets/Common/ScriptableObjects/FingerspellingTheme.asset +++ b/Assets/Common/ScriptableObjects/FingerspellingTheme.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Handalfabet description: Van A tot Z index: 0 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: A image: {fileID: 21300000, guid: 4eb4ef55f866f114dafb722f4bd05c76, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingBasicsTheme.asset b/Assets/Common/ScriptableObjects/SpellingBasicsTheme.asset index 2ddede5..728fc13 100644 --- a/Assets/Common/ScriptableObjects/SpellingBasicsTheme.asset +++ b/Assets/Common/ScriptableObjects/SpellingBasicsTheme.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Basics description: Van welkom tot stop index: 10 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Hallo image: {fileID: 21300000, guid: f2a020e24bfa24842bccecf6b36d5b79, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingBuildings.asset b/Assets/Common/ScriptableObjects/SpellingBuildings.asset index f5f6ae2..069d1fc 100644 --- a/Assets/Common/ScriptableObjects/SpellingBuildings.asset +++ b/Assets/Common/ScriptableObjects/SpellingBuildings.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: In de Stad description: Van park tot zwembad index: 8 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Park image: {fileID: 21300000, guid: 8ea62bbfad596234c9f6ba49c41b3b08, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingFarm.asset b/Assets/Common/ScriptableObjects/SpellingFarm.asset index be3fc29..ea05801 100644 --- a/Assets/Common/ScriptableObjects/SpellingFarm.asset +++ b/Assets/Common/ScriptableObjects/SpellingFarm.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Boerderijdieren description: Van konijn tot kip index: 16 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: kat image: {fileID: 21300000, guid: 73f4e028d9efb644aa23538a749667c5, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingFruit.asset b/Assets/Common/ScriptableObjects/SpellingFruit.asset index cc51763..c8c4a1d 100644 --- a/Assets/Common/ScriptableObjects/SpellingFruit.asset +++ b/Assets/Common/ScriptableObjects/SpellingFruit.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Fruit description: Van aardbei tot kers index: 13 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Aardbei image: {fileID: 21300000, guid: 1a28fa2c46acbb1408633e4e98061d56, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingGeography.asset b/Assets/Common/ScriptableObjects/SpellingGeography.asset index 3a7a4fb..c688b95 100644 --- a/Assets/Common/ScriptableObjects/SpellingGeography.asset +++ b/Assets/Common/ScriptableObjects/SpellingGeography.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Geografie description: Van hier tot China index: 7 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: China image: {fileID: 21300000, guid: a5c1efdb79dcfb54aaf2723f4b4842be, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingHobbies.asset b/Assets/Common/ScriptableObjects/SpellingHobbies.asset index 12bbb74..d4ccf05 100644 --- a/Assets/Common/ScriptableObjects/SpellingHobbies.asset +++ b/Assets/Common/ScriptableObjects/SpellingHobbies.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Hobbies description: Van sport tot muziek index: 11 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Dansen image: {fileID: 21300000, guid: 6d405f607ae817744b49f921f0611088, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingPeople.asset b/Assets/Common/ScriptableObjects/SpellingPeople.asset index c3cf7bf..b156af6 100644 --- a/Assets/Common/ScriptableObjects/SpellingPeople.asset +++ b/Assets/Common/ScriptableObjects/SpellingPeople.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Mensen description: Van vrienden tot familie index: 12 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Broer image: {fileID: 21300000, guid: daebe503f7767b64683d8eeab617e8bc, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingSports.asset b/Assets/Common/ScriptableObjects/SpellingSports.asset index 84c2115..f148555 100644 --- a/Assets/Common/ScriptableObjects/SpellingSports.asset +++ b/Assets/Common/ScriptableObjects/SpellingSports.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Sporten description: Van atletiek tot zeilen index: 9 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Atletiek image: {fileID: 21300000, guid: 25a05f23961d2b443972f4aa3c2bec29, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingVeggies.asset b/Assets/Common/ScriptableObjects/SpellingVeggies.asset index e716866..84923d9 100644 --- a/Assets/Common/ScriptableObjects/SpellingVeggies.asset +++ b/Assets/Common/ScriptableObjects/SpellingVeggies.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Groenten description: Van erwt tot komkommer index: 14 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Aardappel image: {fileID: 21300000, guid: 2610cdbc24a125f43ada7fed67d8f51b, type: 3} diff --git a/Assets/Common/ScriptableObjects/SpellingWild.asset b/Assets/Common/ScriptableObjects/SpellingWild.asset index 7f83977..4848035 100644 --- a/Assets/Common/ScriptableObjects/SpellingWild.asset +++ b/Assets/Common/ScriptableObjects/SpellingWild.asset @@ -15,7 +15,7 @@ MonoBehaviour: title: Dieren in het wild description: Van Leeuw tot olifant index: 15 - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} learnables: - name: Vos image: {fileID: 21300000, guid: 9d5771baa6ea6e041b066135d6798e1c, type: 3} diff --git a/Assets/Courses/Scenes/TemplateCourse.unity b/Assets/Courses/Scenes/TemplateCourse.unity index 4f15a84..99d60e1 100644 --- a/Assets/Courses/Scenes/TemplateCourse.unity +++ b/Assets/Courses/Scenes/TemplateCourse.unity @@ -490,7 +490,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6b3f784c065813a4a8364b1299284816, type: 3} m_Name: m_EditorClassIdentifier: - previewModel: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + previewModel: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} feedbackProgressBar: {fileID: 4318122121437849759} previewMessage: {fileID: 2070775951} player: {fileID: 993952931} @@ -1299,7 +1299,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3} m_Name: m_EditorClassIdentifier: - model: {fileID: 0} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3} configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3} screen: {fileID: 378145456} diff --git a/Assets/MediaPipeUnity/Common/Scripts/KeypointManager.cs b/Assets/MediaPipeUnity/Common/Scripts/KeypointManager.cs index 4e61ee0..6a27b87 100644 --- a/Assets/MediaPipeUnity/Common/Scripts/KeypointManager.cs +++ b/Assets/MediaPipeUnity/Common/Scripts/KeypointManager.cs @@ -53,6 +53,107 @@ public class KeypointManager return (normalized_x, normalized_y); } + private (List, List) NormalizeHandBohaecek(List hand_x, List hand_y) + { + + float min_x = hand_x.Min(); + float min_y = hand_y.Min(); + + float max_x = hand_x.Max(); + float max_y = hand_y.Max(); + + float width = max_x - min_x; + float height = max_y - min_y; + + float delta_x = 0; + float delta_y = 0; + + if (width == 0 || height == 0) + { + return (hand_x, hand_y); + } + + + if (width > height){ + delta_x = ((float)0.1)*width; + delta_y = delta_x + ((width - height)/2); + }else{ + delta_y = ((float)0.1)*height; + delta_x = delta_y + ((height - width)/2); + } + + float starting_x = min_x - delta_x; + float starting_y = min_y - delta_y; + + float ending_x = max_x + delta_x; + float ending_y = max_y + delta_y; + + float bbox_center_x = (starting_x + ending_x) / 2; + float bbox_center_y = (starting_y + ending_y) / 2; + + float bbox_width = ending_x - starting_x; + float bbox_height = ending_y - starting_y; + + List normalized_x = new List(); + List normalized_y = new List(); + + for (int i = 0; i < hand_x.Count; i++) + { + normalized_x.Add((hand_x[i] - bbox_center_x) / bbox_width); + normalized_y.Add((hand_y[i] - bbox_center_y) / bbox_height); + } + + return (normalized_x, normalized_y); + } + + public (List, List) PoseNormalization(List pose_x, List pose_y) + { + + float bbox_size = ((float)4.0); + + float shoulder_left_x = pose_x[6]; + float shoulder_left_y = pose_y[6]; + + float shoulder_right_x = pose_x[7]; + float shoulder_right_y = pose_y[7]; + + float shoulder_distance = Mathf.Sqrt(Mathf.Pow(shoulder_left_x - shoulder_right_x, 2) + Mathf.Pow(shoulder_left_y - shoulder_right_y, 2)); + float shoulder_center_x = (shoulder_left_x + shoulder_right_x) / 2; + float shoulder_center_y = (shoulder_left_y + shoulder_right_y) / 2; + + float eye_left_x = pose_x[1]; + float eye_left_y = pose_y[1]; + + float starting_x = shoulder_center_x - (bbox_size/2) * shoulder_distance; + float starting_y = eye_left_y - shoulder_distance/2; + + float ending_x = shoulder_center_x + (bbox_size/2) * shoulder_distance; + float ending_y = starting_y + (bbox_size - ((float)0.5)) * shoulder_distance; + + float bbox_center_x = (starting_x + ending_x) / 2; + float bbox_center_y = (starting_y + ending_y) / 2; + + float bbox_width = ending_x - starting_x; + float bbox_height = ending_y - starting_y; + + if (bbox_width == 0 || bbox_height == 0) + { + return (pose_x, pose_y); + } + + List normalized_x = new List(); + List normalized_y = new List(); + + for (int i = 0; i < pose_x.Count; i++) + { + normalized_x.Add((pose_x[i] - bbox_center_x) / bbox_width); + normalized_y.Add((pose_y[i] - bbox_center_y) / bbox_height); + } + + return (normalized_x, normalized_y); + } + + public void AddLandmarks(NormalizedLandmarkList poseLandmarks, NormalizedLandmarkList leftHandLandmarks, NormalizedLandmarkList rightHandLandmarks) { List pose_x = new List(); @@ -105,11 +206,9 @@ public class KeypointManager } } - // TODO: Add normalization - //Debug.Log($"pose_landMarks = [{modelInfo.pose_landmarks.Aggregate(" ", (t, f) => $"{t} {f}")}]"); - //Debug.Log($"hand_landmarks = [{modelInfo.hand_landmarks.Aggregate(" ", (t, f) => $"{t} {f}")}]"); - (left_hand_x, left_hand_y) = NormalizeHand(left_hand_x, left_hand_y); - (right_hand_x, right_hand_y) = NormalizeHand(right_hand_x, right_hand_y); + (pose_x, pose_y) = PoseNormalization(pose_x, pose_y); + (left_hand_x, left_hand_y) = NormalizeHandBohaecek(left_hand_x, left_hand_y); + (right_hand_x, right_hand_y) = NormalizeHandBohaecek(right_hand_x, right_hand_y); if (keypointsBuffer.Count >= 10) diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..a546ddd --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3f7371598add9549b5351c44a9e17b3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Models.meta b/Assets/Resources/Models.meta new file mode 100644 index 0000000..7f94823 --- /dev/null +++ b/Assets/Resources/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7992d1284c7de4b089f4155b3e4ada83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SpellingBee/Scenes/Game.unity b/Assets/SpellingBee/Scenes/Game.unity index 6ff8f79..4bf59ee 100644 --- a/Assets/SpellingBee/Scenes/Game.unity +++ b/Assets/SpellingBee/Scenes/Game.unity @@ -3900,7 +3900,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3} m_Name: m_EditorClassIdentifier: - model: {fileID: 5022602860645237092, guid: 2594d8a9acfef6c4b88ce2618c4169cb, type: 3} + model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3} modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3} configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3} screen: {fileID: 1743003084} diff --git a/Assets/SpellingBee/Scripts/GameController.cs b/Assets/SpellingBee/Scripts/GameController.cs index 5481e6a..c211e29 100644 --- a/Assets/SpellingBee/Scripts/GameController.cs +++ b/Assets/SpellingBee/Scripts/GameController.cs @@ -227,6 +227,7 @@ public partial class GameController : MonoBehaviour int seconds = Mathf.FloorToInt(timerValue % 60.0f); timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds); + } } @@ -402,9 +403,9 @@ public partial class GameController : MonoBehaviour if (wordIndex < words.Count) { currentWord = words[wordIndex].name; - DisplayWord(currentWord); - letterIndex = 0; + + DisplayWord(currentWord); wordIndex++; } else diff --git a/Assets/users.json.meta b/Assets/users.json.meta new file mode 100644 index 0000000..be8bf7d --- /dev/null +++ b/Assets/users.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b78a998f611664947a7e5edb192dd6ff +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/BurstAotSettings_StandaloneOSX.json b/ProjectSettings/BurstAotSettings_StandaloneOSX.json new file mode 100644 index 0000000..56f4abe --- /dev/null +++ b/ProjectSettings/BurstAotSettings_StandaloneOSX.json @@ -0,0 +1,16 @@ +{ + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "UsePlatformSDKLinker": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsX64": 72, + "OptimizeFor": 0 + } +} diff --git a/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json new file mode 100644 index 0000000..2510fe1 --- /dev/null +++ b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json @@ -0,0 +1,23 @@ +{ + "m_Name": "Settings", + "m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json", + "m_Dictionary": { + "m_DictionaryValues": [ + { + "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "IncludeAssemblies", + "value": "{\"m_Value\":\"AccountsScripts,AccountsTests,Assembly-CSharp,Assembly-CSharp-Editor,CommonScripts,CommonTests,CourseScripts,CoursesTests,HangmanTests,InterfacesScripts,JustSignTests,MediaPipeUnityScripts,SignPredictor,SpellingBeeScripts,SpellingBeeTests,Tween\"}" + }, + { + "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "Path", + "value": "{\"m_Value\":\"{ProjectPath}\"}" + }, + { + "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "HistoryPath", + "value": "{\"m_Value\":\"{ProjectPath}\"}" + } + ] + } +} \ No newline at end of file diff --git a/wesign-builds/WeSign-MacOS.zip b/wesign-builds/WeSign-MacOS.zip new file mode 100644 index 0000000..80fd250 Binary files /dev/null and b/wesign-builds/WeSign-MacOS.zip differ