rjdmoore / fictrac

FicTrac: A webcam-based method for tracking spherical motion and generating fictive animal paths.
http://fictrac.rjdmoore.net/
Other
26 stars 29 forks source link

add BaslerSource #9

Closed young24 closed 4 years ago

young24 commented 5 years ago

Hi Dr. Moore, I add this BaslerSource interface by following your instructions. I will test the code in a few days. However, some things confuse me a lot.

  1. It seems not a conventional way to put all initialization in the constructor.
  2. Is it necessary for a child class to have virtual methods?
  3. It seems no implementation for rewind method in PGRSource.cpp. Do I need to write one for BaslerSource?

If there's anything to improve/modify in my code, please point it out directly. I'll update them ASAP. And if you don't have time recently, I'll try to write the method to get output each frame from Tracking.cpp as you mentioned before.

rjdmoore commented 5 years ago

Thanks, I'll take a look ASAP (likely early this week).

  1. There was just no need for init/deinit functions here: the code should exit with error if the camera can't connect anyway and there's only one instantiation per execution.

  2. Nope

  3. No, this is only valid for CVSource when reading from video file and can possibly be removed anyway.

rjdmoore commented 5 years ago
rjdmoore commented 5 years ago

@young24 are you able to test points 3 & 4 in above to-do list?

I will check linux build configuration when I get a chance.

young24 commented 5 years ago

Sure, I can test point 3&4. Hopefully, I can finish it in two days.

young24 commented 5 years ago

When I tried to build Fictrac, this error popped up.

ErrorCode: MSB3073

The related code:
<Exec Command="%(PostBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PostBuildEvent.Command)' != ''"/>

Description: The command "setlocal powershell -noprofile -executionpolicy Bypass -file C:/Users/USER/Downloads/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/USER/Downloads/fictrac/bin/Debug/fictrac.exe -installedDir C:/Users/USER/Downloads/vcpkg/installed/x64-windows/debug/bin -OutVariable out if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd setlocal "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_calib3d343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_core343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_features2d343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_flann343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_highgui343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_imgcodecs343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_imgproc343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_ml343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_objdetect343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_photo343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_shape343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_stitching343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_superres343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_video343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_videoio343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_videostab343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_ffmpeg343_64.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/share/nlopt/../..//bin/nlopt.dll C:/Users/USER/Downloads/fictrac/bin/Debug/ if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. fictrac C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 133

I searched on Google and tried some suggestions, however, I cannot fix it. Any suggestion?

rjdmoore commented 5 years ago

Hmm, it built on the CI server, so should be ok. Perhaps delete your build folder and try again if you haven't already.

Looks like the post-build file copying failed. Can you see that the FicTrac executables were generated anyway?

On Fri, 14 Jun. 2019, 05:21 Wenbin Yang, notifications@github.com wrote:

When I tried to build Fictrac, this error popped up.

ErrorCode: MSB3073

The related code:

Description: The command "setlocal powershell -noprofile -executionpolicy Bypass -file C:/Users/USER/Downloads/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/USER/Downloads/fictrac/bin/Debug/fictrac.exe -installedDir C:/Users/USER/Downloads/vcpkg/installed/x64-windows/debug/bin -OutVariable out if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd setlocal "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_calib3d343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_core343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_features2d343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_flann343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_highgui343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_imgcodecs343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_imgproc343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_ml343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_objdetect343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_photo343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_shape343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_stitching343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_superres343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_video343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_videoio343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_videostab343.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/bin/opencv_ffmpeg343_64.dll C:/Users/USER/Downloads/vcpkg/installed/x64-windows/share/nlopt/../..//bin/nlopt.dll C:/Users/USER/Downloads/fictrac/bin/Debug/ if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. fictrac C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 133

I searched on Google and tried some suggestions, however, I cannot fix it. Any suggestion?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rjdmoore/fictrac/pull/9?email_source=notifications&email_token=AA5KTA3SYL32ANLNTC7UKXTP2MFFLA5CNFSM4HSAI3VKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXVTHVQ#issuecomment-501953494, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5KTA2VYXXDN3GXIY3BZHDP2MFFLANCNFSM4HSAI3VA .

young24 commented 5 years ago

There is the fictrac executable. And I successfully ran it with sample data. It's weird...

young24 commented 5 years ago

Just tested with a live camera. Everything was fine though no fly to track. The output .dat file seems normal as well as the monitor window when tracking. The getFPS function works fine and the framerate goes up and down a little bit around 100 fps.

Do you need the log file and the output dat file? I can upload them if you want.

young24 commented 5 years ago

One last thing to mention: In BaslerSource.cpp -> setFPS, you seem to forget to return ret at the end of the method.

rjdmoore commented 5 years ago

Ok, thanks. Sometimes there can be odd build errors - I think due to locking of the output library file during linking. Just running build again will normally fix it, or deleting the build folder and trying again.

Thanks for the code check 😁 you can fix the missing ret if you like, otherwise I'll push a fix when i get a chance.

On Fri, 14 Jun. 2019, 08:24 Wenbin Yang, notifications@github.com wrote:

One last thing to mention: In BaslerSource.cpp -> setFPS, you seem to forget to return ret at the end of the method.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rjdmoore/fictrac/pull/9?email_source=notifications&email_token=AA5KTA7HOOLSOL6BFAROQ2LP2M2SNA5CNFSM4HSAI3VKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXV25FA#issuecomment-501984916, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5KTA2NIZF6W34DSTBOFXTP2M2SNANCNFSM4HSAI3VA .