robopo

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Raspicam example not working #7311
    robopo
    Participant

    I am totally unable to get the raspicam to work using VisualGDB. I have the raspicam installed on the Raspberry Pi as a dynamic library according to its initial install instructions. While in Raspberry Pi – using a text editor and compiling and linking from the command line – I can get things working. Can you please show how to do the same using VisualGDB? I’m sure this could be an example other RPi  cross compile wannabes would like to see too.

    Even with VisualGDB I’d rather use the my own build instructions if possible as those I can understand (without reading first a book about makefiles) and which are easy to use put in script file/s.  The compiling could happen on RPi but rather on the PC, I would like to see both versions.

    As far as I can see my sysroot is a copy of the RPi lib folders containing all the necessary files in same folders. This  is my  compiling command line on RPi, the folder name is /wicam and the source filename “wicam.cpp”:

    g++ -std=c++11 -I/usr/local/lib -I/usr/lib -I/usr/local/include/raspicam -c /home/pi/projects/wicam/wicam.cpp -o /home/pi/projects/wicam/wicam.o

    and this one does the linking:

    g++ -L/usr/local/lib/ -o /home/pi/projects/wicam/wicam /home/pi/projects/wicam/wicam.o /usr/local/lib/libraspicam.so -lwiringPi

    The source “wicam.cpp” is a combined and modified example of the wiringPi example and a raspicam example:

    /*********************************
    wicam.cpp
    *********************************/

    #include <fstream>
    #include <iostream>
    #include <vector>
    #include <unistd.h>
    #include <raspicam.h>
    #include <wiringPi.h>

    using namespace std;

    int main(int argc, char **argv)
    {

    //testing wiringPi library access

    int wiringPiSetup (void);
    pinMode (0, OUTPUT);

    for (int i = 0; i<10;i++)
    {
    digitalWrite (0, HIGH); delay (500);
    digitalWrite (0,  LOW); delay (500);
    std::cout <<” looping” << std::endl;
    }

    // testing the raspicam lib access

    raspicam::RaspiCam camera;

    if (!camera.open())
    {
    cerr << “Could not open the camera” << endl;
    return 1;
    }

    cout << “Initial delay…” << endl;
    sleep(3);
    cout << “Acquiring image…” << endl;
    camera.grab();

    std::vector<unsigned char> buf;
    buf.resize(camera.getImageTypeSize(raspicam::RASPICAM_FORMAT_RGB));
    camera.retrieve(buf.data(), raspicam::RASPICAM_FORMAT_RGB);
    std::ofstream outFile(“output.ppm”, std::ios::binary);
    outFile << “P6\n” << camera.getWidth() << ” ” << camera.getHeight() << ” 255\n”;
    outFile.write((char*)buf.data(), buf.size());

    cout << “Image saved to output.ppm” << endl;
    return 0;
    }

    I hope you have the time for this. If I can’t get things working using VisualGDB I have to try something else.

    Thanks

     

     

    in reply to: Raspicam example not working #7305
    robopo
    Participant

    IMHO it would be better if the raspicam library is installed as a shared/dynamic library in the normal RPi library directory the way the install of the library itself does. I don’t see any good reason why not. Your wiringPi example uses the install provided by the library itself and installs it as a shared library in the standard library path, very clear, why not with raspicam as well.

    I have the cam working on the RPi now and compile stuff on the console. I’m now trying to get the cross compiling for raspicam to work using the same approach you have used in the wiringPi example, but the problem is that VisualGDB has no help system (?) which makes it very hard and time wasting to try to finding out on your own what to do.

    BTW. I think you could probably get a lot of friends if you made the VisualGDB available for QtCreator both Windows and Linux. These days I don’t use my VS2013 almost at all but now for VisualGDB only.

    in reply to: Raspicam example not working #7290
    robopo
    Participant

    I think the Raspicam example can actually never work. Considering the Raspicam-0.1.3 instructions how the library should be built manually on the RPi, I think this example will never install the camera’s dynamic library  correctly on the appropriate folders or set the environmental parameters correctly on RPi. Maybe the creator of this example already had the library installed and that is how he assumed it works. I spent a lot of hours with this.  🙁

    in reply to: Raspicam example not working #7279
    robopo
    Participant

    PS. When I install the include directories and Library directories to CisualGDB Projet Properties the testing won’t fall thru but says: Tool arguments: /tmp/VisualGDB_ToolchainTestProgram_deployed: error while loading shared libraries: libraspicam.so.0.0: cannot open shared object file: no such file or directory.

    I have tried to maually copy the library to RPi but that won’t help.

Viewing 4 posts - 1 through 4 (of 4 total)