LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

iplimage to picture control

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.

---
Silver_Shaper | CLD
0 Kudos
Message 1 of 3
(2,679 Views)

Any thoughts.............

---
Silver_Shaper | CLD
0 Kudos
Message 2 of 3
(2,634 Views)

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

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