PiCapture C++ / OpenFrameworks usage

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #976
    gilbert.sinnott
    Participant

    Hello, very happy to find the SD1 works out the box and as a Pi camera, thought having problems sending flags via C++.

    I’m using OpenFrameworks and an addon called ofxCvPiCam, and by default it launches the camera in what I think is “mode 1”. I’m trying to work out then how to send these flags to the Pi Camera / MMAL through the addon.

    Here is an example of a setSaturation method in ofxCvPiCam;

    
    int ofxCvPiCam::setSaturation(int saturation){
        int ret = 0;
    
           if (!camera)
              return 1;
    
           if (saturation >= -100 && saturation <= 100)
           {
              MMAL_RATIONAL_T value = {saturation, 100};
              ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_SATURATION, value));
           }
           else
           {
              ofLogError("Invalid saturation value");
              ret = 1;
           }
    
           return ret;
    }

    How would I go about creating something like this?

        void ofxCvPiCam::setMode(int i) {
    
        // ???
    
        }

    Thanks,

    Gilbert

    #977
    mwlinder
    Keymaster

    I am not at all familiar with the ofxCvPiCam package, and so I’m afraid that I won’t be able to be very helpful. In general, if it works with the camera module, it will work equivalently using PiCapture (the Raspberry Pi can’t tell the difference).

    A couple of ideas:
    — generally, the “mode” would be established at the time the object is created. I don’t think that MMAL can deal with changing the resolution/camera mode after it is set during initialization. The “setup” method in the ofxCvPiCam example code (cam.setup) has parameters for width and height, and might be something to try
    — you might look at the source code for raspivid and see how it handles initialization of the camera.

    Please post the solution if you find it – there may be others that are interested in using this package. If you are stuck, I may be able to look at it in a week or so and try to help figure it out.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
gilbert.sinnottC++ / OpenFrameworks usage