Git Product home page Git Product logo

Comments (6)

mpromonet avatar mpromonet commented on August 28, 2024

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.

mattdibi avatar mattdibi commented on August 28, 2024

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.

mpromonet avatar mpromonet commented on August 28, 2024

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.

mattdibi avatar mattdibi commented on August 28, 2024

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.

mpromonet avatar mpromonet commented on August 28, 2024

Hi,

I was not clear, what I was suggesting is :

int main(int argc, char* argv[]) {
    LogLevel=ERROR;
...

Best Regards,
Michel.

from libv4l2cpp.

mattdibi avatar mattdibi commented on August 28, 2024

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)

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.