LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

JPEG in labwindows

I am looking to read and display a JPEG file in LabWindows. Is there an easy way to do this without buying anything? It would also be nice to be able to save a JPEG file.
Thanks in advance,
Dianne
0 Kudos
Message 1 of 11
(5,268 Views)
Guillaume Dargaud has created some nice graphics function panels for CVI.
http://www.gdargaud.net/Hack/LabWindows.html#Jpeg
Thanks Guillaume!
Attached are two of his functions panels. Here's a short sample on how to use them to display a JPG file on a canvas when a button is pressed to Display a JPG file.

int CVICALLBACK DisplayJPG (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int nNbChan;
unsigned char *ucBits;
int hBitmapID;
int nHeight;
int nWidth;
int nPixelDepth;
int nRowBytes;
int localErr;
switch (event)
{
case EVENT_COMMIT:
localErr = Jpg_GetProperties (&nRowBytes, &nPixelDepth, &nNbChan,
&nWidth, &nHeight, "my_jpeg.jpg");

localErr = Jpg_ReadBitmapF
romFile (&hBitmapID, &ucBits, &nRowBytes,
&nPixelDepth, &nWidth, &nHeight,
"my_jpeg.jpg");

localErr = CanvasDrawBitmap (panelHandle, PANEL_CANVAS, hBitmapID,
VAL_ENTIRE_OBJECT,
MakeRect(0,0,VAL_KEEP_SAME_SIZE,
VAL_KEEP_SAME_SIZE));

free(ucBits);
localErr = DiscardBitmap (hBitmapID);

break;
}
return 0;
}
Message 2 of 11
(5,266 Views)
To use the JPEG functions,
Add ReadSaveJpeg.lib to your project.
#include ReadSaveJpeg.h in your main C file.
0 Kudos
Message 3 of 11
(5,266 Views)
To use the JPEG function panels,
Add ReadSaveJpeg.fp to your project.
0 Kudos
Message 4 of 11
(5,266 Views)
Thank you so much for ALL the JPEG information.
It worked like a champ!
Dianne
0 Kudos
Message 5 of 11
(5,266 Views)
We can thank Guillaume for that.
I just got an evaluation copy of CVI 7.1. It has a new DisplayImageFile function which works with .pcx, .bmp, .dib, .rle, .ico, .jpg, and .wmf.
0 Kudos
Message 6 of 11
(5,266 Views)
I am using LabWindows/CVI 6.0 under Windows 2000/XP and communicating with a VxWorks client via 10Mbps ethernet connection.

I have a Windows application that accepts a byte array of data (via ethernet) that represents either JPEG or Motion JPEG images.

Each image is coming in at a 30Hz rate. Each image is 640x480x8bits large compressed (between 5/1 to 10/1 compression ratio via JPEG).

I do not have the time slot to (1) save the JPEG data to a file, (2) and then utilize Guillaume Dargaud's utility to read the file.

Is there a way to convert the JPEG image into an array input to NewBitmap()? Then I can load the to the Canvas, as I receive it.

Can anyone help?
0 Kudos
Message 7 of 11
(5,187 Views)
Hello.

With our IMAQ Vision Development Module you can easily take array data and transfer it into an image datatype. Then, with this image datatype you can display the image (on Image display windows with ROI tools, etc.) and perform processing on the images.

Hopefully this module is something that would fit your budget, as it sounds like it would help you out a lot.

Regards,
Colin C.
Applications Engineering
Colin Christofferson
Community Web Marketing
Blog
0 Kudos
Message 8 of 11
(5,158 Views)

Dear Colin ,

The "DisplayImage" function in NI vision Develop module will display the image in seprate window. Is there any method to display the image in the canvas or any other control available in CVI.

Regards,

Kumar.E

0 Kudos
Message 9 of 11
(4,748 Views)

@Al_S wrote:
To use the JPEG functions,
Add ReadSaveJpeg.lib to your project.
#include ReadSaveJpeg.h in your main C file.

Does anyone know if there's a 64-bit version of this lib yet?

0 Kudos
Message 10 of 11
(3,112 Views)