Comments (6)
Hi mattdibi,
Did you try to call initLogger(0)
(see https://github.com/mpromonet/libv4l2cpp/blob/master/inc/logger.h) ?
Best Regards,
Michel.
from libv4l2cpp.
Hi,
I did try but without success...
I'll try explain my situation.
I have a class Camera
which essentially has:
class Camera {
...
private:
const V4L2DeviceParameters param{
DEVICE_NAME.c_str(),
FRAME_FORMAT,
FRAME_WIDTH,
FRAME_HEIGHT,
FRAMERATE,
LIBV4L2_VERBOSITY
}; /*!< Video capture parameters */
std::unique_ptr<V4l2Capture> _cap{V4l2Capture::create(
param, V4l2Access::IOTYPE_MMAP)}; /*!< Video capture */
}
and in my main.cpp
file:
int main(int argc, char* argv[]) {
// MIPI camera
auto camera = std::make_shared<pcn::sensor::Camera>();
// Main grabbing loop
cv::Mat rgb_data;
while (!stop) {
// Retrieve RGB sensor data
rgb_data = camera->data();
// do some stuff
// ...
}
return 0;
}
I tried setting the logger by passing the verbosity level through the V4L2DeviceParameters
and using initLogger(0)
both in the Camera
constructor and in the main, without success.
The program will always display:
[NOTICE] src/V4l2Device.cpp:133
driver:uvcvideo capabilities:84a00001 mandatory:4000001
[NOTICE] src/V4l2Device.cpp:136
/dev/video0 support capture
[NOTICE] src/V4l2Device.cpp:139
/dev/video0 support streaming
[NOTICE] src/V4l2Device.cpp:225
/dev/video0:YUYV size:640x360 bufferSize:460800
[NOTICE] src/V4l2Device.cpp:246
fps:1/30
[NOTICE] src/V4l2Device.cpp:247
nbBuffer:0
[NOTICE] src/V4l2MmapDevice.cpp:49
Device /dev/video0
[NOTICE] src/V4l2MmapDevice.cpp:73
When I added initLogger(0)
to the constructor (or the main) I obtained:
int main(int argc, char* argv[]) {
initLogger(0);
// MIPI camera
auto camera = std::make_shared<pcn::sensor::Camera>();
// Main grabbing loop
cv::Mat rgb_data;
while (!stop) {
// Retrieve RGB sensor data
rgb_data = camera->data();
// do some stuff
// ...
}
return 0;
}
log level:500
[NOTICE] src/V4l2Device.cpp:133
driver:uvcvideo capabilities:84a00001 mandatory:4000001
[NOTICE] src/V4l2Device.cpp:136
/dev/video0 support capture
[NOTICE] src/V4l2Device.cpp:139
/dev/video0 support streaming
[NOTICE] src/V4l2Device.cpp:225
/dev/video0:YUYV size:640x360 bufferSize:460800
[NOTICE] src/V4l2Device.cpp:246
fps:1/30
[NOTICE] src/V4l2Device.cpp:247
nbBuffer:0
[NOTICE] src/V4l2MmapDevice.cpp:49
Device /dev/video0
[NOTICE] src/V4l2MmapDevice.cpp:73
from libv4l2cpp.
Hi,
You are right the NOTICE level cannot be disabled with initLogger.
A workaround could be to set the LogLevel
value:
LogLevel=ERROR
Best Regards,
Michel.
from libv4l2cpp.
Hi,
I'm still seeing the NOTICE level entries.
What I did:
class Camera {
...
private:
const V4L2DeviceParameters param{
DEVICE_NAME.c_str(),
FRAME_FORMAT,
FRAME_WIDTH,
FRAME_HEIGHT,
FRAMERATE,
300 // = ERROR as per logger.h
}; /*!< Video capture parameters */
std::unique_ptr<V4l2Capture> _cap{V4l2Capture::create(
param, V4l2Access::IOTYPE_MMAP)}; /*!< Video capture */
}
the results:
[NOTICE] src/V4l2Device.cpp:133
driver:uvcvideo capabilities:84a00001 mandatory:4000001
[NOTICE] src/V4l2Device.cpp:136
/dev/video0 support capture
[NOTICE] src/V4l2Device.cpp:139
/dev/video0 support streaming
[NOTICE] src/V4l2Device.cpp:225
/dev/video0:YUYV size:640x360 bufferSize:460800
[NOTICE] src/V4l2Device.cpp:246
fps:1/30
[NOTICE] src/V4l2Device.cpp:247
nbBuffer:0
[NOTICE] src/V4l2MmapDevice.cpp:49
Device /dev/video0
[NOTICE] src/V4l2MmapDevice.cpp:73
from libv4l2cpp.
Hi,
I was not clear, what I was suggesting is :
int main(int argc, char* argv[]) {
LogLevel=ERROR;
...
Best Regards,
Michel.
from libv4l2cpp.
Hi,
that did the trick, thank you.
Just a note (sorry if I sound annoying): if I understand correctly the LogLevel
variable is a global variable. May I suggest to wrap it in a namespace to avoid name clashes?
from libv4l2cpp.
Related Issues (20)
- Enhancement Request: Option to log to stderr or file HOT 1
- Wrong library name
- Support for Mac and Windows HOT 1
- what is the different between writePartial function and write function in V4l2Output ? HOT 2
- Add `-fPIC` option in Makefile HOT 2
- IOTYPE_MMAP HOT 8
- Conflict with libtorch HOT 1
- Compiling on MacOS 11.4 fails HOT 4
- context-aware encoding
- isReadable θΏε-1
- Compiling in a yocto linux image HOT 6
- cross compile libv4l2cpp HOT 1
- Should size return 0 instead of - 1? HOT 1
- why V4L2MMAP_NBBUFFER is 10
- what is idea of queryFormat()
- top shows very high cpu usage when waiting on V4l2MmapCapture::read HOT 2
- Unable to create new instance of V4l2Capture after destroying original one HOT 4
- Request: support configuring H264 HW encoders HOT 1
- install: target '/usr/include/libv4l2cpp/' is not a directory: No such file or directory HOT 2
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 libv4l2cpp.