<< return to Pixycam.com

How to add Opencv lib and upload my c++ code ?

Hi friends
I am using CMUcam5 pixy in humanoid soccer robot. I write my c++ codes with opencv lib in Visual Studio software and get the results. But I need to upload my c++ codes on this hardware.
Please help me how I can add OpenCv lib and how to upload my C++ codes and run it in this camera ?
Thank you so much

Hello Simin,
It may be difficult to run your OpenCV code on Pixy. Pixy has 72K bytes of RAM available for grabbing images and 28K available for the heap. You may be able to rearrange some of the code to get a little more RAM, but this gives you an idea of some of the resource constraints.

What OpenCV code would you like to run on Pixy?

Edward

Dear Edward
thank you so much for your response.Now I am working with Visual Studio and at first step I want to get video from my camera and see the simple result like converting my colorful frames to gray frames. Then I will connect my camera to a micro. As I read e-book tutorial OpenCv if I change the input number in “VideoCapture cap(1);” I cann’t get the video. Should I use another lib ?

The simple code that I working on it now is as follows:

#include <opencv2/opencv.hpp>
#include // for standard I/O
#include // for strings
#include // for controlling float print precision
#include // string to number conversion
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O
using namespace std;
using namespace cv;

int main()
{
Mat img;
VideoCapture cap(1);

while (true)
{
    cap >> img;

    Mat edges;
    cvtColor(img, edges, CV_BGR2GRAY);

    Canny(edges, edges, 30, 60);

    imshow("window label", edges);
    waitKey(1);
}

return 0;

}

Hello Simin,
I’m not too familiar with OpenCV. You should ask your question on an OpenCV forum. Note that OpenCV is usually used with a web camera. Pixy does not have a standard web camera interface. Sorry…

Edward