Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, January 2007
Embed C program in QT graphics program


Message 1 in thread

I have a C program that captures composite video images, converts
them to jpg images, and store them in files for later viewing.
I would like to display the images directly without using files.
How much trouble am I likely to run into trying to embed the C
program functionality in a QT graphical environment?

Thanks,
Dave Feustel

--
 [ signature omitted ] 

Message 2 in thread

Hi,

Dave@xxxxxxxxxxxxx wrote:
> I have a C program that captures composite video images, converts
> them to jpg images, and store them in files for later viewing.
> I would like to display the images directly without using files.
> How much trouble am I likely to run into trying to embed the C
> program functionality in a QT graphical environment?

If you have access to the raw image data you should have no problems; 
put the data into a QImage and then display somehow e.g. on a QLabel.

Can you tell us what format the image data is in before you convert to jpg?

Tim

--
 [ signature omitted ] 

Message 3 in thread

Dave@xxxxxxxxxxxxx wrote:
> I have a C program that captures composite video images, converts
> them to jpg images, and store them in files for later viewing.
> I would like to display the images directly without using files.
> How much trouble am I likely to run into trying to embed the C
> program functionality in a QT graphical environment?
>
>   

I don't think you will have any problems making C calls from a C++ 
program, they are compatible languages.  If your image data can conform 
to one of QImage's types like RGB32 you can use the QImage(uchar* data, 
int width, int height, Format format) constructor.  QImage will not free 
that buffer so remember to do that yourself.

If  you use indexed colors be sure to use setColorTable() to set your 
color map.

Good Luck,
--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard


Message 4 in thread

On Fri, 26 Jan 2007 19:29:06 -0500
Justin Noel <justin@xxxxxxx> wrote:

> I don't think you will have any problems making C calls from a C++ 
> program, they are compatible languages.

not really: You should declare all the C "objects" (functions and
exported variables) as "C", because of the C++ name mangling.

extern "C" {
#include <mystuff.h>
};

--
 [ signature omitted ] 

Message 5 in thread

On 1/29/07, ing. Federico Fuga <fuga@xxxxxxxxxxxxxx> wrote:
> On Fri, 26 Jan 2007 19:29:06 -0500
> Justin Noel <justin@xxxxxxx> wrote:
>
> > I don't think you will have any problems making C calls from a C++
> > program, they are compatible languages.
>
> not really: You should declare all the C "objects" (functions and
> exported variables) as "C", because of the C++ name mangling.
>
> extern "C" {
> #include <mystuff.h>
> };
>
Thats only if you link against C library compiled using C compiler.
If, for example, you compile your C code inside your C++ enviroment,
no special treatment is needed.

-- 
 [ signature omitted ] 

Message 6 in thread

> Hi,
> 
> Dave@xxxxxxxxxxxxx wrote:
> > I have a C program that captures composite video images, converts
> > them to jpg images, and store them in files for later viewing.
> > I would like to display the images directly without using files.
> > How much trouble am I likely to run into trying to embed the C
> > program functionality in a QT graphical environment?
> 
> If you have access to the raw image data you should have no problems; 
> put the data into a QImage and then display somehow e.g. on a QLabel.
> 
> Can you tell us what format the image data is in before you convert to jpg?

The data is read in as composite video through a Brooktree chip and then
processed using JPEG library functions to produce jpg images.
 
> Tim

--
 [ signature omitted ] 

Message 7 in thread

Hi,

dfeustel@xxxxxxxxxxxxxx wrote:
>> Can you tell us what format the image data is in before you convert to jpg?
> 
> The data is read in as composite video through a Brooktree chip and then
> processed using JPEG library functions to produce jpg images.

So, what form is the data in just before passing to the jpeg library?

Tim

--
 [ signature omitted ]