Comments (16)
Is your final goal to run java or c++? If java, you will definitely need 3.2.0, and getting a proper build of opencv for that still needs some work on our end. If c++ we are actually working on a cmake build system that works with preinstalled opencv. I'll have that working tonight and could then send it.
from cscore.
If we were building for Roborio we would be using java, but RPi we're using c++.
from cscore.
Ok. For c++ on the pi the cmake build will work just fine. I'll get a bit more docs and post a reply to this tonight.
from cscore.
https://github.com/ThadHouse/CmakeWpilib/tree/visionTestPackage
Here is a repo for you to try if you would like. It should just work with the opencv you built on the pi, but note that opencv < 3.2 has never been tested. But it should, and I would be interested in hearing. Note it includes a copy of the CameraServer API from wpilib, so if you want everything published it should just work. You'll need to set your team number in main.cpp, and probably change the AddAxisCamera call to AddUsbCamera, but other then that everything should just work properly.
from cscore.
I don't believe cscore would compile against opencv < 3.0
from cscore.
@ThadHouse
I cloned the repo above, had some cmake/make issues not related to the camera_server stuff - more on no make rules for wpiutil.
from cscore.
Hmm. You cloned the visionTestPackage branch, right? It worked on my windows desktop, and another person tested it on a TK1 and it worked. Thats weird you were getting errors. If you don't have it working later today, tomorrow I'll try installing Stretch on my Pi and try it out directly there.
from cscore.
pi@raspberrypi:~ $ git clone https://github.com/ThadHouse/CmakeWpilib -b visionTestPackage
Cloning into 'CmakeWpilib'...
remote: Counting objects: 76, done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 76 (delta 26), reused 72 (delta 22), pack-reused 0
Unpacking objects: 100% (76/76), done.
pi@raspberrypi:~ $ cd CmakeWpilib/
pi@raspberrypi:/CmakeWpilib $ dir/CmakeWpilib $ cmake .
CMakeLists.txt cscore_main.cpp include libraries ntcore_main.cpp src wpiutil_main.cpp
pi@raspberrypi:
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
You have called ADD_LIBRARY for library wpiutil without any source files. This typically indicates a problem with your CMakeLists.txt file
You have called ADD_LIBRARY for library ntcore without any source files. This typically indicates a problem with your CMakeLists.txt file
You have called ADD_LIBRARY for library cscore without any source files. This typically indicates a problem with your CMakeLists.txt file
-- Configuring done
CMake Error: Cannot determine link language for target "wpiutil".
CMake Error: CMake can not determine linker language for target: wpiutil
CMake Error: Cannot determine link language for target "ntcore".
CMake Error: CMake can not determine linker language for target: ntcore
-- Generating done
-- Build files have been written to: /home/pi/CmakeWpilib
pi@raspberrypi:~/CmakeWpilib $
Am I missing something?
Rob
from cscore.
Ohhh. You need to clone the submodules as well.
git submodule update --init --recursive
from cscore.
Much further, thanks!
Made it through most of the build this time, failed right toward the end during cscore library build:
[ 96%] Built target cscore
[ 97%] Building CXX object CMakeFiles/camera_vision.dir/src/CameraServer.cpp.o
/home/pi/CmakeWpilib/src/CameraServer.cpp: In member function ‘cs::UsbCamera frc::CameraServer::StartAutomaticCapture()’:
/home/pi/CmakeWpilib/src/CameraServer.cpp:495:14: error: ‘HALUsageReporting’ has not been declared
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer,
^~~~~~~~~~~~~~~~~
/home/pi/CmakeWpilib/src/CameraServer.cpp:496:32: error: ‘HAL_Report’ was not declared in this scope
camera.GetHandle());
^
/home/pi/CmakeWpilib/src/CameraServer.cpp: In member function ‘cs::UsbCamera frc::CameraServer::StartAutomaticCapture(int)’:
/home/pi/CmakeWpilib/src/CameraServer.cpp:507:14: error: ‘HALUsageReporting’ has not been declared
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer,
^~~~~~~~~~~~~~~~~
/home/pi/CmakeWpilib/src/CameraServer.cpp:508:32: error: ‘HAL_Report’ was not declared in this scope
camera.GetHandle());
^
/home/pi/CmakeWpilib/src/CameraServer.cpp: In member function ‘cs::UsbCamera frc::CameraServer::StartAutomaticCapture(llvm::StringRef, int)’:
/home/pi/CmakeWpilib/src/CameraServer.cpp:516:14: error: ‘HALUsageReporting’ has not been declared
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer,
^~~~~~~~~~~~~~~~~
/home/pi/CmakeWpilib/src/CameraServer.cpp:517:32: error: ‘HAL_Report’ was not declared in this scope
camera.GetHandle());
^
/home/pi/CmakeWpilib/src/CameraServer.cpp: In member function ‘cs::UsbCamera frc::CameraServer::StartAutomaticCapture(llvm::StringRef, llvm::StringRef)’:
/home/pi/CmakeWpilib/src/CameraServer.cpp:525:14: error: ‘HALUsageReporting’ has not been declared
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer,
^~~~~~~~~~~~~~~~~
/home/pi/CmakeWpilib/src/CameraServer.cpp:526:32: error: ‘HAL_Report’ was not declared in this scope
camera.GetHandle());
^
CMakeFiles/camera_vision.dir/build.make:62: recipe for target 'CMakeFiles/camera_vision.dir/src/CameraServer.cpp.o' failed
make[2]: *** [CMakeFiles/camera_vision.dir/src/CameraServer.cpp.o] Error 1
CMakeFiles/Makefile2:69: recipe for target 'CMakeFiles/camera_vision.dir/all' failed
make[1]: *** [CMakeFiles/camera_vision.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
pi@raspberrypi:~/CmakeWpilib $
Looking to see where HALUsageReporting is defined...
from cscore.
Hmm I thought I removed all of those. Just remove them. Its defined in wpilib, and not that project.
from cscore.
Success! Snippet of the last part of the build...
Scanning dependencies of target camera_vision
[ 97%] Building CXX object CMakeFiles/camera_vision.dir/src/CameraServer.cpp.o
[ 98%] Building CXX object CMakeFiles/camera_vision.dir/src/main.cpp.o
[100%] Linking CXX executable camera_vision
[100%] Built target camera_vision
I built the usbcvstream example successfully as well, and also ran it successfully. Not sure where the video is going yet, but it is reporting frames captured and the camera is active.
Snippet from my Makefile for that:
all: usbcvstream
clean:
rm -f usbcvstream
INCLUDE_DIRS = -I /home/pi/ntcore/src/main/native/include -I /home/pi/wpiutil/src/main/native/include -I/home/pi/CmakeWpilib/libraries/cscore/cscore/src/main/native/include
LIB_DIRS = -L /home/pi/ntcore/build/libs/ntcore/shared -L /home/pi/wpiutil/build/libs/wpiutil/shared -L/home/pi/CmakeWpilib/libraries/cscore
...
usbcvstream: usbcvstream.cpp
g++ -o usbcvstream usbcvstream.cpp $(INCLUDE_DIRS) pkg-config opencv --cflags --libs
-std=gnu++11 $(LIB_DIRS) -lwpiutil -lntcore -lcscore -lv4l2
from cscore.
Sweet. Note that the main example provided with a change to switch to USB cameras should stream images as well.
If you are trying to use usbcvstream, it will output the original image on ipaddr:8081
, and the modified image on ipaddr:8082
. If using the example in camera_vision, it will stream to ipaddr:1181
and modified image (the bgr to hsv conversion in the main loopto
ipaddr:1182`
from cscore.
I am seeing the CV page with images locally on the RPi at http://localhost:8081/. Playing around with it, everything seems to be working well! Thanks for the help - RPi/OpenCV2 works great with this - confirmed.
from cscore.
Cool!. Note I do recommend using the main one, and not the usbcvstream. It will post all the data correctly to NetworkTables, and allow all the dashboards to properly connect to the stream. It's already set up to do the same things as the usbcvstream anyway.
from cscore.
This is fixed with wpilibsuite/allwpilib#1015, which brings cmake builds to the merged wpilib repository.
from cscore.
Related Issues (20)
- Compression in MjpegServer cannot be set programmatically HOT 4
- Documentation for extending cscore webpage controls? HOT 2
- LifeCam HD-3000 exposure 'quirk' also on LifeCam Cinema HOT 2
- LLVM Headers missing HOT 13
- Log an error message on EACCES/EPERM
- MjpegServer: Improve HTTP request parsing
- Provide information about streams on webpage
- VideoSource.getActualDataRate() throwing Video Exception HOT 4
- Add overloads for each property type
- Boolean property doesn't seem to work in web page HOT 2
- Add a file source and a property for iterating over a directory
- Add a file writing sink?
- Add information page that lists the symlink information for USB cameras HOT 4
- Add information about USB bandwidth allocation HOT 2
- Segfault when using CvSource HOT 3
- Sliders do not update when multiple users are adjusting camera settings HOT 3
- Concatenated HTML in C++
- Have webpage use MjpegServer name identifier instead of CameraServer
- Fix CORS issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cscore.