Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Open Cv In Labview

Hi..

 

Greetings!!!!!

 

  I am very new in Imaging Processing in OpenCV and Visual Studio, I am trying to write Dll to call Open CV Funcition in labview.

I successful of calling Image through Open CV in labview through dll

 

 

#include "extcode.h"
#include "cv.h" //main OpenCV header
#include "highgui.h" //GUI header

int __declspec (dllexport) Thershold(char Imagepath[])
    {
IplImage*Img;
Img=cvLoadImage(Imagepath,1);
cvNamedWindow("PCB",2);
cvShowImage("PCB",Img);

return(Img->width);

 }

 

Data Structure of IplImage is

 

typedef struct _IplImage
{
    int  nSize;             /* sizeof(IplImage) */
    int  ID;                /* version (=0)*/
    int  nChannels;         /* Most of OpenCV functions support 1,2,3 or 4 channels */
    int  alphaChannel;      /* Ignored by OpenCV */
    int  depth;             /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
                               IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported.  */
    char colorModel[4];     /* Ignored by OpenCV */
    char channelSeq[4];     /* ditto */
    int  dataOrder;         /* 0 - interleaved color channels, 1 - separate color channels.
                               cvCreateImage can only create interleaved images */
    int  origin;            /* 0 - top-left origin,
                               1 - bottom-left origin (Windows bitmaps style).  */
    int  align;             /* Alignment of image rows (4 or 8).
                               OpenCV ignores it and uses widthStep instead.    */
    int  width;             /* Image width in pixels.                           */
    int  height;            /* Image height in pixels.                          */
    struct _IplROI *roi;    /* Image ROI. If NULL, the whole image is selected. */
    struct _IplImage *maskROI;      /* Must be NULL. */
    void  *imageId;                 /* "           " */
    struct _IplTileInfo *tileInfo;  /* "           " */
    int  imageSize;         /* Image data size in bytes
                               (==image->height*image->widthStep
                               in case of interleaved data)*/
    char *imageData;        /* Pointer to aligned image data.         */
    int  widthStep;         /* Size of aligned image row in bytes.    */
    int  BorderMode[4];     /* Ignored by OpenCV.                     */
    int  BorderConst[4];    /* Ditto.                                 */
    char *imageDataOrigin;  /* Pointer to very origin of image data
                               (not necessarily aligned) -
                               needed for correct deallocation */
}
IplImage;

 

I want to Pass pointer name (Img) ofIplImage through labview insted of writing Hard core ,

 

if any body have Idea to do the same Please give me suggesition to do the same.

 

 Warm Regards

 

Orooj Ahmed

 Email: orooj2k2@gmail.com

 

I

0 Kudos
Message 1 of 3
(4,478 Views)

Hi,

 

Probably this example will be helpful for you: Using OpenCV library in LabVIEW

Here IMAQ Image used in connection with OpenCV, but image transferred as pointer. 

 

Andrey.

 

0 Kudos
Message 2 of 3
(4,464 Views)

but i tried it so many times it gives me the error of    " call libarary function node.dll"   i dont know how to call the libraries in labview?

 i dont know how to create dll files and how to  upload in labview??

can you help me pleaze ??

thankyou in advance

0 Kudos
Message 3 of 3
(2,158 Views)