Git Product home page Git Product logo

Comments (16)

ThadHouse avatar ThadHouse commented on June 1, 2024

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.

rtrahms avatar rtrahms commented on June 1, 2024

If we were building for Roborio we would be using java, but RPi we're using c++.

from cscore.

ThadHouse avatar ThadHouse commented on June 1, 2024

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.

ThadHouse avatar ThadHouse commented on June 1, 2024

@rtrahms

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.

virtuald avatar virtuald commented on June 1, 2024

I don't believe cscore would compile against opencv < 3.0

from cscore.

rtrahms avatar rtrahms commented on June 1, 2024

@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.

ThadHouse avatar ThadHouse commented on June 1, 2024

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.

rtrahms avatar rtrahms commented on June 1, 2024

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
CMakeLists.txt cscore_main.cpp include libraries ntcore_main.cpp src wpiutil_main.cpp
pi@raspberrypi:
/CmakeWpilib $ cmake .
-- 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.

ThadHouse avatar ThadHouse commented on June 1, 2024

Ohhh. You need to clone the submodules as well.

git submodule update --init --recursive

from cscore.

rtrahms avatar rtrahms commented on June 1, 2024

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.

ThadHouse avatar ThadHouse commented on June 1, 2024

Hmm I thought I removed all of those. Just remove them. Its defined in wpilib, and not that project.

from cscore.

rtrahms avatar rtrahms commented on June 1, 2024

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.

ThadHouse avatar ThadHouse commented on June 1, 2024

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 looptoipaddr:1182`

from cscore.

rtrahms avatar rtrahms commented on June 1, 2024

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.

ThadHouse avatar ThadHouse commented on June 1, 2024

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.

PeterJohnson avatar PeterJohnson commented on June 1, 2024

This is fixed with wpilibsuite/allwpilib#1015, which brings cmake builds to the merged wpilib repository.

from cscore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.