0

Dear members of stack overflow, hi:
I have just learned a little bit of opencv in VC++. Now, I faced a new problem:
I want to input my video frames from an EPIPHAN VGA2USB device. So, I installed the device drivers, downloaded its SDK, and opened one of its sample projects, named V2U, in Microsoft Visual Studio 2010. Using the SDK Release Notes.pdf, I added the line:

V2U_GrabFrame2* currFrame= FrmGrab_Frame(fg, V2U_GRABFRAME_FORMAT_RGB16, NULL);

to the main function of it (fg is a frame grabber object and FrmGrab_Frame, according to the pdf, returns a frame). The type V2U_GrabFrame2 is defined as:

typedef struct ioctl_grabframe2 {
#define V2U_GrabFrame2_Fields(pointer) \
    pointer     pixbuf;     /* IN  should be filled by user process */\
    V2U_UINT32  pixbuflen;  /* IN  should be filled by user process */\
    V2U_UINT32  palette;    /* IN pixel format */\
    V2URect     crop;       /* IN/OUT cropping area; all zeros = full frame */\
    V2U_VideoMode mode;     /* OUT VGA mode */\
    V2U_UINT32  imagelen;   /* OUT size of the image stored in pixbuf */\
    V2U_INT32   retcode;    /* OUT return/error code */
    V2U_GrabFrame2_Fields(void*)
} V2U_PACKED V2U_GrabFrame2, V2UGrabFrame2;

in a header file. I may have to create a cv::Mat object from the info in currFrame, so that I can process it using opencv tools. Would anyone share a similar experience that can help a real beginner, please?!

Roohollah
  • 1
  • 1
  • Get the width, height and type (8/16 bit, RGB/BGR, greyscale) of your Epiphan image and create an OpenCV `Mat` of the same size. Work out how the pixels are organised in your Epiphan image and copy them across into the `data` pointer of the `Mat`. I expect it will be similar to this... http://stackoverflow.com/a/41847887/2836621 – Mark Setchell Feb 21 '17 at 09:02
  • Or lookup the format of your Epiphan image buffer and add it to your question and see if some kind soul helps. – Mark Setchell Feb 21 '17 at 09:05
  • Dear Mark, thanks. – Roohollah Feb 21 '17 at 10:40
  • I did your second recommendation and am going to do the first one. – Roohollah Feb 21 '17 at 10:55
  • As you're clearly a beginner, it would help to experiment. You probably shouldn't aim to get the image directly from camera to OpenCV. Instead, write code to get the image from camera to .BMP file, and a second test to get from .BMP file to OpenCV. Finally, cut out the .BMP file in the middle. Why? So you can _see_ the image you're working on. – MSalters Feb 21 '17 at 14:00
  • Dear MSalters, thanks. – Roohollah Feb 21 '17 at 15:18

0 Answers0