diff --git a/.travis.yml b/.travis.yml index 82c7748b..e169a021 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ branches: only: - master - develop - - feature/no-ui-fix + - feature/code_cleanup compiler: - gcc @@ -74,16 +74,8 @@ before_install: script: - $CXX --version - - cd lib/local/LandmarkDetector/model/patch_experts - - wget https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat?dl=1 - - wget https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat?dl=1 - - wget https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat?dl=1 - - wget https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat?dl=1 - - mv cen_patches_0.25_of.dat?dl=1 cen_patches_0.25_of.dat - - mv cen_patches_0.35_of.dat?dl=1 cen_patches_0.35_of.dat - - mv cen_patches_0.50_of.dat?dl=1 cen_patches_0.50_of.dat - - mv cen_patches_1.00_of.dat?dl=1 cen_patches_1.00_of.dat - - cd ../../../../../ + - chmod 777 ./download_models.sh + - ./download_models.sh - mkdir build - cd build - cmake -D CMAKE_BUILD_TYPE=RELEASE CMAKE_CXX_FLAGS="-std=c++11" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11" .. diff --git a/OpenFace_vs2017.sln b/OpenFace_vs2017.sln new file mode 100644 index 00000000..8e670276 --- /dev/null +++ b/OpenFace_vs2017.sln @@ -0,0 +1,182 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LandmarkDetector", "lib\local\LandmarkDetector\LandmarkDetector.vcxproj", "{BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FaceAnalyser", "lib\local\FaceAnalyser\FaceAnalyser.vcxproj", "{0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FeatureExtraction", "exe\FeatureExtraction\FeatureExtraction.vcxproj", "{8A23C00D-767D-422D-89A3-CF225E3DAB4B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{99FEBA13-BDDF-4076-B57E-D8EF4076E20D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Executables", "Executables", "{9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FaceLandmarkVidMulti", "exe\FaceLandmarkVidMulti\FaceLandmarkVidMulti.vcxproj", "{C3FAF36F-44BC-4454-87C2-C5106575FE50}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recording", "exe\Recording\Recording.vcxproj", "{2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FaceLandmarkVid", "exe\FaceLandmarkVid\FaceLandmarkVid.vcxproj", "{34032CF2-1B99-4A25-9050-E9C13DD4CD0A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FaceLandmarkImg", "exe\FaceLandmarkImg\FaceLandmarkImg.vcxproj", "{DDC3535E-526C-44EC-9DF4-739E2D3A323B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GazeAnalyser", "lib\local\GazeAnalyser\GazeAnalyser.vcxproj", "{5F915541-F531-434F-9C81-79F5DB58012B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UtilLibs", "UtilLibs", "{652CCE53-4997-4B43-9A99-28D075199C99}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "lib\local\Utilities\Utilities.vcxproj", "{8E741EA2-9386-4CF2-815E-6F9B08991EAC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gui", "gui", "{E59CF005-539F-484F-9AA6-9F08AC2DB31E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeadPoseLive", "gui\HeadPose-live\HeadPoseLive.csproj", "{F396362D-821E-4EA6-9BBF-1F6050844118}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFaceDemo", "gui\OpenFaceDemo\OpenFaceDemo.csproj", "{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFaceOffline", "gui\OpenFaceOffline\OpenFaceOffline.csproj", "{A4760F41-2B1F-4144-B7B2-62785AFFE79B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppInerop", "lib\local\CppInerop\CppInerop.vcxproj", "{78196985-EE54-411F-822B-5A23EDF80642}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CameraEnumerator", "lib\3rdParty\CameraEnumerator\CameraEnumerator.vcxproj", "{50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Debug|Win32.Build.0 = Debug|Win32 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Debug|x64.ActiveCfg = Debug|x64 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Debug|x64.Build.0 = Debug|x64 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Release|Win32.ActiveCfg = Release|Win32 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Release|Win32.Build.0 = Release|Win32 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Release|x64.ActiveCfg = Release|x64 + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8}.Release|x64.Build.0 = Release|x64 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Debug|Win32.ActiveCfg = Debug|Win32 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Debug|Win32.Build.0 = Debug|Win32 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Debug|x64.ActiveCfg = Debug|x64 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Debug|x64.Build.0 = Debug|x64 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Release|Win32.ActiveCfg = Release|Win32 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Release|Win32.Build.0 = Release|Win32 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Release|x64.ActiveCfg = Release|x64 + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7}.Release|x64.Build.0 = Release|x64 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Debug|Win32.ActiveCfg = Debug|Win32 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Debug|Win32.Build.0 = Debug|Win32 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Debug|x64.ActiveCfg = Debug|x64 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Debug|x64.Build.0 = Debug|x64 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Release|Win32.ActiveCfg = Release|Win32 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Release|Win32.Build.0 = Release|Win32 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Release|x64.ActiveCfg = Release|x64 + {8A23C00D-767D-422D-89A3-CF225E3DAB4B}.Release|x64.Build.0 = Release|x64 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Debug|Win32.ActiveCfg = Debug|Win32 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Debug|Win32.Build.0 = Debug|Win32 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Debug|x64.ActiveCfg = Debug|x64 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Debug|x64.Build.0 = Debug|x64 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Release|Win32.ActiveCfg = Release|Win32 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Release|Win32.Build.0 = Release|Win32 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Release|x64.ActiveCfg = Release|x64 + {C3FAF36F-44BC-4454-87C2-C5106575FE50}.Release|x64.Build.0 = Release|x64 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Debug|Win32.Build.0 = Debug|Win32 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Debug|x64.ActiveCfg = Debug|x64 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Debug|x64.Build.0 = Debug|x64 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Release|Win32.ActiveCfg = Release|Win32 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Release|Win32.Build.0 = Release|Win32 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Release|x64.ActiveCfg = Release|x64 + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC}.Release|x64.Build.0 = Release|x64 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Debug|Win32.ActiveCfg = Debug|Win32 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Debug|Win32.Build.0 = Debug|Win32 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Debug|x64.ActiveCfg = Debug|x64 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Debug|x64.Build.0 = Debug|x64 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Release|Win32.ActiveCfg = Release|Win32 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Release|Win32.Build.0 = Release|Win32 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Release|x64.ActiveCfg = Release|x64 + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A}.Release|x64.Build.0 = Release|x64 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Debug|Win32.ActiveCfg = Debug|Win32 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Debug|Win32.Build.0 = Debug|Win32 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Debug|x64.ActiveCfg = Debug|x64 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Debug|x64.Build.0 = Debug|x64 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Release|Win32.ActiveCfg = Release|Win32 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Release|Win32.Build.0 = Release|Win32 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Release|x64.ActiveCfg = Release|x64 + {DDC3535E-526C-44EC-9DF4-739E2D3A323B}.Release|x64.Build.0 = Release|x64 + {5F915541-F531-434F-9C81-79F5DB58012B}.Debug|Win32.ActiveCfg = Debug|Win32 + {5F915541-F531-434F-9C81-79F5DB58012B}.Debug|Win32.Build.0 = Debug|Win32 + {5F915541-F531-434F-9C81-79F5DB58012B}.Debug|x64.ActiveCfg = Debug|x64 + {5F915541-F531-434F-9C81-79F5DB58012B}.Debug|x64.Build.0 = Debug|x64 + {5F915541-F531-434F-9C81-79F5DB58012B}.Release|Win32.ActiveCfg = Release|Win32 + {5F915541-F531-434F-9C81-79F5DB58012B}.Release|Win32.Build.0 = Release|Win32 + {5F915541-F531-434F-9C81-79F5DB58012B}.Release|x64.ActiveCfg = Release|x64 + {5F915541-F531-434F-9C81-79F5DB58012B}.Release|x64.Build.0 = Release|x64 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Debug|Win32.ActiveCfg = Debug|Win32 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Debug|Win32.Build.0 = Debug|Win32 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Debug|x64.ActiveCfg = Debug|x64 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Debug|x64.Build.0 = Debug|x64 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Release|Win32.ActiveCfg = Release|Win32 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Release|Win32.Build.0 = Release|Win32 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Release|x64.ActiveCfg = Release|x64 + {8E741EA2-9386-4CF2-815E-6F9B08991EAC}.Release|x64.Build.0 = Release|x64 + {F396362D-821E-4EA6-9BBF-1F6050844118}.Debug|Win32.ActiveCfg = Debug|x86 + {F396362D-821E-4EA6-9BBF-1F6050844118}.Debug|Win32.Build.0 = Debug|x86 + {F396362D-821E-4EA6-9BBF-1F6050844118}.Debug|x64.ActiveCfg = Debug|Any CPU + {F396362D-821E-4EA6-9BBF-1F6050844118}.Debug|x64.Build.0 = Debug|Any CPU + {F396362D-821E-4EA6-9BBF-1F6050844118}.Release|Win32.ActiveCfg = Release|x86 + {F396362D-821E-4EA6-9BBF-1F6050844118}.Release|Win32.Build.0 = Release|x86 + {F396362D-821E-4EA6-9BBF-1F6050844118}.Release|x64.ActiveCfg = Release|Any CPU + {F396362D-821E-4EA6-9BBF-1F6050844118}.Release|x64.Build.0 = Release|Any CPU + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|Win32.ActiveCfg = Debug|x86 + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|Win32.Build.0 = Debug|x86 + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|x64.ActiveCfg = Debug|Any CPU + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|x64.Build.0 = Debug|Any CPU + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|Win32.ActiveCfg = Release|x86 + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|Win32.Build.0 = Release|x86 + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|x64.ActiveCfg = Release|Any CPU + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|x64.Build.0 = Release|Any CPU + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Debug|Win32.ActiveCfg = Debug|x86 + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Debug|Win32.Build.0 = Debug|x86 + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Debug|x64.ActiveCfg = Debug|Any CPU + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Debug|x64.Build.0 = Debug|Any CPU + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|Win32.ActiveCfg = Release|x86 + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|Win32.Build.0 = Release|x86 + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.ActiveCfg = Release|Any CPU + {A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.Build.0 = Release|Any CPU + {78196985-EE54-411F-822B-5A23EDF80642}.Debug|Win32.ActiveCfg = Debug|Win32 + {78196985-EE54-411F-822B-5A23EDF80642}.Debug|Win32.Build.0 = Debug|Win32 + {78196985-EE54-411F-822B-5A23EDF80642}.Debug|x64.ActiveCfg = Debug|x64 + {78196985-EE54-411F-822B-5A23EDF80642}.Debug|x64.Build.0 = Debug|x64 + {78196985-EE54-411F-822B-5A23EDF80642}.Release|Win32.ActiveCfg = Release|Win32 + {78196985-EE54-411F-822B-5A23EDF80642}.Release|Win32.Build.0 = Release|Win32 + {78196985-EE54-411F-822B-5A23EDF80642}.Release|x64.ActiveCfg = Release|x64 + {78196985-EE54-411F-822B-5A23EDF80642}.Release|x64.Build.0 = Release|x64 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Debug|Win32.ActiveCfg = Debug|Win32 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Debug|Win32.Build.0 = Debug|Win32 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Debug|x64.ActiveCfg = Debug|x64 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Debug|x64.Build.0 = Debug|x64 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Release|Win32.ActiveCfg = Release|Win32 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Release|Win32.Build.0 = Release|Win32 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Release|x64.ActiveCfg = Release|x64 + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BDC1D107-DE17-4705-8E7B-CDDE8BFB2BF8} = {99FEBA13-BDDF-4076-B57E-D8EF4076E20D} + {0E7FC556-0E80-45EA-A876-DDE4C2FEDCD7} = {99FEBA13-BDDF-4076-B57E-D8EF4076E20D} + {8A23C00D-767D-422D-89A3-CF225E3DAB4B} = {9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631} + {C3FAF36F-44BC-4454-87C2-C5106575FE50} = {9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631} + {2D80FA0B-2DE8-4475-BA5A-C08A9E1EDAAC} = {9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631} + {34032CF2-1B99-4A25-9050-E9C13DD4CD0A} = {9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631} + {DDC3535E-526C-44EC-9DF4-739E2D3A323B} = {9961DDAC-BE6E-4A6E-8EEF-FFC7D67BD631} + {5F915541-F531-434F-9C81-79F5DB58012B} = {99FEBA13-BDDF-4076-B57E-D8EF4076E20D} + {8E741EA2-9386-4CF2-815E-6F9B08991EAC} = {652CCE53-4997-4B43-9A99-28D075199C99} + {F396362D-821E-4EA6-9BBF-1F6050844118} = {E59CF005-539F-484F-9AA6-9F08AC2DB31E} + {E143A2AA-312E-4DFE-B61D-9A87CCBC8E90} = {E59CF005-539F-484F-9AA6-9F08AC2DB31E} + {A4760F41-2B1F-4144-B7B2-62785AFFE79B} = {E59CF005-539F-484F-9AA6-9F08AC2DB31E} + {78196985-EE54-411F-822B-5A23EDF80642} = {652CCE53-4997-4B43-9A99-28D075199C99} + {50B7D4BF-E33B-41D0-AA89-76BBA57BF5CC} = {652CCE53-4997-4B43-9A99-28D075199C99} + EndGlobalSection +EndGlobal diff --git a/README.md b/README.md index 5cdd7327..659b68ab 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenFace 2.0.5: an open source facial behavior analysis toolkit +# OpenFace 2.0.6: an open source facial behavior analysis toolkit [![Build Status](https://travis-ci.org/TadasBaltrusaitis/OpenFace.svg?branch=master)](https://travis-ci.org/TadasBaltrusaitis/OpenFace) [![Build status](https://ci.appveyor.com/api/projects/status/8msiklxfbhlnsmxp/branch/master?svg=true)](https://ci.appveyor.com/project/TadasBaltrusaitis/openface/branch/master) diff --git a/appveyor.yml b/appveyor.yml index 51f21ccb..df31985e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,10 +3,11 @@ branches: only: - develop - master - - /^feature/-.*$/ + - feature/code_cleanup max_jobs: 4 configuration: - Release +- Debug platform: - x64 - Win32 diff --git a/download_models.ps1 b/download_models.ps1 index c2e7a364..f7463f28 100644 --- a/download_models.ps1 +++ b/download_models.ps1 @@ -1,12 +1,63 @@ -$source = "https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat?dl=1" +# Download the models from the cloud (stored in Dropbox, OneDrive, and Google Drive + +# Start with 0.25 scale models $destination = "lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.25_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat?dl=1" + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat?dl=1" + Invoke-WebRequest $source -OutFile $destination +} + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153072&authkey=AKqoZtcN0PSIZH4" + Invoke-WebRequest $source -OutFile $destination +} + +# 0.35 scale models $destination = "lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.35_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat?dl=1" + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat?dl=1" + Invoke-WebRequest $source -OutFile $destination +} + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153079&authkey=ANpDR1n3ckL_0gs" + Invoke-WebRequest $source -OutFile $destination +} + + +# 0.5 scale models $destination = "lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.50_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat?dl=1" + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat?dl=1" + Invoke-WebRequest $source -OutFile $destination +} + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153074&authkey=AGi-e30AfRc_zvs" + Invoke-WebRequest $source -OutFile $destination +} + +# 1.0 scale models $destination = "lib/local/LandmarkDetector/model/patch_experts/cen_patches_1.00_of.dat" -Invoke-WebRequest $source -OutFile $destination \ No newline at end of file + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat?dl=1" + Invoke-WebRequest $source -OutFile $destination +} + +if(!([System.IO.File]::Exists($destination))) +{ + $source = "https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153070&authkey=AD6KjtYipphwBPc" + Invoke-WebRequest $source -OutFile $destination +} + diff --git a/download_models.sh b/download_models.sh index e8358688..2f4edbef 100644 --- a/download_models.sh +++ b/download_models.sh @@ -1,11 +1,27 @@ cd lib/local/LandmarkDetector/model/patch_experts -wget https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat?dl=1 -wget https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat?dl=1 -wget https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat?dl=1 -wget https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat?dl=1 -mv cen_patches_0.25_of.dat?dl=1 cen_patches_0.25_of.dat -mv cen_patches_0.35_of.dat?dl=1 cen_patches_0.35_of.dat -mv cen_patches_0.50_of.dat?dl=1 cen_patches_0.50_of.dat -mv cen_patches_1.00_of.dat?dl=1 cen_patches_1.00_of.dat -ls + +wget https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat +if [ $? -ne 0 ] +then + wget https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153072&authkey=AKqoZtcN0PSIZH4 +fi + +wget https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat +if [ $? -ne 0 ] +then + wget https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153079&authkey=ANpDR1n3ckL_0gs +fi + +wget https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat +if [ $? -ne 0 ] +then + wget https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153074&authkey=AGi-e30AfRc_zvs +fi + +wget https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat +if [ $? -ne 0 ] +then + wget https://onedrive.live.com/download?cid=2E2ADA578BFF6E6E&resid=2E2ADA578BFF6E6E%2153070&authkey=AD6KjtYipphwBPc +fi + cd ../../../../../ diff --git a/exe/FaceLandmarkImg/FaceLandmarkImg.vcxproj b/exe/FaceLandmarkImg/FaceLandmarkImg.vcxproj index b2fad9e4..e59e5312 100644 --- a/exe/FaceLandmarkImg/FaceLandmarkImg.vcxproj +++ b/exe/FaceLandmarkImg/FaceLandmarkImg.vcxproj @@ -128,7 +128,8 @@ Disabled WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + true @@ -169,7 +170,8 @@ WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) false - StreamingSIMDExtensions2 + + true Speed diff --git a/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj b/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj index 61e1f9da..33fd71d9 100644 --- a/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj +++ b/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj @@ -130,7 +130,8 @@ WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) false - StreamingSIMDExtensions2 + + true @@ -172,7 +173,8 @@ $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) false Speed - StreamingSIMDExtensions2 + + true diff --git a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj index 5ce06003..3d68ce0f 100644 --- a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj +++ b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj @@ -118,7 +118,8 @@ Level3 Disabled $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + true @@ -152,7 +153,8 @@ true $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + MultiThreadedDLL true WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) diff --git a/exe/FeatureExtraction/FeatureExtraction.vcxproj b/exe/FeatureExtraction/FeatureExtraction.vcxproj index 05dc1635..992ac525 100644 --- a/exe/FeatureExtraction/FeatureExtraction.vcxproj +++ b/exe/FeatureExtraction/FeatureExtraction.vcxproj @@ -129,7 +129,8 @@ WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) false - StreamingSIMDExtensions2 + + true @@ -172,7 +173,8 @@ $(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) false Speed - StreamingSIMDExtensions2 + + MultiThreadedDLL true diff --git a/exe/releases/download_models.ps1 b/exe/releases/download_models.ps1 deleted file mode 100644 index c6101960..00000000 --- a/exe/releases/download_models.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -$source = "https://www.dropbox.com/s/7na5qsjzz8yfoer/cen_patches_0.25_of.dat?dl=1" -$destination = "model/patch_experts/cen_patches_0.25_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/k7bj804cyiu474t/cen_patches_0.35_of.dat?dl=1" -$destination = "model/patch_experts/cen_patches_0.35_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/ixt4vkbmxgab1iu/cen_patches_0.50_of.dat?dl=1" -$destination = "model/patch_experts/cen_patches_0.50_of.dat" -Invoke-WebRequest $source -OutFile $destination -$source = "https://www.dropbox.com/s/2t5t1sdpshzfhpj/cen_patches_1.00_of.dat?dl=1" -$destination = "model/patch_experts/cen_patches_1.00_of.dat" -Invoke-WebRequest $source -OutFile $destination \ No newline at end of file diff --git a/exe/releases/package_windows_executables.m b/exe/releases/package_windows_executables.m index 35c60fd7..1af9795a 100644 --- a/exe/releases/package_windows_executables.m +++ b/exe/releases/package_windows_executables.m @@ -1,5 +1,5 @@ clear; -version = '2.0.4'; +version = '2.0.6'; out_x86 = sprintf('OpenFace_%s_win_x86', version); out_x64 = sprintf('OpenFace_%s_win_x64', version); @@ -21,9 +21,9 @@ copyfile([in_x64, 'model'], [out_x64, '/model']) copyfile('readme.txt', out_x86); -copyfile('download_models.ps1', out_x86); +copyfile('../../download_models.ps1', out_x86); copyfile('readme.txt', out_x64); -copyfile('download_models.ps1', out_x64); +copyfile('../../download_models.ps1', out_x64); %% Copy libraries libs_x86 = dir([in_x86, '*.lib'])'; diff --git a/gui/HeadPose-live/MainWindow.xaml.cs b/gui/HeadPose-live/MainWindow.xaml.cs index 2b110a34..8917feba 100644 --- a/gui/HeadPose-live/MainWindow.xaml.cs +++ b/gui/HeadPose-live/MainWindow.xaml.cs @@ -195,7 +195,7 @@ namespace HeadPoseLive InitializeComponent(); DateTime now = DateTime.Now; - + // Set the icon Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute); this.Icon = BitmapFrame.Create(iconUri); @@ -722,23 +722,25 @@ namespace HeadPoseLive PauseButton.Content = "Pause"; } } - + private void ScreenshotButton_Click(object sender, RoutedEventArgs e) { - int Top = (int)this.Top; - int Left = (int)this.Left; + PresentationSource source = PresentationSource.FromVisual(Application.Current.MainWindow); - int Width = (int)this.Width; - int Height = (int)this.Height; + var topLeft = source.CompositionTarget.TransformToDevice.Transform(new System.Windows.Point(this.Left, this.Top)); + var bottomRight = source.CompositionTarget.TransformToDevice.Transform(new System.Windows.Point(this.Left + this.Width, this.Top + this.Height)); + + int Width = (int)(bottomRight.X - topLeft.X); + int Height = (int)(bottomRight.Y - topLeft.Y); using (Bitmap bmpScreenCapture = new Bitmap(Width, Height)) { using (System.Drawing.Graphics g = Graphics.FromImage(bmpScreenCapture)) { - g.CopyFromScreen(Left, - Top, + g.CopyFromScreen((int)(topLeft.X), + (int)(topLeft.Y), 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy); diff --git a/lib/3rdParty/CameraEnumerator/CameraEnumerator.vcxproj b/lib/3rdParty/CameraEnumerator/CameraEnumerator.vcxproj index d2166a8d..899c6be7 100644 --- a/lib/3rdParty/CameraEnumerator/CameraEnumerator.vcxproj +++ b/lib/3rdParty/CameraEnumerator/CameraEnumerator.vcxproj @@ -90,7 +90,8 @@ Level3 Disabled _DEBUG;_LIB;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 + + Windows @@ -124,7 +125,8 @@ true NDEBUG;_LIB;%(PreprocessorDefinitions) Speed - StreamingSIMDExtensions2 + + Windows diff --git a/lib/local/CppInerop/CppInerop.vcxproj b/lib/local/CppInerop/CppInerop.vcxproj index 4cf8377a..8b13fa5e 100644 --- a/lib/local/CppInerop/CppInerop.vcxproj +++ b/lib/local/CppInerop/CppInerop.vcxproj @@ -128,7 +128,8 @@ Disabled _DEBUG;_WINDOWS;_USRDLL;CPPINEROP_EXPORTS;%(PreprocessorDefinitions) ./;$(SolutionDir)lib\local\LandmarkDetector\include;$(SolutionDir)lib\local\FaceAnalyser\include;$(SolutionDir)lib\local\GazeAnalyser\include;$(SolutionDir)lib\local\Utilities\include;$(SolutionDir)lib\3rdParty\CameraEnumerator;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + Windows @@ -168,7 +169,8 @@ NDEBUG;_WINDOWS;_USRDLL;CPPINEROP_EXPORTS;%(PreprocessorDefinitions) ./;$(SolutionDir)lib\local\LandmarkDetector\include;$(SolutionDir)lib\local\FaceAnalyser\include;$(SolutionDir)lib\local\GazeAnalyser\include;$(SolutionDir)lib\local\Utilities\include;$(SolutionDir)lib\3rdParty\CameraEnumerator;%(AdditionalIncludeDirectories) Speed - StreamingSIMDExtensions2 + + Windows diff --git a/lib/local/CppInerop/FaceAnalyserInterop.h b/lib/local/CppInerop/FaceAnalyserInterop.h index 78065727..8131c289 100644 --- a/lib/local/CppInerop/FaceAnalyserInterop.h +++ b/lib/local/CppInerop/FaceAnalyserInterop.h @@ -33,8 +33,8 @@ /////////////////////////////////////////////////////////////////////////////// // FaceAnalyser_Interop.h -#ifndef __FACE_ANALYSER_INTEROP_h_ -#define __FACE_ANALYSER_INTEROP_h_ +#ifndef FACE_ANALYSER_INTEROP_H +#define FACE_ANALYSER_INTEROP_H #pragma once @@ -269,32 +269,12 @@ public: // but not automatically called on explicit Dispose(). // May be called multiple times. !FaceAnalyserManaged() - { - - if (hog_features != nullptr) - { - delete hog_features; - } - - if (aligned_face != nullptr) - { - delete aligned_face; - } - - if (num_cols != nullptr) - { - delete num_cols; - } - - if (num_rows != nullptr) - { - delete num_rows; - } - - if (face_analyser != nullptr) - { - delete face_analyser; - } + { + delete hog_features; + delete aligned_face; + delete num_cols; + delete num_rows; + delete face_analyser; } // Destructor. Called on explicit Dispose() only. @@ -306,4 +286,4 @@ public: }; } -#endif \ No newline at end of file +#endif // FACE_ANALYSER_INTEROP_H \ No newline at end of file diff --git a/lib/local/CppInerop/FaceDetectorInterop.h b/lib/local/CppInerop/FaceDetectorInterop.h index e9925e2b..d703a576 100644 --- a/lib/local/CppInerop/FaceDetectorInterop.h +++ b/lib/local/CppInerop/FaceDetectorInterop.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __LANDMARK_DETECTOR_UTILS_INTEROP_h_ -#define __LANDMARK_DETECTOR_UTILS_INTEROP_h_ +#ifndef FACE_DETECTOR_INTEROP_H +#define FACE_DETECTOR_INTEROP_H #pragma once @@ -139,18 +139,9 @@ namespace FaceDetectorInterop { // May be called multiple times. !FaceDetector() { - if (face_detector_hog != nullptr) - { - delete face_detector_hog; - } - if (face_detector_mtcnn != nullptr) - { - delete face_detector_mtcnn; - } - if (face_detector_haar != nullptr) - { - delete face_detector_haar; - } + delete face_detector_hog; + delete face_detector_mtcnn; + delete face_detector_haar; } // Destructor. Called on explicit Dispose() only. @@ -163,4 +154,4 @@ namespace FaceDetectorInterop { } -#endif \ No newline at end of file +#endif // FACE_DETECTOR_INTEROP_H \ No newline at end of file diff --git a/lib/local/CppInerop/GazeAnalyserInterop.h b/lib/local/CppInerop/GazeAnalyserInterop.h index ffcd67f9..ec61505c 100644 --- a/lib/local/CppInerop/GazeAnalyserInterop.h +++ b/lib/local/CppInerop/GazeAnalyserInterop.h @@ -33,9 +33,8 @@ // /////////////////////////////////////////////////////////////////////////////// -// FaceAnalyser_Interop.h -#ifndef __GAZE_ANALYSER_INTEROP_h_ -#define __GAZE_ANALYSER_INTEROP_h_ +#ifndef GAZE_ANALYSER_INTEROP_H +#define GAZE_ANALYSER_INTEROP_H #pragma once @@ -147,7 +146,7 @@ namespace GazeAnalyser_Interop { // Perform manual projection of points vector imagePoints_left; - for (int i = 0; i < points_left.size(); ++i) + for (size_t i = 0; i < points_left.size(); ++i) { float x = points_left[i].x * fx / points_left[i].z + cx; float y = points_left[i].y * fy / points_left[i].z + cy; @@ -156,7 +155,7 @@ namespace GazeAnalyser_Interop { } vector imagePoints_right; - for (int i = 0; i < points_right.size(); ++i) + for (size_t i = 0; i < points_right.size(); ++i) { float x = points_right[i].x * fx / points_right[i].z + cx; float y = points_right[i].y * fy / points_right[i].z + cy; @@ -175,31 +174,11 @@ namespace GazeAnalyser_Interop { // May be called multiple times. !GazeAnalyserManaged() { - if (gazeDirection0 != nullptr) - { - delete gazeDirection0; - } - - if (gazeDirection1 != nullptr) - { - delete gazeDirection1; - } - - if (gazeAngle != nullptr) - { - delete gazeAngle; - } - - if (pupil_left != nullptr) - { - delete pupil_left; - } - - if (pupil_right != nullptr) - { - delete pupil_right; - } - + delete gazeDirection0; + delete gazeDirection1; + delete gazeAngle; + delete pupil_left; + delete pupil_right; } // Destructor. Called on explicit Dispose() only. @@ -211,4 +190,4 @@ namespace GazeAnalyser_Interop { }; } -#endif \ No newline at end of file +#endif // GAZE_ANALYSER_INTEROP_H \ No newline at end of file diff --git a/lib/local/CppInerop/ImageReader.h b/lib/local/CppInerop/ImageReader.h index d286675c..a99aedd4 100644 --- a/lib/local/CppInerop/ImageReader.h +++ b/lib/local/CppInerop/ImageReader.h @@ -96,7 +96,7 @@ namespace UtilitiesOF { std::vector image_files_std; - for (size_t i = 0; i < image_files->Count; ++i) + for (int i = 0; i < image_files->Count; ++i) { std::string image_file = msclr::interop::marshal_as(image_files[i]); image_files_std.push_back(image_file); @@ -175,25 +175,10 @@ namespace UtilitiesOF { // May be called multiple times. !ImageReader() { - // Automatically closes capture object before freeing memory. - if (m_image_capture != nullptr) - { - delete m_image_capture; - } - - if (m_rgb_frame != nullptr) - { - delete m_rgb_frame; - } - if (m_gray_frame != nullptr) - { - delete m_gray_frame; - } - if (m_is_opened != nullptr) - { - delete m_is_opened; - } - + delete m_image_capture; + delete m_rgb_frame; + delete m_gray_frame; + delete m_is_opened; } // Destructor. Called on explicit Dispose() only. diff --git a/lib/local/CppInerop/LandmarkDetectorInterop.h b/lib/local/CppInerop/LandmarkDetectorInterop.h index 46b5c93f..194b81e1 100644 --- a/lib/local/CppInerop/LandmarkDetectorInterop.h +++ b/lib/local/CppInerop/LandmarkDetectorInterop.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __LANDMARK_DETECTOR_INTEROP_h_ -#define __LANDMARK_DETECTOR_INTEROP_h_ +#ifndef LANDMARK_DETECTOR_INTEROP_H +#define LANDMARK_DETECTOR_INTEROP_H #pragma once @@ -450,4 +450,4 @@ namespace CppInterop { } -#endif \ No newline at end of file +#endif // LANDMARK_DETECTOR_INTEROP_H \ No newline at end of file diff --git a/lib/local/CppInerop/RecorderInterop.h b/lib/local/CppInerop/RecorderInterop.h index e7c543e8..94b2c2bd 100644 --- a/lib/local/CppInerop/RecorderInterop.h +++ b/lib/local/CppInerop/RecorderInterop.h @@ -31,8 +31,6 @@ // /////////////////////////////////////////////////////////////////////////////// -// Camera_Interop.h - #pragma once #pragma unmanaged @@ -77,12 +75,7 @@ namespace UtilitiesOF { !RecorderOpenFaceParameters() { - // Automatically closes capture object before freeing memory. - if (m_params != nullptr) - { - delete m_params; - } - + delete m_params; } // Destructor. Called on explicit Dispose() only. @@ -249,12 +242,7 @@ namespace UtilitiesOF { // May be called multiple times. !RecorderOpenFace() { - // Automatically closes capture object before freeing memory. - if (m_recorder != nullptr) - { - delete m_recorder; - } - + delete m_recorder; } // Destructor. Called on explicit Dispose() only. diff --git a/lib/local/CppInerop/SequenceReader.h b/lib/local/CppInerop/SequenceReader.h index 5f09ec93..7cc25700 100644 --- a/lib/local/CppInerop/SequenceReader.h +++ b/lib/local/CppInerop/SequenceReader.h @@ -222,21 +222,9 @@ namespace UtilitiesOF { // May be called multiple times. !SequenceReader() { - // Automatically closes capture object before freeing memory. - if (m_sequence_capture != nullptr) - { - delete m_sequence_capture; - } - - if (m_rgb_frame != nullptr) - { - delete m_rgb_frame; - } - if (m_gray_frame != nullptr) - { - delete m_gray_frame; - } - + delete m_sequence_capture; + delete m_rgb_frame; + delete m_gray_frame; } // Destructor. Called on explicit Dispose() only. diff --git a/lib/local/CppInerop/VisualizerInterop.h b/lib/local/CppInerop/VisualizerInterop.h index 85a75bf0..5b0fa8b2 100644 --- a/lib/local/CppInerop/VisualizerInterop.h +++ b/lib/local/CppInerop/VisualizerInterop.h @@ -156,11 +156,7 @@ namespace UtilitiesOF { !Visualizer() { // Automatically closes capture object before freeing memory. - if (m_visualizer != nullptr) - { - delete m_visualizer; - } - + delete m_visualizer; } // Destructor. Called on explicit Dispose() only. diff --git a/lib/local/FaceAnalyser/FaceAnalyser.vcxproj b/lib/local/FaceAnalyser/FaceAnalyser.vcxproj index cab72e82..87f344c9 100644 --- a/lib/local/FaceAnalyser/FaceAnalyser.vcxproj +++ b/lib/local/FaceAnalyser/FaceAnalyser.vcxproj @@ -118,7 +118,8 @@ Disabled false ./include;$(SolutionDir)lib/local/Utilities/include;$(SolutionDir)lib/local/LandmarkDetector/include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + true WIN64;_DEBUG;_LIB;EIGEN_MPL2_ONLY;%(PreprocessorDefinitions) @@ -167,7 +168,8 @@ ./include;$(SolutionDir)lib/local/Utilities/include;$(SolutionDir)lib/local/LandmarkDetector/include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + true WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) Speed diff --git a/lib/local/FaceAnalyser/include/FaceAnalyser.h b/lib/local/FaceAnalyser/include/FaceAnalyser.h index ccce501c..5e5c6844 100644 --- a/lib/local/FaceAnalyser/include/FaceAnalyser.h +++ b/lib/local/FaceAnalyser/include/FaceAnalyser.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __FACEANALYSER_h_ -#define __FACEANALYSER_h_ +#ifndef FACEANALYSER_H +#define FACEANALYSER_H // STL includes #include @@ -242,4 +242,4 @@ private: }; //=========================================================================== } -#endif +#endif // FACEANALYSER_H diff --git a/lib/local/FaceAnalyser/include/FaceAnalyserParameters.h b/lib/local/FaceAnalyser/include/FaceAnalyserParameters.h index bc7b4125..4bc4f1ff 100644 --- a/lib/local/FaceAnalyser/include/FaceAnalyserParameters.h +++ b/lib/local/FaceAnalyser/include/FaceAnalyserParameters.h @@ -33,8 +33,8 @@ /////////////////////////////////////////////////////////////////////////////// // Parameters of the Face analyser -#ifndef __FACE_ANALYSER_PARAM_H -#define __FACE_ANALYSER_PARAM_H +#ifndef FACE_ANALYSER_PARAM_H +#define FACE_ANALYSER_PARAM_H #include #include @@ -101,4 +101,4 @@ private: } -#endif // __FACE_ANALYSER_PARAM_H +#endif // FACE_ANALYSER_PARAM_H diff --git a/lib/local/FaceAnalyser/include/Face_utils.h b/lib/local/FaceAnalyser/include/Face_utils.h index d9e2801d..6922acf4 100644 --- a/lib/local/FaceAnalyser/include/Face_utils.h +++ b/lib/local/FaceAnalyser/include/Face_utils.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __FACE_UTILS_h_ -#define __FACE_UTILS_h_ +#ifndef FACE_UTILS_H +#define FACE_UTILS_H #include #include @@ -55,17 +55,6 @@ namespace FaceAnalysis // The following two methods go hand in hand void ExtractSummaryStatistics(const cv::Mat_& descriptors, cv::Mat_& sum_stats, bool mean, bool stdev, bool max_min); void AddDescriptor(cv::Mat_& descriptors, cv::Mat_ new_descriptor, int curr_frame, int num_frames_to_keep = 120); - - //=========================================================================== - // Point set and landmark manipulation functions - //=========================================================================== - // Using Kabsch's algorithm for aligning shapes - //This assumes that align_from and align_to are already mean normalised - cv::Matx22f AlignShapesKabsch2D(const cv::Mat_& align_from, const cv::Mat_& align_to); - - //============================================================================= - // Basically Kabsch's algorithm but also allows the collection of points to be different in scale from each other - cv::Matx22f AlignShapesWithScale(cv::Mat_& src, cv::Mat_ dst); //============================================================================ // Matrix reading functionality @@ -81,4 +70,4 @@ namespace FaceAnalysis void SkipComments(std::ifstream& stream); } -#endif +#endif // FACE_UTILS_H diff --git a/lib/local/FaceAnalyser/include/SVM_dynamic_lin.h b/lib/local/FaceAnalyser/include/SVM_dynamic_lin.h index 6f72cb38..1d8f6861 100644 --- a/lib/local/FaceAnalyser/include/SVM_dynamic_lin.h +++ b/lib/local/FaceAnalyser/include/SVM_dynamic_lin.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __SVMDYNAMICLIN_h_ -#define __SVMDYNAMICLIN_h_ +#ifndef SVM_DYNAMIC_LIN_H +#define SVM_DYNAMIC_LIN_H #include #include @@ -84,4 +84,4 @@ private: }; //=========================================================================== } -#endif +#endif // SVM_DYNAMIC_LIN_H diff --git a/lib/local/FaceAnalyser/include/SVM_static_lin.h b/lib/local/FaceAnalyser/include/SVM_static_lin.h index 0c0ed125..8151e082 100644 --- a/lib/local/FaceAnalyser/include/SVM_static_lin.h +++ b/lib/local/FaceAnalyser/include/SVM_static_lin.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __SVMSTATICLIN_h_ -#define __SVMSTATICLIN_h_ +#ifndef SVM_STATIC_LIN_H +#define SVM_STATIC_LIN_H #include #include @@ -84,4 +84,4 @@ private: }; //=========================================================================== } -#endif +#endif // SVM_STATIC_LIN_H diff --git a/lib/local/FaceAnalyser/include/SVR_dynamic_lin_regressors.h b/lib/local/FaceAnalyser/include/SVR_dynamic_lin_regressors.h index 7dca00f9..8d20f75b 100644 --- a/lib/local/FaceAnalyser/include/SVR_dynamic_lin_regressors.h +++ b/lib/local/FaceAnalyser/include/SVR_dynamic_lin_regressors.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __SVRDYNAMICLINREGRESSORS_h_ -#define __SVRDYNAMICLINREGRESSORS_h_ +#ifndef SVR_DYNAMIC_LIN_REGRESSORS_H +#define SVR_DYNAMIC_LIN_REGRESSORS_H #include #include @@ -89,4 +89,4 @@ private: }; //=========================================================================== } -#endif +#endif // SVR_DYNAMIC_LIN_REGRESSORS_H diff --git a/lib/local/FaceAnalyser/include/SVR_static_lin_regressors.h b/lib/local/FaceAnalyser/include/SVR_static_lin_regressors.h index da53b6c7..cdde0490 100644 --- a/lib/local/FaceAnalyser/include/SVR_static_lin_regressors.h +++ b/lib/local/FaceAnalyser/include/SVR_static_lin_regressors.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __SVRSTATICLINREGRESSORS_h_ -#define __SVRSTATICLINREGRESSORS_h_ +#ifndef SVR_STATIC_LIN_REGRESSORS_H +#define SVR_STATIC_LIN_REGRESSORS_H #include #include @@ -81,4 +81,4 @@ private: }; //=========================================================================== } -#endif +#endif // SVR_STATIC_LIN_REGRESSORS_H diff --git a/lib/local/FaceAnalyser/src/FaceAnalyser.cpp b/lib/local/FaceAnalyser/src/FaceAnalyser.cpp index 2cd97fa9..8fa93d9b 100644 --- a/lib/local/FaceAnalyser/src/FaceAnalyser.cpp +++ b/lib/local/FaceAnalyser/src/FaceAnalyser.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -370,7 +370,7 @@ void FaceAnalyser::AddNextFrame(const cv::Mat& frame, const cv::Mat_& det if (aligned_face_for_output.channels() == 3 && out_grayscale) { - cvtColor(aligned_face_for_output, aligned_face_for_output, CV_BGR2GRAY); + cvtColor(aligned_face_for_output, aligned_face_for_output, cv::COLOR_BGR2GRAY); } // Extract HOG descriptor from the frame and convert it to a useable format @@ -703,7 +703,7 @@ void FaceAnalyser::ExtractAllPredictionsOfflineClass(vector au_vals_tmp = au_vals; - if(au_vals.size() > (window_size - 1) / 2) + if((int)au_vals.size() > (window_size - 1) / 2) { for (size_t i = (window_size - 1)/2; i < au_vals.size() - (window_size - 1) / 2; ++i) { diff --git a/lib/local/FaceAnalyser/src/Face_utils.cpp b/lib/local/FaceAnalyser/src/Face_utils.cpp index 00d899db..9a924d0e 100644 --- a/lib/local/FaceAnalyser/src/Face_utils.cpp +++ b/lib/local/FaceAnalyser/src/Face_utils.cpp @@ -34,6 +34,8 @@ #include +#include + // OpenCV includes #include #include @@ -131,7 +133,7 @@ namespace FaceAnalysis extract_rigid_points(source_landmarks, destination_landmarks); } - cv::Matx22f scale_rot_matrix = AlignShapesWithScale(source_landmarks, destination_landmarks); + cv::Matx22f scale_rot_matrix = Utilities::AlignShapesWithScale(source_landmarks, destination_landmarks); cv::Matx23f warp_matrix; warp_matrix(0,0) = scale_rot_matrix(0,0); @@ -170,7 +172,7 @@ namespace FaceAnalysis extract_rigid_points(source_landmarks, destination_landmarks); } - cv::Matx22f scale_rot_matrix = AlignShapesWithScale(source_landmarks, destination_landmarks); + cv::Matx22f scale_rot_matrix = Utilities::AlignShapesWithScale(source_landmarks, destination_landmarks); cv::Matx23f warp_matrix; warp_matrix(0,0) = scale_rot_matrix(0,0); @@ -333,88 +335,6 @@ namespace FaceAnalysis new_descriptor.copyTo(descriptors.row(row_to_change)); } - //=========================================================================== - // Point set and landmark manipulation functions - //=========================================================================== - // Using Kabsch's algorithm for aligning shapes - //This assumes that align_from and align_to are already mean normalised - cv::Matx22f AlignShapesKabsch2D(const cv::Mat_& align_from, const cv::Mat_& align_to) - { - - cv::SVD svd(align_from.t() * align_to); - - // make sure no reflection is there - // corr ensures that we do only rotaitons and not reflections - float d = cv::determinant(svd.vt.t() * svd.u.t()); - - cv::Matx22f corr = cv::Matx22f::eye(); - if (d > 0) - { - corr(1, 1) = 1; - } - else - { - corr(1, 1) = -1; - } - - cv::Matx22f R; - cv::Mat(svd.vt.t()*cv::Mat(corr)*svd.u.t()).copyTo(R); - - return R; - } - - //============================================================================= - // Basically Kabsch's algorithm but also allows the collection of points to be different in scale from each other - cv::Matx22f AlignShapesWithScale(cv::Mat_& src, cv::Mat_ dst) - { - int n = src.rows; - - // First we mean normalise both src and dst - float mean_src_x = cv::mean(src.col(0))[0]; - float mean_src_y = cv::mean(src.col(1))[0]; - - float mean_dst_x = cv::mean(dst.col(0))[0]; - float mean_dst_y = cv::mean(dst.col(1))[0]; - - cv::Mat_ src_mean_normed = src.clone(); - src_mean_normed.col(0) = src_mean_normed.col(0) - mean_src_x; - src_mean_normed.col(1) = src_mean_normed.col(1) - mean_src_y; - - cv::Mat_ dst_mean_normed = dst.clone(); - dst_mean_normed.col(0) = dst_mean_normed.col(0) - mean_dst_x; - dst_mean_normed.col(1) = dst_mean_normed.col(1) - mean_dst_y; - - // Find the scaling factor of each - cv::Mat src_sq; - cv::pow(src_mean_normed, 2, src_sq); - - cv::Mat dst_sq; - cv::pow(dst_mean_normed, 2, dst_sq); - - float s_src = sqrt(cv::sum(src_sq)[0] / n); - float s_dst = sqrt(cv::sum(dst_sq)[0] / n); - - src_mean_normed = src_mean_normed / s_src; - dst_mean_normed = dst_mean_normed / s_dst; - - float s = s_dst / s_src; - - // Get the rotation - cv::Matx22f R = AlignShapesKabsch2D(src_mean_normed, dst_mean_normed); - - cv::Matx22f A; - cv::Mat(s * R).copyTo(A); - - cv::Mat_ aligned = (cv::Mat(cv::Mat(A) * src.t())).t(); - cv::Mat_ offset = dst - aligned; - - float t_x = cv::mean(offset.col(0))[0]; - float t_y = cv::mean(offset.col(1))[0]; - - return A; - - } - //============================================================================ // Matrix reading functionality //============================================================================ diff --git a/lib/local/GazeAnalyser/GazeAnalyser.vcxproj b/lib/local/GazeAnalyser/GazeAnalyser.vcxproj index affec1d4..9a964dfd 100644 --- a/lib/local/GazeAnalyser/GazeAnalyser.vcxproj +++ b/lib/local/GazeAnalyser/GazeAnalyser.vcxproj @@ -106,7 +106,8 @@ true ./include;../LandmarkDetector/include;../Utilities/include;%(AdditionalIncludeDirectories) WIN64;_DEBUG;_LIB;EIGEN_MPL2_ONLY;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 + + @@ -139,7 +140,8 @@ ./include;../LandmarkDetector/include;../Utilities/include;%(AdditionalIncludeDirectories) true WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 + + Speed diff --git a/lib/local/GazeAnalyser/include/GazeEstimation.h b/lib/local/GazeAnalyser/include/GazeEstimation.h index 9359614e..44a654f9 100644 --- a/lib/local/GazeAnalyser/include/GazeEstimation.h +++ b/lib/local/GazeAnalyser/include/GazeEstimation.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __GAZEESTIMATION_h_ -#define __GAZEESTIMATION_h_ +#ifndef GAZE_ESTIMATION_H +#define GAZE_ESTIMATION_H #include "LandmarkDetectorModel.h" @@ -51,4 +51,4 @@ namespace GazeAnalysis cv::Point3f GetPupilPosition(cv::Mat_ eyeLdmks3d); } -#endif \ No newline at end of file +#endif // GAZE_ESTIMATION_H \ No newline at end of file diff --git a/lib/local/LandmarkDetector/LandmarkDetector.vcxproj b/lib/local/LandmarkDetector/LandmarkDetector.vcxproj index 84ccbb5f..cf50f08b 100644 --- a/lib/local/LandmarkDetector/LandmarkDetector.vcxproj +++ b/lib/local/LandmarkDetector/LandmarkDetector.vcxproj @@ -124,7 +124,8 @@ xcopy /I /E /Y /D "$(SolutionDir)lib\3rdParty\OpenCV3.4\classifiers" "$(OutDir)c NotUsing Level3 ProgramDatabase - StreamingSIMDExtensions2 + + false /Zm300 %(AdditionalOptions) true @@ -173,7 +174,8 @@ xcopy /I /E /Y /D "$(SolutionDir)lib\3rdParty\OpenCV3.4\classifiers" "$(OutDir)c Use Level3 ProgramDatabase - StreamingSIMDExtensions2 + + Speed false /Zm300 %(AdditionalOptions) diff --git a/lib/local/LandmarkDetector/include/CCNF_patch_expert.h b/lib/local/LandmarkDetector/include/CCNF_patch_expert.h index 7aeab443..0a150f1d 100644 --- a/lib/local/LandmarkDetector/include/CCNF_patch_expert.h +++ b/lib/local/LandmarkDetector/include/CCNF_patch_expert.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __CCNF_PATCH_EXPERT_h_ -#define __CCNF_PATCH_EXPERT_h_ +#ifndef CCNF_PATCH_EXPERT_H +#define CCNF_PATCH_EXPERT_H #include @@ -126,4 +126,4 @@ public: }; //=========================================================================== } -#endif +#endif // CCNF_PATCH_EXPERT_H diff --git a/lib/local/LandmarkDetector/include/CEN_patch_expert.h b/lib/local/LandmarkDetector/include/CEN_patch_expert.h index c7077395..74b33849 100644 --- a/lib/local/LandmarkDetector/include/CEN_patch_expert.h +++ b/lib/local/LandmarkDetector/include/CEN_patch_expert.h @@ -33,8 +33,8 @@ /////////////////////////////////////////////////////////////////////////////// -#ifndef __CEN_PATCH_EXPERT_h_ -#define __CEN_PATCH_EXPERT_h_ +#ifndef CEN_PATCH_EXPERT_H +#define CEN_PATCH_EXPERT_H // system includes #include @@ -88,4 +88,4 @@ namespace LandmarkDetector void interpolationMatrix(cv::Mat_& mapMatrix, int response_height, int response_width, int input_width, int input_height); } -#endif +#endif // CEN_PATCH_EXPERT_H diff --git a/lib/local/LandmarkDetector/include/CNN_utils.h b/lib/local/LandmarkDetector/include/CNN_utils.h index b11f7729..e01429ed 100644 --- a/lib/local/LandmarkDetector/include/CNN_utils.h +++ b/lib/local/LandmarkDetector/include/CNN_utils.h @@ -31,9 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -// Header for all external CLNF/CLM-Z/CLM methods of interest to the user -#ifndef __CNN_UTILS_h_ -#define __CNN_UTILS_h_ +#ifndef CNN_UTILS_H +#define CNN_UTILS_H // OpenCV includes #include @@ -60,4 +59,4 @@ namespace LandmarkDetector // Convolution using matrix multiplication and OpenBLAS optimization, can also provide a pre-allocated im2col result for faster processing void convolution_direct_blas(std::vector >& outputs, const std::vector >& input_maps, const cv::Mat_& weight_matrix, int height_k, int width_k, cv::Mat_& pre_alloc_im2col); } -#endif +#endif // CNN_UTILS_H diff --git a/lib/local/LandmarkDetector/include/FaceDetectorMTCNN.h b/lib/local/LandmarkDetector/include/FaceDetectorMTCNN.h index 0f317733..d1a5688b 100644 --- a/lib/local/LandmarkDetector/include/FaceDetectorMTCNN.h +++ b/lib/local/LandmarkDetector/include/FaceDetectorMTCNN.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __FACE_DETECTOR_MTCNN_h_ -#define __FACE_DETECTOR_MTCNN_h_ +#ifndef FACE_DETECTOR_MTCNN_H +#define FACE_DETECTOR_MTCNN_H // OpenCV includes #include @@ -132,4 +132,4 @@ namespace LandmarkDetector }; } -#endif +#endif // FACE_DETECTOR_MTCNN_H diff --git a/lib/local/LandmarkDetector/include/LandmarkCoreIncludes.h b/lib/local/LandmarkDetector/include/LandmarkCoreIncludes.h index 709c326c..6dedfa43 100644 --- a/lib/local/LandmarkDetector/include/LandmarkCoreIncludes.h +++ b/lib/local/LandmarkDetector/include/LandmarkCoreIncludes.h @@ -33,12 +33,12 @@ /////////////////////////////////////////////////////////////////////////////// -#ifndef __LANDMARK_CORE_INCLUDES_h_ -#define __LANDMARK_CORE_INCLUDES_h_ +#ifndef LANDMARK_CORE_INCLUDES_H +#define LANDMARK_CORE_INCLUDES_H #include "LandmarkDetectorModel.h" #include "LandmarkDetectorFunc.h" #include "LandmarkDetectorParameters.h" #include "LandmarkDetectorUtils.h" -#endif \ No newline at end of file +#endif // LANDMARK_CORE_INCLUDES_H \ No newline at end of file diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectionValidator.h b/lib/local/LandmarkDetector/include/LandmarkDetectionValidator.h index a398aeb3..e3ff7cfe 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectionValidator.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectionValidator.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __LANDMARK_DETECTION_VALIDATOR_h_ -#define __LANDMARK_DETECTION_VALIDATOR_h_ +#ifndef LANDMARK_DETECTION_VALIDATOR_H +#define LANDMARK_DETECTION_VALIDATOR_H // OpenCV includes #include @@ -114,4 +114,4 @@ private: }; } -#endif +#endif // LANDMARK_DETECTION_VALIDATOR_H diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectorFunc.h b/lib/local/LandmarkDetector/include/LandmarkDetectorFunc.h index deda80a5..5478b248 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectorFunc.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectorFunc.h @@ -32,11 +32,11 @@ // /////////////////////////////////////////////////////////////////////////////// -// Header for all external CLM/CLNF/CLM-Z methods of interest to the user +// Header for all external CLM/CLNF/CE-CLM methods of interest to the user // // -#ifndef __LANDMARK_DETECTOR_FUNC_h_ -#define __LANDMARK_DETECTOR_FUNC_h_ +#ifndef LANDMARK_DETECTOR_FUNC_H +#define LANDMARK_DETECTOR_FUNC_H // OpenCV includes #include @@ -78,4 +78,4 @@ namespace LandmarkDetector // The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z] cv::Vec6f GetPoseWRTCamera(const CLNF& clnf_model, float fx, float fy, float cx, float cy); } -#endif +#endif // LANDMARK_DETECTOR_FUNC_H diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h b/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h index bdea28dc..0b2d83e5 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __LANDMARK_DETECTOR_MODEL_h_ -#define __LANDMARK_DETECTOR_MODEL_h_ +#ifndef LANDMARK_DETECTOR_MODEL_H +#define LANDMARK_DETECTOR_MODEL_H // OpenCV dependencies #include @@ -209,4 +209,4 @@ private: }; //=========================================================================== } -#endif +#endif // LANDMARK_DETECTOR_MODEL_H diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectorParameters.h b/lib/local/LandmarkDetector/include/LandmarkDetectorParameters.h index 1f8e0cbf..4ed5b24b 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectorParameters.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectorParameters.h @@ -32,9 +32,9 @@ // /////////////////////////////////////////////////////////////////////////////// -// Parameters of the CLNF, CLM-Z and CLM trackers -#ifndef __LANDMARK_DETECTOR_PARAM_H -#define __LANDMARK_DETECTOR_PARAM_H +// Parameters of the CE-CLM, CLNF, and CLM trackers +#ifndef LANDMARK_DETECTOR_PARAM_H +#define LANDMARK_DETECTOR_PARAM_H #include @@ -120,4 +120,4 @@ struct FaceModelParameters } -#endif // __LANDMARK_DETECTOR_PARAM_H +#endif // LANDMARK_DETECTOR_PARAM_H diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectorUtils.h b/lib/local/LandmarkDetector/include/LandmarkDetectorUtils.h index 54260141..f578d98e 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectorUtils.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectorUtils.h @@ -32,9 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -// Header for all external CLNF/CLM-Z/CLM methods of interest to the user -#ifndef __LANDMARK_DETECTOR_UTILS_h_ -#define __LANDMARK_DETECTOR_UTILS_h_ +#ifndef LANDMARK_DETECTOR_UTILS_H +#define LANDMARK_DETECTOR_UTILS_H // OpenCV includes #include @@ -58,19 +57,6 @@ namespace LandmarkDetector // templ is the template we are convolving with, templ_dfts it's dfts at varying windows sizes (optional), _result - the output, method the type of convolution void matchTemplate_m(const cv::Mat_& input_img, cv::Mat_& img_dft, cv::Mat& _integral_img, cv::Mat& _integral_img_sq, const cv::Mat_& templ, map >& templ_dfts, cv::Mat_& result, int method); - //=========================================================================== - // Point set and landmark manipulation functions - //=========================================================================== - // Using Kabsch's algorithm for aligning shapes - //This assumes that align_from and align_to are already mean normalised - cv::Matx22d AlignShapesKabsch2D(const cv::Mat_& align_from, const cv::Mat_& align_to); - cv::Matx22f AlignShapesKabsch2D_f(const cv::Mat_& align_from, const cv::Mat_& align_to); - - //============================================================================= - // Basically Kabsch's algorithm but also allows the collection of points to be different in scale from each other - cv::Matx22d AlignShapesWithScale(cv::Mat_& src, cv::Mat_ dst); - cv::Matx22f AlignShapesWithScale_f(cv::Mat_& src, cv::Mat_ dst); - // Useful utility for grabing a bounding box around a set of 2D landmarks (as a 1D 2n x 1 vector of xs followed by doubles or as an n x 2 vector) void ExtractBoundingBox(const cv::Mat_& landmarks, float &min_x, float &max_x, float &min_y, float &max_y); @@ -119,4 +105,4 @@ namespace LandmarkDetector } -#endif +#endif // LANDMARK_DETECTOR_UTILS_H diff --git a/lib/local/LandmarkDetector/include/PAW.h b/lib/local/LandmarkDetector/include/PAW.h index 8ed2142b..e4b24f81 100644 --- a/lib/local/LandmarkDetector/include/PAW.h +++ b/lib/local/LandmarkDetector/include/PAW.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __PAW_h_ -#define __PAW_h_ +#ifndef PAW_H +#define PAW_H // OpenCV includes #include @@ -135,4 +135,4 @@ namespace LandmarkDetector }; //=========================================================================== } -#endif +#endif // PAW_H diff --git a/lib/local/LandmarkDetector/include/PDM.h b/lib/local/LandmarkDetector/include/PDM.h index 6040b22b..3124d69a 100644 --- a/lib/local/LandmarkDetector/include/PDM.h +++ b/lib/local/LandmarkDetector/include/PDM.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __PDM_h_ -#define __PDM_h_ +#ifndef PDM_H +#define PDM_H // OpenCV includes #include @@ -102,4 +102,4 @@ class PDM{ }; //=========================================================================== } -#endif +#endif // PDM_H diff --git a/lib/local/LandmarkDetector/include/Patch_experts.h b/lib/local/LandmarkDetector/include/Patch_experts.h index bdae524d..4cef7dbe 100644 --- a/lib/local/LandmarkDetector/include/Patch_experts.h +++ b/lib/local/LandmarkDetector/include/Patch_experts.h @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __Patch_experts_h_ -#define __Patch_experts_h_ +#ifndef PATCH_EXPERTS_H +#define PATCH_EXPERTS_H // OpenCV includes #include @@ -121,4 +121,4 @@ private: }; } -#endif +#endif // PATCH_EXPERTS_H diff --git a/lib/local/LandmarkDetector/include/SVR_patch_expert.h b/lib/local/LandmarkDetector/include/SVR_patch_expert.h index 5deef538..d78992cd 100644 --- a/lib/local/LandmarkDetector/include/SVR_patch_expert.h +++ b/lib/local/LandmarkDetector/include/SVR_patch_expert.h @@ -33,8 +33,8 @@ /////////////////////////////////////////////////////////////////////////////// -#ifndef __SVR_PATCH_EXPERT_h_ -#define __SVR_PATCH_EXPERT_h_ +#ifndef SVR_PATCH_EXPERT_H +#define SVR_PATCH_EXPERT_H // system includes #include @@ -111,4 +111,4 @@ class Multi_SVR_patch_expert{ }; } -#endif +#endif // SVR_PATCH_EXPERT_H diff --git a/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp b/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp index bff3aa73..e332bf1b 100644 --- a/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp +++ b/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -264,11 +264,11 @@ void CCNF_neuron::Response(const cv::Mat_ &im, cv::Mat_ &im_dft, if(neuron_type == 3) { // In case of depth we use per area, rather than per patch normalisation - matchTemplate_m(I, im_dft, integral_img, integral_img_sq, weights, weights_dfts, resp, CV_TM_CCOEFF); // the linear multiplication, efficient calc of response + matchTemplate_m(I, im_dft, integral_img, integral_img_sq, weights, weights_dfts, resp, cv::TM_CCOEFF); // the linear multiplication, efficient calc of response } else { - matchTemplate_m(I, im_dft, integral_img, integral_img_sq, weights, weights_dfts, resp, CV_TM_CCOEFF_NORMED); // the linear multiplication, efficient calc of response + matchTemplate_m(I, im_dft, integral_img, integral_img_sq, weights, weights_dfts, resp, cv::TM_CCOEFF_NORMED); // the linear multiplication, efficient calc of response } cv::MatIterator_ p = resp.begin(); diff --git a/lib/local/LandmarkDetector/src/CNN_utils.cpp b/lib/local/LandmarkDetector/src/CNN_utils.cpp index 576d5910..6c380897 100644 --- a/lib/local/LandmarkDetector/src/CNN_utils.cpp +++ b/lib/local/LandmarkDetector/src/CNN_utils.cpp @@ -77,7 +77,7 @@ namespace LandmarkDetector auto iter = input_output_maps[0].row(k).begin(); float neg_mult = prelu_weights.at(k); - for (size_t i = 0; i < w; ++i) + for (int i = 0; i < w; ++i) { float in_val = *iter; // Apply the PReLU @@ -105,7 +105,7 @@ namespace LandmarkDetector cv::Size orig_size = input_maps[0].size(); cv::Mat_ input_concat((int)input_maps.size(), input_maps[0].cols * input_maps[0].rows); - for (int in = 0; in < input_maps.size(); ++in) + for (int in = 0; in < (int)input_maps.size(); ++in) { cv::Mat_ add = input_maps[in]; diff --git a/lib/local/LandmarkDetector/src/FaceDetectorMTCNN.cpp b/lib/local/LandmarkDetector/src/FaceDetectorMTCNN.cpp index 89ea3b56..886d5a88 100644 --- a/lib/local/LandmarkDetector/src/FaceDetectorMTCNN.cpp +++ b/lib/local/LandmarkDetector/src/FaceDetectorMTCNN.cpp @@ -354,9 +354,9 @@ void CNN::Read(const string& location) // Rearrange the flattened kernels into weight matrices for direct convolution computation cv::Mat_ weight_matrix(num_in_maps * kernels_rearr[0][0].rows * kernels_rearr[0][0].cols, num_kernels); - for (size_t k = 0; k < num_kernels; ++k) + for (int k = 0; k < num_kernels; ++k) { - for (size_t i = 0; i < num_in_maps; ++i) + for (int i = 0; i < num_in_maps; ++i) { // Flatten the kernel cv::Mat_ k_flat = kernels_rearr[k][i].t(); @@ -370,7 +370,7 @@ void CNN::Read(const string& location) // Add a bias term to the weight matrix for efficiency cv::Mat_ W(weight_matrix.rows, weight_matrix.cols + 1, 1.0); - for (size_t k = 0; k < weight_matrix.rows; ++k) + for (int k = 0; k < weight_matrix.rows; ++k) { W.at(k, weight_matrix.cols) = biases[k]; } diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectionValidator.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectionValidator.cpp index 2f745ecc..13f2e6f0 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectionValidator.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectionValidator.cpp @@ -263,9 +263,9 @@ void DetectionValidator::Read(string location) // Rearrange the flattened kernels into weight matrices for direct convolution computation cv::Mat_ weight_matrix(num_in_maps * kernels_rearr[0][0].rows * kernels_rearr[0][0].cols, num_kernels); - for (size_t k = 0; k < num_kernels; ++k) + for (int k = 0; k < num_kernels; ++k) { - for (size_t i = 0; i < num_in_maps; ++i) + for (int i = 0; i < num_in_maps; ++i) { // Flatten the kernel cv::Mat_ k_flat = kernels_rearr[k][i].t(); @@ -279,7 +279,7 @@ void DetectionValidator::Read(string location) // Add a bias term to the weight matrix for efficiency cv::Mat_ W(weight_matrix.rows, weight_matrix.cols + 1, 1.0); - for (size_t k = 0; k < weight_matrix.rows; ++k) + for (int k = 0; k < weight_matrix.rows; ++k) { W.at(k, weight_matrix.cols) = biases[k]; } diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorFunc.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorFunc.cpp index f0a9e776..281fd735 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorFunc.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorFunc.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -194,7 +194,7 @@ void CorrectGlobalParametersVideo(const cv::Mat_ &grayscale_image, CLNF& // Resizing the template cv::Mat corr_out; - cv::matchTemplate(image, clnf_model.face_template, corr_out, CV_TM_CCOEFF_NORMED); + cv::matchTemplate(image, clnf_model.face_template, corr_out, cv::TM_CCOEFF_NORMED); // Actually matching it //double min, max; @@ -520,7 +520,7 @@ bool DetectLandmarksInImageMultiHypEarlyTerm(const cv::Mat_ &grayscale_im // Setup the parameters accordingly // Only do the first iteration - for (int i = 1; i < params.window_sizes_current.size(); ++i) + for (size_t i = 1; i < params.window_sizes_current.size(); ++i) { params.window_sizes_current[i] = 0; } diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp index 9861af99..136fd591 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp @@ -1128,7 +1128,7 @@ float CLNF::NU_RLMS(cv::Vec6f& final_global, cv::Mat_& final_local, const // Solve for the parameter update (from Baltrusaitis 2013 based on eq (36) Saragih 2011) cv::Mat_ param_update; - cv::solve(Hessian, J_w_t_m, param_update, CV_CHOLESKY); + cv::solve(Hessian, J_w_t_m, param_update, cv::DECOMP_CHOLESKY); // update the reference pdm.UpdateModelParameters(param_update, current_local, current_global); diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp index 71cdafd0..887c6e53 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -150,11 +150,11 @@ namespace LandmarkDetector void matchTemplate_m(const cv::Mat_& input_img, cv::Mat_& img_dft, cv::Mat& _integral_img, cv::Mat& _integral_img_sq, const cv::Mat_& templ, map >& templ_dfts, cv::Mat_& result, int method) { - int numType = method == CV_TM_CCORR || method == CV_TM_CCORR_NORMED ? 0 : - method == CV_TM_CCOEFF || method == CV_TM_CCOEFF_NORMED ? 1 : 2; - bool isNormed = method == CV_TM_CCORR_NORMED || - method == CV_TM_SQDIFF_NORMED || - method == CV_TM_CCOEFF_NORMED; + int numType = method == cv::TM_CCORR || method == cv::TM_CCORR_NORMED ? 0 : + method == cv::TM_CCOEFF || method == cv::TM_CCOEFF_NORMED ? 1 : 2; + bool isNormed = method == cv::TM_CCORR_NORMED || + method == cv::TM_SQDIFF_NORMED || + method == cv::TM_CCOEFF_NORMED; // Assume result is defined properly if (result.empty()) @@ -164,7 +164,7 @@ namespace LandmarkDetector } LandmarkDetector::crossCorr_m(input_img, img_dft, templ, templ_dfts, result); - if (method == CV_TM_CCORR) + if (method == cv::TM_CCORR) return; double invArea = 1. / ((double)templ.rows * templ.cols); @@ -174,7 +174,7 @@ namespace LandmarkDetector double *q0 = 0, *q1 = 0, *q2 = 0, *q3 = 0; double templNorm = 0, templSum2 = 0; - if (method == CV_TM_CCOEFF) + if (method == cv::TM_CCOEFF) { // If it has not been precomputed compute it now if (_integral_img.empty()) @@ -200,7 +200,7 @@ namespace LandmarkDetector templNorm = templSdv[0] * templSdv[0] + templSdv[1] * templSdv[1] + templSdv[2] * templSdv[2] + templSdv[3] * templSdv[3]; - if (templNorm < DBL_EPSILON && method == CV_TM_CCOEFF_NORMED) + if (templNorm < DBL_EPSILON && method == cv::TM_CCOEFF_NORMED) { result.setTo(1.0); return; @@ -276,7 +276,7 @@ namespace LandmarkDetector else if (fabs(num) < t*1.125) num = num > 0 ? 1 : -1; else - num = method != CV_TM_SQDIFF_NORMED ? 0 : 1; + num = method != cv::TM_SQDIFF_NORMED ? 0 : 1; } rrow[j] = (float)num; @@ -284,163 +284,6 @@ namespace LandmarkDetector } } - - //=========================================================================== - // Point set and landmark manipulation functions - //=========================================================================== - // Using Kabsch's algorithm for aligning shapes - //This assumes that align_from and align_to are already mean normalised - cv::Matx22d AlignShapesKabsch2D(const cv::Mat_& align_from, const cv::Mat_& align_to) - { - - cv::SVD svd(align_from.t() * align_to); - - // make sure no reflection is there - // corr ensures that we do only rotaitons and not reflections - double d = cv::determinant(svd.vt.t() * svd.u.t()); - - cv::Matx22d corr = cv::Matx22d::eye(); - if (d > 0) - { - corr(1, 1) = 1; - } - else - { - corr(1, 1) = -1; - } - - cv::Matx22d R; - cv::Mat(svd.vt.t()*cv::Mat(corr)*svd.u.t()).copyTo(R); - - return R; - } - - cv::Matx22f AlignShapesKabsch2D_f(const cv::Mat_& align_from, const cv::Mat_& align_to) - { - - cv::SVD svd(align_from.t() * align_to); - - // make sure no reflection is there - // corr ensures that we do only rotaitons and not reflections - float d = cv::determinant(svd.vt.t() * svd.u.t()); - - cv::Matx22f corr = cv::Matx22f::eye(); - if (d > 0) - { - corr(1, 1) = 1; - } - else - { - corr(1, 1) = -1; - } - - cv::Matx22f R; - cv::Mat(svd.vt.t()*cv::Mat(corr)*svd.u.t()).copyTo(R); - - return R; - } - - //============================================================================= - // Basically Kabsch's algorithm but also allows the collection of points to be different in scale from each other - cv::Matx22d AlignShapesWithScale(cv::Mat_& src, cv::Mat_ dst) - { - int n = src.rows; - - // First we mean normalise both src and dst - double mean_src_x = cv::mean(src.col(0))[0]; - double mean_src_y = cv::mean(src.col(1))[0]; - - double mean_dst_x = cv::mean(dst.col(0))[0]; - double mean_dst_y = cv::mean(dst.col(1))[0]; - - cv::Mat_ src_mean_normed = src.clone(); - src_mean_normed.col(0) = src_mean_normed.col(0) - mean_src_x; - src_mean_normed.col(1) = src_mean_normed.col(1) - mean_src_y; - - cv::Mat_ dst_mean_normed = dst.clone(); - dst_mean_normed.col(0) = dst_mean_normed.col(0) - mean_dst_x; - dst_mean_normed.col(1) = dst_mean_normed.col(1) - mean_dst_y; - - // Find the scaling factor of each - cv::Mat src_sq; - cv::pow(src_mean_normed, 2, src_sq); - - cv::Mat dst_sq; - cv::pow(dst_mean_normed, 2, dst_sq); - - double s_src = sqrt(cv::sum(src_sq)[0] / n); - double s_dst = sqrt(cv::sum(dst_sq)[0] / n); - - src_mean_normed = src_mean_normed / s_src; - dst_mean_normed = dst_mean_normed / s_dst; - - double s = s_dst / s_src; - - // Get the rotation - cv::Matx22d R = AlignShapesKabsch2D(src_mean_normed, dst_mean_normed); - - cv::Matx22d A; - cv::Mat(s * R).copyTo(A); - - cv::Mat_ aligned = (cv::Mat(cv::Mat(A) * src.t())).t(); - cv::Mat_ offset = dst - aligned; - - double t_x = cv::mean(offset.col(0))[0]; - double t_y = cv::mean(offset.col(1))[0]; - - return A; - - } - - cv::Matx22f AlignShapesWithScale_f(cv::Mat_& src, cv::Mat_ dst) - { - int n = src.rows; - - // First we mean normalise both src and dst - float mean_src_x = cv::mean(src.col(0))[0]; - float mean_src_y = cv::mean(src.col(1))[0]; - - float mean_dst_x = cv::mean(dst.col(0))[0]; - float mean_dst_y = cv::mean(dst.col(1))[0]; - - cv::Mat_ src_mean_normed = src.clone(); - src_mean_normed.col(0) = src_mean_normed.col(0) - mean_src_x; - src_mean_normed.col(1) = src_mean_normed.col(1) - mean_src_y; - - cv::Mat_ dst_mean_normed = dst.clone(); - dst_mean_normed.col(0) = dst_mean_normed.col(0) - mean_dst_x; - dst_mean_normed.col(1) = dst_mean_normed.col(1) - mean_dst_y; - - // Find the scaling factor of each - cv::Mat src_sq; - cv::pow(src_mean_normed, 2, src_sq); - - cv::Mat dst_sq; - cv::pow(dst_mean_normed, 2, dst_sq); - - float s_src = sqrt(cv::sum(src_sq)[0] / n); - float s_dst = sqrt(cv::sum(dst_sq)[0] / n); - - src_mean_normed = src_mean_normed / s_src; - dst_mean_normed = dst_mean_normed / s_dst; - - float s = s_dst / s_src; - - // Get the rotation - cv::Matx22f R = AlignShapesKabsch2D_f(src_mean_normed, dst_mean_normed); - - cv::Matx22f A = s * R; - - cv::Mat_ aligned = (cv::Mat(cv::Mat(A) * src.t())).t(); - cv::Mat_ offset = dst - aligned; - - float t_x = cv::mean(offset.col(0))[0]; - float t_y = cv::mean(offset.col(1))[0]; - - return A; - - } - // Useful utility for grabing a bounding box around a set of 2D landmarks (as a 1D 2n x 1 vector of xs followed by doubles or as an n x 2 vector) void ExtractBoundingBox(const cv::Mat_& landmarks, float &min_x, float &max_x, float &min_y, float &max_y) { @@ -700,8 +543,7 @@ namespace LandmarkDetector if (min_width != -1) { - if (region.width < min_width || region.x < ((float)intensity.cols) * roi.x || region.y < ((float)intensity.cols) * roi.y || - region.x + region.width >((float)intensity.cols) * (roi.x + roi.width) || region.y + region.height >((float)intensity.rows) * (roi.y + roi.height)) + if (region.width < min_width || region.x < ((float)intensity.cols) * roi.x || region.y < ((float)intensity.cols) * roi.y || region.x + region.width >((float)intensity.cols) * (roi.x + roi.width) || region.y + region.height >((float)intensity.rows) * (roi.y + roi.height)) continue; } diff --git a/lib/local/LandmarkDetector/src/PAW.cpp b/lib/local/LandmarkDetector/src/PAW.cpp index 13eb723d..974184b3 100644 --- a/lib/local/LandmarkDetector/src/PAW.cpp +++ b/lib/local/LandmarkDetector/src/PAW.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -328,7 +328,7 @@ void PAW::Warp(const cv::Mat& image_to_warp, cv::Mat& destination_image, const c this->WarpRegion(map_x, map_y); // Do the actual warp (with bi-linear interpolation) - remap(image_to_warp, destination_image, map_x, map_y, CV_INTER_LINEAR); + remap(image_to_warp, destination_image, map_x, map_y, cv::INTER_LINEAR); } @@ -512,4 +512,4 @@ int PAW::findTriangle(const cv::Point_& point, const std::vector& out_params_l // Solve for the parameter update (from Baltrusaitis 2013 based on eq (36) Saragih 2011) cv::Mat_ param_update; - cv::solve(Hessian, J_w_t_m, param_update, CV_CHOLESKY); + cv::solve(Hessian, J_w_t_m, param_update, cv::DECOMP_CHOLESKY); // To not overshoot, have the gradient decent rate a bit smaller param_update = 0.75 * param_update; diff --git a/lib/local/LandmarkDetector/src/Patch_experts.cpp b/lib/local/LandmarkDetector/src/Patch_experts.cpp index b314672c..9ceb3c75 100644 --- a/lib/local/LandmarkDetector/src/Patch_experts.cpp +++ b/lib/local/LandmarkDetector/src/Patch_experts.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -36,6 +36,8 @@ #include "Patch_experts.h" +#include "RotationHelpers.h" + // TBB includes #include @@ -156,7 +158,7 @@ void Patch_experts::Response(vector >& patch_expert_responses, c cv::Mat_ reference_shape_2D = (reference_shape.reshape(1, 2).t()); cv::Mat_ image_shape_2D = landmark_locations.reshape(1, 2).t(); - sim_img_to_ref = AlignShapesWithScale_f(image_shape_2D, reference_shape_2D); + sim_img_to_ref = Utilities::AlignShapesWithScale(image_shape_2D, reference_shape_2D); sim_ref_to_img = sim_img_to_ref.inv(cv::DECOMP_LU); float a1 = sim_ref_to_img(0, 0); @@ -246,7 +248,7 @@ void Patch_experts::Response(vector >& patch_expert_responses, c // Extract the region of interest around the current landmark location cv::Mat_ area_of_interest(area_of_interest_height, area_of_interest_width, 0.0f); - cv::warpAffine(grayscale_image, area_of_interest, sim, area_of_interest.size(), cv::WARP_INVERSE_MAP + CV_INTER_LINEAR); + cv::warpAffine(grayscale_image, area_of_interest, sim, area_of_interest.size(), cv::WARP_INVERSE_MAP + cv::INTER_LINEAR); // Get intensity response either from the SVR, CCNF, or CEN patch experts (prefer CEN as they are the most accurate so far) if (!cen_expert_intensity.empty()) @@ -280,7 +282,7 @@ void Patch_experts::Response(vector >& patch_expert_responses, c // Extract the region of interest around the current landmark location cv::Mat_ area_of_interest_r(area_of_interest_height, area_of_interest_width, 0.0f); - cv::warpAffine(grayscale_image, area_of_interest_r, sim_r, area_of_interest_r.size(), cv::WARP_INVERSE_MAP + CV_INTER_LINEAR); + cv::warpAffine(grayscale_image, area_of_interest_r, sim_r, area_of_interest_r.size(), cv::WARP_INVERSE_MAP + cv::INTER_LINEAR); cv::Mat_ prealloc_mat_right = preallocated_im2col[mirror_id][im2col_size]; @@ -461,21 +463,21 @@ bool Patch_experts::Read(vector intensity_svr_expert_locations, vector> weight; early_term_weights.push_back(weight); } - for (int i = 0; i < centers[0].size(); ++i) + for (size_t i = 0; i < centers[0].size(); ++i) { double bias; earlyTermFile >> bias; early_term_biases.push_back(bias); } - for (int i = 0; i < centers[0].size(); ++i) + for (size_t i = 0; i < centers[0].size(); ++i) { double cutoff; earlyTermFile >> cutoff; diff --git a/lib/local/LandmarkDetector/src/SVR_patch_expert.cpp b/lib/local/LandmarkDetector/src/SVR_patch_expert.cpp index ace3317d..60644d45 100644 --- a/lib/local/LandmarkDetector/src/SVR_patch_expert.cpp +++ b/lib/local/LandmarkDetector/src/SVR_patch_expert.cpp @@ -14,19 +14,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -179,7 +179,7 @@ void SVR_patch_expert::Response(const cv::Mat_& area_of_interest, cv::Mat cv::Mat_ empty_matrix_2(0,0,0.0); // Efficient calc of patch expert SVR response across the area of interest - matchTemplate_m(normalised_area_of_interest, empty_matrix_0, empty_matrix_1, empty_matrix_2, weights, weights_dfts, svr_response, CV_TM_CCOEFF_NORMED); + matchTemplate_m(normalised_area_of_interest, empty_matrix_0, empty_matrix_1, empty_matrix_2, weights, weights_dfts, svr_response, cv::TM_CCOEFF_NORMED); response.create(svr_response.size()); cv::MatIterator_ p = response.begin(); @@ -246,7 +246,7 @@ void SVR_patch_expert::ResponseDepth(const cv::Mat_& area_of_interest, cv // Efficient calc of patch expert response across the area of interest - matchTemplate_m(normalised_area_of_interest, empty_matrix_0, empty_matrix_1, empty_matrix_2, weights, weights_dfts, svr_response, CV_TM_CCOEFF); + matchTemplate_m(normalised_area_of_interest, empty_matrix_0, empty_matrix_1, empty_matrix_2, weights, weights_dfts, svr_response, cv::TM_CCOEFF); response.create(svr_response.size()); cv::MatIterator_ p = response.begin(); diff --git a/lib/local/Utilities/Utilities.vcxproj b/lib/local/Utilities/Utilities.vcxproj index 3145ea22..80b47e8e 100644 --- a/lib/local/Utilities/Utilities.vcxproj +++ b/lib/local/Utilities/Utilities.vcxproj @@ -113,7 +113,8 @@ Disabled _DEBUG;_LIB;%(PreprocessorDefinitions) ./include;%(AdditionalIncludeDirectories) - StreamingSIMDExtensions2 + + Windows @@ -153,7 +154,8 @@ ./include;%(AdditionalIncludeDirectories) Speed AnySuitable - StreamingSIMDExtensions2 + + Windows diff --git a/lib/local/Utilities/include/ImageCapture.h b/lib/local/Utilities/include/ImageCapture.h index 58a0d688..e073d409 100644 --- a/lib/local/Utilities/include/ImageCapture.h +++ b/lib/local/Utilities/include/ImageCapture.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __IMAGE_CAPTURE_h_ -#define __IMAGE_CAPTURE_h_ +#ifndef IMAGE_CAPTURE_H +#define IMAGE_CAPTURE_H // System includes #include @@ -118,4 +118,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // IMAGE_CAPTURE_H \ No newline at end of file diff --git a/lib/local/Utilities/include/ImageManipulationHelpers.h b/lib/local/Utilities/include/ImageManipulationHelpers.h index 4687745a..ea2ee49a 100644 --- a/lib/local/Utilities/include/ImageManipulationHelpers.h +++ b/lib/local/Utilities/include/ImageManipulationHelpers.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __IMAGE_MANIPULATION_HELPERS_h_ -#define __IMAGE_MANIPULATION_HELPERS_h_ +#ifndef IMAGE_MANIPULATION_HELPERS_H +#define IMAGE_MANIPULATION_HELPERS_H #include #include @@ -88,4 +88,4 @@ namespace Utilities } -#endif \ No newline at end of file +#endif // IMAGE_MANIPULATION_HELPERS_H \ No newline at end of file diff --git a/lib/local/Utilities/include/RecorderCSV.h b/lib/local/Utilities/include/RecorderCSV.h index f640c2c6..c5ca74a0 100644 --- a/lib/local/Utilities/include/RecorderCSV.h +++ b/lib/local/Utilities/include/RecorderCSV.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __RECORDER_CSV_h_ -#define __RECORDER_CSV_h_ +#ifndef RECORDER_CSV_H +#define RECORDER_CSV_H // System includes #include @@ -97,4 +97,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // RECORDER_CSV_H \ No newline at end of file diff --git a/lib/local/Utilities/include/RecorderHOG.h b/lib/local/Utilities/include/RecorderHOG.h index 2d606084..25bc2f62 100644 --- a/lib/local/Utilities/include/RecorderHOG.h +++ b/lib/local/Utilities/include/RecorderHOG.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __RECORDER_HOG_h_ -#define __RECORDER_HOG_h_ +#ifndef RECORDER_HOG_H +#define RECORDER_HOG_H // System includes #include @@ -85,4 +85,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // RECORDER_HOG_H \ No newline at end of file diff --git a/lib/local/Utilities/include/RecorderOpenFace.h b/lib/local/Utilities/include/RecorderOpenFace.h index 1a712dec..524889a7 100644 --- a/lib/local/Utilities/include/RecorderOpenFace.h +++ b/lib/local/Utilities/include/RecorderOpenFace.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __RECORDER_OPENFACE_h_ -#define __RECORDER_OPENFACE_h_ +#ifndef RECORDER_OPENFACE_H +#define RECORDER_OPENFACE_H #include "RecorderCSV.h" #include "RecorderHOG.h" @@ -196,4 +196,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // RECORDER_OPENFACE_H \ No newline at end of file diff --git a/lib/local/Utilities/include/RecorderOpenFaceParameters.h b/lib/local/Utilities/include/RecorderOpenFaceParameters.h index a6e5d7d1..f27c2caf 100644 --- a/lib/local/Utilities/include/RecorderOpenFaceParameters.h +++ b/lib/local/Utilities/include/RecorderOpenFaceParameters.h @@ -32,8 +32,8 @@ /////////////////////////////////////////////////////////////////////////////// // Parameters of the Face analyser -#ifndef __RECORDER_OPENFACE_PARAM_H -#define __RECORDER_OPENFACE_PARAM_H +#ifndef RECORDER_OPENFACE_PARAM_H +#define RECORDER_OPENFACE_PARAM_H #include #include @@ -114,4 +114,4 @@ namespace Utilities } -#endif // ____RECORDER_OPENFACE_PARAM_H +#endif // RECORDER_OPENFACE_PARAM_H diff --git a/lib/local/Utilities/include/RotationHelpers.h b/lib/local/Utilities/include/RotationHelpers.h index 488893a5..1789466b 100644 --- a/lib/local/Utilities/include/RotationHelpers.h +++ b/lib/local/Utilities/include/RotationHelpers.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __ROTATION_HELPERS_h_ -#define __ROTATION_HELPERS_h_ +#ifndef ROTATION_HELPERS_H +#define ROTATION_HELPERS_H #include #include @@ -160,5 +160,87 @@ namespace Utilities } + //=========================================================================== + // Point set and landmark manipulation functions + //=========================================================================== + // Using Kabsch's algorithm for aligning shapes + //This assumes that align_from and align_to are already mean normalised + static cv::Matx22f AlignShapesKabsch2D(const cv::Mat_& align_from, const cv::Mat_& align_to) + { + + cv::SVD svd(align_from.t() * align_to); + + // make sure no reflection is there + // corr ensures that we do only rotaitons and not reflections + double d = cv::determinant(svd.vt.t() * svd.u.t()); + + cv::Matx22f corr = cv::Matx22f::eye(); + if (d > 0) + { + corr(1, 1) = 1; + } + else + { + corr(1, 1) = -1; + } + + cv::Matx22f R; + cv::Mat(svd.vt.t()*cv::Mat(corr)*svd.u.t()).copyTo(R); + + return R; + } + + //============================================================================= + // Basically Kabsch's algorithm but also allows the collection of points to be different in scale from each other + static cv::Matx22f AlignShapesWithScale(cv::Mat_& src, cv::Mat_ dst) + { + int n = src.rows; + + // First we mean normalise both src and dst + float mean_src_x = (float)cv::mean(src.col(0))[0]; + float mean_src_y = (float)cv::mean(src.col(1))[0]; + + float mean_dst_x = (float)cv::mean(dst.col(0))[0]; + float mean_dst_y = (float)cv::mean(dst.col(1))[0]; + + cv::Mat_ src_mean_normed = src.clone(); + src_mean_normed.col(0) = src_mean_normed.col(0) - mean_src_x; + src_mean_normed.col(1) = src_mean_normed.col(1) - mean_src_y; + + cv::Mat_ dst_mean_normed = dst.clone(); + dst_mean_normed.col(0) = dst_mean_normed.col(0) - mean_dst_x; + dst_mean_normed.col(1) = dst_mean_normed.col(1) - mean_dst_y; + + // Find the scaling factor of each + cv::Mat src_sq; + cv::pow(src_mean_normed, 2, src_sq); + + cv::Mat dst_sq; + cv::pow(dst_mean_normed, 2, dst_sq); + + float s_src = (float)sqrt(cv::sum(src_sq)[0] / n); + float s_dst = (float)sqrt(cv::sum(dst_sq)[0] / n); + + src_mean_normed = src_mean_normed / s_src; + dst_mean_normed = dst_mean_normed / s_dst; + + float s = s_dst / s_src; + + // Get the rotation + cv::Matx22f R = AlignShapesKabsch2D(src_mean_normed, dst_mean_normed); + + cv::Matx22f A; + cv::Mat(s * R).copyTo(A); + + //cv::Mat_ aligned = (cv::Mat(cv::Mat(A) * src.t())).t(); + //cv::Mat_ offset = dst - aligned; + + //float t_x = cv::mean(offset.col(0))[0]; + //float t_y = cv::mean(offset.col(1))[0]; + + return A; + + } + } -#endif \ No newline at end of file +#endif // ROTATION_HELPERS_H \ No newline at end of file diff --git a/lib/local/Utilities/include/SequenceCapture.h b/lib/local/Utilities/include/SequenceCapture.h index 2c89f173..ee59a02f 100644 --- a/lib/local/Utilities/include/SequenceCapture.h +++ b/lib/local/Utilities/include/SequenceCapture.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __SEQUENCE_CAPTURE_h_ -#define __SEQUENCE_CAPTURE_h_ +#ifndef SEQUENCE_CAPTURE_H +#define SEQUENCE_CAPTURE_H // System includes #include @@ -162,4 +162,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // SEQUENCE_CAPTURE_H \ No newline at end of file diff --git a/lib/local/Utilities/include/VisualizationUtils.h b/lib/local/Utilities/include/VisualizationUtils.h index 079428b2..903d4e99 100644 --- a/lib/local/Utilities/include/VisualizationUtils.h +++ b/lib/local/Utilities/include/VisualizationUtils.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __VISUALIZATION_UTILS_h_ -#define __VISUALIZATION_UTILS_h_ +#ifndef VISUALIZATION_UTILS_H +#define VISUALIZATION_UTILS_H #include @@ -71,4 +71,4 @@ namespace Utilities }; } -#endif \ No newline at end of file +#endif // VISUALIZATION_UTILS_H \ No newline at end of file diff --git a/lib/local/Utilities/include/Visualizer.h b/lib/local/Utilities/include/Visualizer.h index 3016060c..a676ee3f 100644 --- a/lib/local/Utilities/include/Visualizer.h +++ b/lib/local/Utilities/include/Visualizer.h @@ -31,8 +31,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#ifndef __VISUALIZER_h_ -#define __VISUALIZER_h_ +#ifndef VISUALIZER_H +#define VISUALIZER_H // System includes #include diff --git a/lib/local/Utilities/src/ImageCapture.cpp b/lib/local/Utilities/src/ImageCapture.cpp index 25834587..2731fa01 100644 --- a/lib/local/Utilities/src/ImageCapture.cpp +++ b/lib/local/Utilities/src/ImageCapture.cpp @@ -13,19 +13,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -358,7 +358,7 @@ cv::Mat ImageCapture::GetNextImage() } // Load the image as an 8 bit RGB - latest_frame = cv::imread(image_files[frame_num], CV_LOAD_IMAGE_COLOR); + latest_frame = cv::imread(image_files[frame_num], cv::IMREAD_COLOR); if (latest_frame.empty()) { @@ -420,4 +420,4 @@ double ImageCapture::GetProgress() cv::Mat_ ImageCapture::GetGrayFrame() { return latest_gray_frame; -} \ No newline at end of file +} diff --git a/lib/local/Utilities/src/RecorderOpenFace.cpp b/lib/local/Utilities/src/RecorderOpenFace.cpp index 74b36706..132bcf33 100644 --- a/lib/local/Utilities/src/RecorderOpenFace.cpp +++ b/lib/local/Utilities/src/RecorderOpenFace.cpp @@ -13,19 +13,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -428,7 +428,7 @@ void RecorderOpenFace::WriteObservationTracked() std::string output_codec = params.outputCodec(); try { - video_writer.open(media_filename, CV_FOURCC(output_codec[0], output_codec[1], output_codec[2], output_codec[3]), params.outputFps(), vis_to_out.size(), true); + video_writer.open(media_filename, cv::VideoWriter::fourcc(output_codec[0], output_codec[1], output_codec[2], output_codec[3]), params.outputFps(), vis_to_out.size(), true); if (!video_writer.isOpened()) { diff --git a/lib/local/Utilities/src/SequenceCapture.cpp b/lib/local/Utilities/src/SequenceCapture.cpp index 4c9e2374..46b2ffac 100644 --- a/lib/local/Utilities/src/SequenceCapture.cpp +++ b/lib/local/Utilities/src/SequenceCapture.cpp @@ -13,19 +13,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -232,16 +232,16 @@ bool SequenceCapture::OpenWebcam(int device, int image_width, int image_height, latest_gray_frame = cv::Mat(); capture.open(device); - capture.set(CV_CAP_PROP_FRAME_WIDTH, image_width); - capture.set(CV_CAP_PROP_FRAME_HEIGHT, image_height); + capture.set(cv::CAP_PROP_FRAME_WIDTH, image_width); + capture.set(cv::CAP_PROP_FRAME_HEIGHT, image_height); is_webcam = true; is_image_seq = false; vid_length = 0; - this->frame_width = (int)capture.get(CV_CAP_PROP_FRAME_WIDTH); - this->frame_height = (int)capture.get(CV_CAP_PROP_FRAME_HEIGHT); + this->frame_width = (int)capture.get(cv::CAP_PROP_FRAME_WIDTH); + this->frame_height = (int)capture.get(cv::CAP_PROP_FRAME_HEIGHT); if (!capture.isOpened()) { @@ -254,7 +254,7 @@ bool SequenceCapture::OpenWebcam(int device, int image_width, int image_height, std::cout << "Defaulting to " << frame_width << "x" << frame_height << std::endl; } - this->fps = capture.get(CV_CAP_PROP_FPS); + this->fps = capture.get(cv::CAP_PROP_FPS); // Check if fps is nan or less than 0 if (fps != fps || fps <= 0) @@ -319,7 +319,7 @@ bool SequenceCapture::OpenVideoFile(std::string video_file, float fx, float fy, return false; } - this->fps = capture.get(CV_CAP_PROP_FPS); + this->fps = capture.get(cv::CAP_PROP_FPS); // Check if fps is nan or less than 0 if (fps != fps || fps <= 0) @@ -331,10 +331,10 @@ bool SequenceCapture::OpenVideoFile(std::string video_file, float fx, float fy, is_webcam = false; is_image_seq = false; - this->frame_width = (int)capture.get(CV_CAP_PROP_FRAME_WIDTH); - this->frame_height = (int)capture.get(CV_CAP_PROP_FRAME_HEIGHT); + this->frame_width = (int)capture.get(cv::CAP_PROP_FRAME_WIDTH); + this->frame_height = (int)capture.get(cv::CAP_PROP_FRAME_HEIGHT); - vid_length = (int)capture.get(CV_CAP_PROP_FRAME_COUNT); + vid_length = (int)capture.get(cv::CAP_PROP_FRAME_COUNT); SetCameraIntrinsics(fx, fy, cx, cy); @@ -390,7 +390,7 @@ bool SequenceCapture::OpenImageSequence(std::string directory, float fx, float f } // Assume all images are same size in an image sequence - cv::Mat tmp = cv::imread(image_files[0], CV_LOAD_IMAGE_COLOR); + cv::Mat tmp = cv::imread(image_files[0], cv::IMREAD_COLOR); this->frame_height = tmp.size().height; this->frame_width = tmp.size().width; @@ -468,7 +468,7 @@ void SequenceCapture::CaptureThread() } else if (is_image_seq) { - if (image_files.empty() || frame_num_int >= image_files.size()) + if (image_files.empty() || frame_num_int >= (int)image_files.size()) { // Indicate lack of success by returning an empty image tmp_frame = cv::Mat(); @@ -476,7 +476,7 @@ void SequenceCapture::CaptureThread() } else { - tmp_frame = cv::imread(image_files[frame_num_int], CV_LOAD_IMAGE_COLOR); + tmp_frame = cv::imread(image_files[frame_num_int], cv::IMREAD_COLOR); } timestamp_curr = 0; } @@ -544,4 +544,4 @@ bool SequenceCapture::IsOpened() cv::Mat_ SequenceCapture::GetGrayFrame() { return latest_gray_frame; -} \ No newline at end of file +} diff --git a/lib/local/Utilities/src/Visualizer.cpp b/lib/local/Utilities/src/Visualizer.cpp index ac2ca611..6b764fd2 100644 --- a/lib/local/Utilities/src/Visualizer.cpp +++ b/lib/local/Utilities/src/Visualizer.cpp @@ -13,19 +13,19 @@ // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit -// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency +// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. -// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, +// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation -// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection -// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // @@ -318,7 +318,7 @@ void Visualizer::SetObservationActionUnits(const std::vector