09-13-2013 08:29 AM
Dear Guys,
While integration of opencv libraries in LabVIEW i had struck with this.. I can able to display the processed images in the window handle. i want to display it on the same iplimage(opencv image) to .NET Picture control or LabVIEW Picture in the front panel.. How can i do this. Can someone help me to sort out this issue...
Waiting for your reply.
09-17-2013 03:28 AM
Any thoughts.............
09-20-2013 06:29 AM
Hi
You can convert IplImage to Bitmap image to show in .Net Control or Convert IplImage to 2D array to display on to the Picture control of labview.
May this code will help you .
#include "extcode.h"
#include "cv.h" //main OpenCV header
#include "highgui.h" //GUI header
#pragma pack(1)
/*typedef struct {
uint8_t v1;
uint8_t v2;
uint8_t v3;
} TD2;
typedef struct {
int32_t dimSizes[2];
TD2 Cluster[1];
} TD1;
typedef TD1 **TD1Hdl;*/
typedef struct
{
char status;
int code;
uChar *source;
} er;
typedef struct {
int32_t dimSizes[2];
uint32_t elt[1];
} TD1;
typedef TD1 **TD1Hdl;
#include "lv_epilog.h"
#pragma pack()
_declspec(dllexport) void ColorImageToRGBHexArray( IplImage*a,TD1Hdl Pt,er *error);
_declspec(dllexport) void ColorImageToRGBHexArray( IplImage*a,TD1Hdl Pt,er *error)
{
if (!a)
{
error->code =-10002;
error->status=TRUE;
if (error->source == NULL)
{
error->code =1234;
}
else
{
}
}
else
{
if (a->nChannels == 3)
{
int R,G,B;
int i;
int j;
for(i=0;i<(a->height); i++)
{
for(j=0;j<(a->width);j++)
{
B=((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 0];
G =((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 1];
R =((uchar *)(a->imageData + i*a->widthStep))[j*a->nChannels + 2];
(*Pt)->elt[i*a->width +j] = R*65536 +G*256 +B;
}
}
}
else
{
error->code =-10003;
error->status=TRUE;
}
}
}
Warm Regard
Orooj Ahmed