Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with IPL image and imshow

Hi I want to show an IPL image created but with imshow I am having problems, I was searching how to solve that error but I didn't find anything.... so if someone could help me I would be very please. I am in a raspberry pi, using opencv 3.0.0 I know is better use Mat know but I didnt know hot to convert an Image captured by other API to a Mat object and not and IPL

#include <uEye.h>
#include <ueye_deprecated.h>
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
rest of code

if(is_FreezeVideo(hCam, IS_WAIT) == IS_SUCCESS){
        void *pMemVoid; //pointer to where the image is stored
        is_GetImageMem (hCam, &pMemVoid);
        IplImage * img;
        img=cvCreateImage(cvSize(img_width, img_height), IPL_DEPTH_8U, 3); 
        img->nSize=112;
        img->ID=0;
        img->nChannels=3;
        img->alphaChannel=0;
        img->depth=8;
        img->dataOrder=0;
        img->origin=0;
        img->align=4;
        img->width=img_width;
        img->height=img_height;
        img->roi=NULL;
        img->maskROI=NULL;
        img->imageId=NULL;
        img->tileInfo=NULL;
        img->imageSize=3*img_width*img_height;
        img->imageData=(char*)pMemVoid;  //the pointer to imagaData
        img->widthStep=3*img_width;
        img->imageDataOrigin=(char*)pMemVoid; //and again
        //now you can use your img just like a normal OpenCV image
        namedWindow( "A", 1 );
        cv::imshow("A",img);
        waitKey(0);
   }
  rest of code
}

Problem with IPL image and imshow

Hi I want to show an IPL image created but with imshow I am having problems, I was searching how to solve that error but I didn't find anything.... so if someone could help me I would be very please. I am in a raspberry pi, using opencv 3.0.0 I know is better use Mat know but I didnt know hot to convert an Image captured by other API to a Mat object and not and IPL

#include <uEye.h>
#include <ueye_deprecated.h>
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
rest of code

if(is_FreezeVideo(hCam, IS_WAIT) == IS_SUCCESS){
        void *pMemVoid; //pointer to where the image is stored
        is_GetImageMem (hCam, &pMemVoid);
        IplImage * img;
        img=cvCreateImage(cvSize(img_width, img_height), IPL_DEPTH_8U, 3); 
        img->nSize=112;
        img->ID=0;
        img->nChannels=3;
        img->alphaChannel=0;
        img->depth=8;
        img->dataOrder=0;
        img->origin=0;
        img->align=4;
        img->width=img_width;
        img->height=img_height;
        img->roi=NULL;
        img->maskROI=NULL;
        img->imageId=NULL;
        img->tileInfo=NULL;
        img->imageSize=3*img_width*img_height;
        img->imageData=(char*)pMemVoid;  //the pointer to imagaData
        img->widthStep=3*img_width;
        img->imageDataOrigin=(char*)pMemVoid; //and again
        //now you can use your img just like a normal OpenCV image
        namedWindow( "A", 1 );
        cv::imshow("A",img);
        waitKey(0);
   }
  rest of code
}

Error is the next:

$ g++ -Wall -I/usr/lib -o main main.cpp -lueye_api
main.cpp: In function 'int main(int, char**)':
main.cpp:100:31: error: no matching function for call to 'imshow(const char [2], IplImage*&)'
main.cpp:100:31: note: candidates are:
/usr/local/include/opencv2/highgui.hpp:305:19: note: void cv::imshow(const cv::String&, cv::InputArray)
/usr/local/include/opencv2/highgui.hpp:305:19: note:   no known conversion for argument 2 from        'IplImage* {aka _IplImage*}' to 'cv::InputArray {aka const cv::_InputArray&}'
/usr/local/include/opencv2/highgui.hpp:488:17: note: void cv::imshow(const cv::String&, const     cv::ogl::Texture2D&)
/usr/local/include/opencv2/highgui.hpp:488:17: note:   no known conversion for argument 2 from 'IplImage* {aka _IplImage*}' to 'const cv::ogl::Texture2D&'