Real Time Image display

Hai,

I am new to SDL. I just started studying SDL. I want to display camera image (in RGB format) in my application. The camera is sending me the RGB values at 30 frames per second in 640x480 with 24 bit depth.
My Target is RedHat Linux 7.2 with XFree86 4.3.0
My requirement is to zoom the pixels and display it on portion of my screen. My Screen resolution is 1440x1200.

Is there any function to read the raw pixels instead of SDL_LoadBMP( ) ?

Will SDL help me to meet my requirement?

Can any one give me some reference site and code for this?.

With Thanks & Regards,
K.Suresh

Hi,

Hai,

I am new to SDL. I just started studying SDL. I want to display camera

image (in RGB format) in my application. The camera is sending me the RGB
values at 30 frames per second in 640x480 with 24 bit depth. My Target is
RedHat Linux 7.2 with XFree86 4.3.0
My requirement is to zoom the pixels and display it on portion of my
screen. My Screen resolution is 1440x1200.

Is there any function to read the raw pixels instead of SDL_LoadBMP( )

?
I suggest you look at SDL_CreateRGBSurfaceFrom.
Basically, this allows you to provide your own pixel buffer to create a
surface. This would allow you to do this:

  1. malloc the image buffer for the 640x480 24bit rgb pixel data coming from
    the camera
  2. Create a SDL_Surface using this buffer
  3. Grab an image from the camera
  4. Blit the SDL_Surface created in step 2 on the screen (or where it is
    needed)
  5. goto 3
Can any one give me some reference site and code for this?.

Here is the documentation for the SDL_CreateRGBSurfaceFrom

http://sdldoc.csn.ul.ie/sdlcreatergbsurfacefrom.phpOn Friday 09 April 2004 05:29 am, suresh wrote:

With Thanks & Regards,
K.Suresh


Regards,

Raphael Assenat
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040409/1513e79c/attachment.pgp

Thanks Raphael, I got success on displaying the images. My image size is
1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering issue on the
screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

  • K. Suresh

Yes there is doubblebuffering. When creating your videosurface use the flag SDL_DOUBLEBUF

/ Daniel----- Original Message -----
From: suresh
To: sdl at libsdl.org
Cc: raph at 8d.com
Sent: Saturday, April 10, 2004 3:08 PM
Subject: Re: [SDL] Real Time Image display

Thanks Raphael, I got success on displaying the images. My image size is
1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering issue on the
screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

  • K. Suresh

Thanks Raphael, I got success on displaying the images. My image size is
1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering issue on the
screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

  • K. Suresh

Thanks Raphael, I got success on displaying the images. My image size is
1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering issue on the
screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

  • K. Suresh> ----- Original Message -----

From: raph@8d.com (Raphael Assenat)
To:
Sent: Friday, April 09, 2004 6:42 PM
Subject: Re: [SDL] Real Time Image display

Yes - SDL_DOUBLEBUF. However, the implementation is highly target and
platform dependent. You’ll find that on many targets, it’s not
possible to get properly page flipped double buffering (with retrace
sync’ed flips, that is), because the drivers and/or related software
doesn’t implement it.

Not much you can do about that, unless you’re working with
custom/turnkey hardware (arcade machines or whatever), consoles or
something.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Saturday 10 April 2004 14.19, suresh wrote:

Thanks Raphael, I got success on displaying the images. My image
size is 1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering
issue on the screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

Thanks to all replies. I learnt that the usage of double buffering reduces
the frame rate. Still i am having the flicker. How can i overcome the
flicker in my image display.

suresh> ----- Original Message -----

From: david@olofson.net (David Olofson)
To:
Sent: Tuesday, April 13, 2004 8:27 PM
Subject: Re: [SDL] Real Time Image display

On Saturday 10 April 2004 14.19, suresh wrote:

Thanks Raphael, I got success on displaying the images. My image
size is 1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering
issue on the screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

Yes - SDL_DOUBLEBUF. However, the implementation is highly target and
platform dependent. You’ll find that on many targets, it’s not
possible to get properly page flipped double buffering (with retrace
sync’ed flips, that is), because the drivers and/or related software
doesn’t implement it.

Not much you can do about that, unless you’re working with
custom/turnkey hardware (arcade machines or whatever), consoles or
something.

file://David Olofson - Programmer, Composer, Open Source Advocate

…- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I think you’re doing something wrong…

Why would double buffering reduce your frame rate???
You’re drawing the same amound of stuff, you’re just
doing it on the back buffer…

Also, double buffering IS how you overcome flickering :wink:

Are you getting flickering (assuming your double buffering
works like it should) or are you getting tearing?

If you’re getting tearing you might want to look at your vsync
settings. Ideally you want your frame rate to be in sync
with your monitor’s refresh rate…

Hope that helps,
k.> ----- Original Message -----

From: suresh [mailto:suresh@hclp.com]
Sent: 21 April 2004 14:07
To: sdl at libsdl.org
Subject: Re: [SDL] Real Time Image display

Thanks to all replies. I learnt that the usage of double buffering reduces
the frame rate. Still i am having the flicker. How can i overcome the
flicker in my image display.

suresh

----- Original Message -----
From: david@olofson.net (David Olofson)
To:
Sent: Tuesday, April 13, 2004 8:27 PM
Subject: Re: [SDL] Real Time Image display

On Saturday 10 April 2004 14.19, suresh wrote:

Thanks Raphael, I got success on displaying the images. My image
size is 1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering
issue on the screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

Yes - SDL_DOUBLEBUF. However, the implementation is highly target and
platform dependent. You’ll find that on many targets, it’s not
possible to get properly page flipped double buffering (with retrace
sync’ed flips, that is), because the drivers and/or related software
doesn’t implement it.

Not much you can do about that, unless you’re working with
custom/turnkey hardware (arcade machines or whatever), consoles or
something.

file://David Olofson - Programmer, Composer, Open Source Advocate

…- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks kostas. I just started studying SDL for the past one week. I learnt
from the below link, double buffer reduced the frame rate. so not yet tried
with double buffer.
http://futuretech.mirror.vuurwerk.net/dbuffer.html

Is there any example code for the double buffer implementation in SDL. this
helps me a lot too. kindly anyone mail me the sample code or related links.

With Thanks & regards,
suresh> ----- Original Message -----

From: kos@climaxgroup.com (Kostas Kostiadis)
To:
Sent: Wednesday, April 21, 2004 7:03 PM
Subject: RE: [SDL] Real Time Image display

I think you’re doing something wrong…

Why would double buffering reduce your frame rate???
You’re drawing the same amound of stuff, you’re just
doing it on the back buffer…

Also, double buffering IS how you overcome flickering :wink:

Are you getting flickering (assuming your double buffering
works like it should) or are you getting tearing?

If you’re getting tearing you might want to look at your vsync
settings. Ideally you want your frame rate to be in sync
with your monitor’s refresh rate…

Hope that helps,
k.

-----Original Message-----
From: suresh [mailto:@suresh]
Sent: 21 April 2004 14:07
To: sdl at libsdl.org
Subject: Re: [SDL] Real Time Image display

Thanks to all replies. I learnt that the usage of double buffering reduces
the frame rate. Still i am having the flicker. How can i overcome the
flicker in my image display.

suresh

----- Original Message -----
From: “David Olofson”
To:
Sent: Tuesday, April 13, 2004 8:27 PM
Subject: Re: [SDL] Real Time Image display

On Saturday 10 April 2004 14.19, suresh wrote:

Thanks Raphael, I got success on displaying the images. My image
size is 1280x960. It takes 11 ms for displaying the image.

If I draw a new image over the ole image, I got some flickering
issue on the screen. How to overcome this?.

Any thing like double buffering support is there in SDL?.

Yes - SDL_DOUBLEBUF. However, the implementation is highly target and
platform dependent. You’ll find that on many targets, it’s not
possible to get properly page flipped double buffering (with retrace
sync’ed flips, that is), because the drivers and/or related software
doesn’t implement it.

Not much you can do about that, unless you’re working with
custom/turnkey hardware (arcade machines or whatever), consoles or
something.

file://David Olofson - Programmer, Composer, Open Source Advocate

…- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I think you’re doing something wrong…

Why would double buffering reduce your frame rate???

Because it allows SDL to use retrace sync’ed page flips when supported
by the driver. Without double buffering, SDL won’t even try to sync.

If the driver doesn’t support retrace sync, or it’s been disabled,
double buffering (provided it’s still h/w page flipping!) should
indeed have insignificant impact on performance.

You’re drawing the same amound of stuff, you’re just
doing it on the back buffer…

…but if you’re running in windowed mode, or on one of the targets
that cannot do h/w page flipping, SDL_Flip() has to do an extra
back->front blit.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 21 April 2004 15.33, Kostas Kostiadis wrote:

You can download the “Programming Linux Games” By John Hall at the
following location:

http://www.overcode.net/~overcode/writing/plg/

If you can spare the money, I would suggest buying the paperback
version. Still the electronic copy is a good resource for a beginner.

Of course there’s also the SDL documentation project, which is a good
resource as any.

http://sdldoc.csn.ul.ie/

There are also alot of other resources you’ll find on SDL’s home page,
just poke around abit.

http://www.libsdl.org/

Good luck, and I hope you have fun using SDL.

Best regards,

JuanOn Wed, 2004-04-21 at 07:33, suresh wrote:

Is there any example code for the double buffer implementation in SDL. this
helps me a lot too. kindly anyone mail me the sample code or related links.


I only fight for myself, and only love myself … that’s the only love I
need.