Closed mzealey closed 3 years ago
Brilliant work @mzealey !
I've tested on the following configuration and it worked extremely well:
Fedora 32
OpenCV 4.2.0
Fujifilm X-T10
I'm especially impressed by the v4l2 loopback device feature, which will be very useful in these times of increased video conferencing. (I've only tested it with piping it to /dev/null since I don't have the kernel module installed yet, so rather just to view the Imshow window)
I did however encounter an issue when I tried compiling without enabling OpenCV, which threw an error related to the lock which was added in 127a8f7 here is the output from cmake:
Scanning dependencies of target fuji_cam_wifi_tool
[ 92%] Building CXX object tool/CMakeFiles/fuji_cam_wifi_tool.dir/src/main.cpp.o
/home/phil/projects2/fuji-webcam/fuji-cam-wifi-tool/tool/src/main.cpp:38:6: error: ‘timed_mutex’ in namespace ‘std’ does not name a type
38 | std::timed_mutex g_comm_lock;
| ^~~~~~~~~~~
/home/phil/projects2/fuji-webcam/fuji-cam-wifi-tool/tool/src/main.cpp:20:1: note: ‘std::timed_mutex’ is defined in header ‘<mutex>’; did you forget to ‘#include <mutex>’?
19 | #include <algorithm>
+++ |+#include <mutex>
20 |
/home/phil/projects2/fuji-webcam/fuji-cam-wifi-tool/tool/src/main.cpp: In function ‘int fcwt::main(int, const char**)’:
/home/phil/projects2/fuji-webcam/fuji-cam-wifi-tool/tool/src/main.cpp:347:16: error: ‘lock_guard’ in namespace ‘std’ does not name a template type
347 | const std::lock_guard<std::timed_mutex> lock(g_comm_lock);
| ^~~~~~~~~~
/home/phil/projects2/fuji-webcam/fuji-cam-wifi-tool/tool/src/main.cpp:347:11: note: ‘std::lock_guard’ is defined in header ‘<mutex>’; did you forget to ‘#include <mutex>’?
347 | const std::lock_guard<std::timed_mutex> lock(g_comm_lock);
| ^~~
gmake[2]: *** [tool/CMakeFiles/fuji_cam_wifi_tool.dir/build.make:83: tool/CMakeFiles/fuji_cam_wifi_tool.dir/src/main.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:183: tool/CMakeFiles/fuji_cam_wifi_tool.dir/all] Error 2
gmake: *** [Makefile:150: all] Error 2
Does adding this to bottom of lib/CMakeLists.txt fix it? Believe you need to compile with c++11 for these primatives
set_property(TARGET fuji_cam_wifi PROPERTY CXX_STANDARD_REQUIRED ON)
Does adding this to bottom of lib/CMakeLists.txt fix it? Believe you need to compile with c++11 for these primatives
set_property(TARGET fuji_cam_wifi PROPERTY CXX_STANDARD_REQUIRED ON)
Unfortunately it still gives the exact same error, starting with a fresh copy of your repo and a new build folder, just to show that I've altered the file:
$: git diff
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 7ff21f1..4829872 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -8,3 +8,4 @@ file(GLOB_RECURSE fuji_cam_wifi_lib_public_headers ${CMAKE_CURRENT_SOURCE_DIR} i
add_library(fuji_cam_wifi ${fuji_cam_wifi_lib_sources} ${fuji_cam_wifi_lib_private_headers} ${fuji_cam_wifi_lib_public_headers})
target_include_directories(fuji_cam_wifi PUBLIC include PRIVATE src)
set_property(TARGET fuji_cam_wifi PROPERTY CXX_STANDARD 11)
+set_property(TARGET fuji_cam_wifi PROPERTY CXX_STANDARD_REQUIRED ON)
I have just tested the v4l2 loopback after installing the kernel module, I can report that it works though it outputs in the wrong colour space, it appears to be outputting in OpenCV's BGR colour space instead of RGB.
Please see the attached screenshot, where I have the Imshow window open pointing the camera at a picture which shows the RGB correctly (on the right), and on the left is the output from any software that accepts a webcam input. (tested with Gnome Cheese and with Google Chrome)
Does it show the same (incorrect) output in the stream_cv window?
Does it show the same (incorrect) output in the stream_cv window?
No, the window on the right of the screenshot is the Imshow window from the stream_cv
Perhaps cvtColor(decodedImage, decodedImage, cv::COLOR_BGR2RGB);
will fix it?
Though it seems to throw an error when I added that to L185
[ERROR] Error opening v4l2l device: Device or resource busy
Here is a screenshot of the fix working
ok thanks. I thought I had this issue before and switching to rgb fixed it but i guess i was mistaken
I've been trying for some time to solve this... it was easier than what I thought but difficult to find :-)
Just add to main.ccp
#include <mutex>
@hkr Can we merge these changes?
Merged. Sorry for the delay, but as you have probably noticed I'm not really working on this anymore.
Merged. Sorry for the delay, but as you have probably noticed I'm not really working on this anymore.
Thank you :smile:
No worries about that, thank you for creating this great program in the first place (and all the research which went into the protocol), perhaps one the more active users can maintain it.
shutter
and thumbnail returned is larger than 20kb