Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You're right!

Here's the working code for future inquirers:

// Basic code for importing an image from a OWL 320 Camera into OpenCV.
// Special thanks for the essential part of the code to Berak of OpenCV forum. 
// Author: Vizier87

//EPIX Library
#include "windows.h"
#include "xcliball.h"


//OpenCV Library
#include <opencv2\highgui.hpp>
#include <opencv2\videoio.hpp>
#include <opencv2/opencv.hpp>

using namespace cv;
using namespace std;

Mat getPixels() {

    Mat img(pxd_imageYdim(), pxd_imageXdim(), pxd_imageCdim() == 1 ? CV_8UC1 : CV_8UC3);

    pxd_readuchar(0x1, 1, 0, 0, -1, -1, (uchar*)img.data,  // <-- here we pass allocated mem.
        pxd_imageXdim() * pxd_imageYdim() * pxd_imageCdim(),
        pxd_imageCdim() == 1 ? "Grey" : "RGB");

    return img;
}

int main() {

    pxd_PIXCIopen("", "Default", "");
    pxd_doSnap(0x1, 1, 0);


    imshow("test", getPixels());
    waitKey(0);
    pxd_PIXCIclose();

}