Thanks to the author and Claude to create this nice example for sam3 and ggml application.
I forked the project and made some adaptations so that the sam_image and sam_video modules can be compiled on Windows.
A sample release is here: https://github.com/mimi3421/sam3.cpp/releases/tag/main
The key changes were:
- Add
-DCMAKE_BUILD_TYPE=Release and -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake in cmake build config in the workflow file.
- Add
SDL2 and imGUI installation porcess in the workflow file.
- For
main_image.cpp and main_video.cpp, add #define SDL_MAIN_HANDLED and change the loading order of the head files to avoid the duplicated declaration error. Change the opengl head file form GL/gl.h to SDL2/SDL_opengl.h to increase compatibility.
- For
sam3.cpp, remove 2>/dev/null in all foreign FFMPEG calls and change the popen method from 'r' to 'rb' to avoid the auto newline translation in Windows cmd.
- For
examples/third-party/CMakeLists.txt, change the target_compile_definitions from IMGUI_IMPL_OPENGL_LOADER_CUSTOM to IMGUI_IMPL_OPENGL_LOADER_NONE to let the SDL2 choose the opengl loader.
I'm not sure whether these changes would introduce new problems in other building platforms, maybe it would be better to let Claude to decide.
In addition, some bugs and suggestions are listed here:
- The exported file from
sam3_image.exe always names mask00.png so that the old one is replaced.
- The GUI should work in a seperated thread so the program would not be halted when doing computation
- Maybe adding a Vulkan backend, which is also supported by
ggml, is more favorable for other GPU host.
- Foreign calling of FFMPEG frame by frame is intolerability slow on Windows. Maybe it's better to use the shared library or utilizing some frame cache.
Thanks to the author and Claude to create this nice example for
sam3andggmlapplication.I forked the project and made some adaptations so that the
sam_imageandsam_videomodules can be compiled on Windows.A sample release is here: https://github.com/mimi3421/sam3.cpp/releases/tag/main
The key changes were:
-DCMAKE_BUILD_TYPE=Releaseand-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmakeincmakebuild config in the workflow file.SDL2andimGUIinstallation porcess in the workflow file.main_image.cppandmain_video.cpp, add#define SDL_MAIN_HANDLEDand change the loading order of the head files to avoid the duplicated declaration error. Change the opengl head file formGL/gl.htoSDL2/SDL_opengl.hto increase compatibility.sam3.cpp, remove2>/dev/nullin all foreign FFMPEG calls and change thepopenmethod from 'r' to 'rb' to avoid the auto newline translation in Windows cmd.examples/third-party/CMakeLists.txt, change thetarget_compile_definitionsfromIMGUI_IMPL_OPENGL_LOADER_CUSTOMtoIMGUI_IMPL_OPENGL_LOADER_NONEto let theSDL2choose the opengl loader.I'm not sure whether these changes would introduce new problems in other building platforms, maybe it would be better to let Claude to decide.
In addition, some bugs and suggestions are listed here:
sam3_image.exealways namesmask00.pngso that the old one is replaced.ggml, is more favorable for other GPU host.