[vwnc] Displaying images from a video stream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Displaying images from a video stream

Danny Chan
Hi!
As someone relatively new at Smalltalk I am currently having a look at
VisualWorks and am quite pleased with what I've seen so far. I am actually
thinking of trying to convince my management at work to replace an aging
application for testing and developing camera modules with something written in
Smalltalk. The current application was written in C++ by someone who thought C
is all you need, C++ is as high level as a language can be, and debuggers and
profilers are only for people who cannot code. Consequently, things like
functions with > 4000 lines are the usual coding style. I am therefore trying to
sort out a few questions that I expect the management people, and, even harder
to convince, the other developers, to ask when I bring up the suggestion. I have
looked at DLLCC and found it fully sufficient for the task, and I have also
looked at the GUI development possibilities. This is all relatively
straightforward and does not seem to pose a big problem. I have hit a wall
however when trying to load a raw image from one of our cameras and trying to
display it in a GUI window. I followed the examples in the App developers guide
and managed to load a ByteArray containing image data into an Image object and
displaying it. It is, however, much too slow to be able to achieve a frame rate
compatible with live streaming of VGA 16 bit images at a rate of 30
frames/seconds. I've read the note that Pixmaps are preferred to Image objects
for high performance displaying, but how do I get my data into the Pixmap
without going through an Image? Or is this the wrong way and I have to do
something completely different?

By the way, is using the non-commercial distribution ok for something like this,
or do I have to get something like an evaluation license? I haven't found
anything like this on Cincom's home page, and since at the moment this is a
purely private project that can hopefully spawn a commercial project later on I
had the impression that using the non-commercial version is ok.

Thanks,
Danny

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Displaying images from a video stream

Joachim Geidel
Danny Chan schrieb am 08.03.2008 20:30:

> I have hit a wall
> however when trying to load a raw image from one of our cameras and trying to
> display it in a GUI window. I followed the examples in the App developers guide
> and managed to load a ByteArray containing image data into an Image object and
> displaying it. It is, however, much too slow to be able to achieve a frame rate
> compatible with live streaming of VGA 16 bit images at a rate of 30
> frames/seconds. I've read the note that Pixmaps are preferred to Image objects
> for high performance displaying, but how do I get my data into the Pixmap
> without going through an Image? Or is this the wrong way and I have to do
> something completely different?

Images are relatively slow because they encapsulate all the logic
necessary for dealing with different palettes and color depths. E.g., if
the color depth of the screen does not match the color depth of the
image, the Image will be converted before displaying it. This uses a
Smalltalk implementation which in the worst case computes the new pixel
values from the old ones pixel by pixel.

Using Pixmaps speeds up graphics operations when an application composes
graphics output with many single operations, like drawing lines,
rectangles etc. In this case, it is faster to draw everything on a
Pixmap and copy the Pixmap to the Screen at the end. As the class
comment of Pixmap states: "This is especially helpful when the
assemblage needs to be redisplayed multiple times." Using a Pixmap to
display an Image helps when the image has to be displayed repeatedly,
because in this case the conversions between pixel depths and palettes
are done only once. If an Image is displayed only once, I think that a
Pixmap will not help. It is not possible to set the pixels of a Pixmap
directly.

An alternative might be to use native bitmap functions or a graphics
library like Cairo to display the images. If the application runs on
Windows, you could get the device context handle for the window you are
drawing on, and use GDI bitmap functions to draw directly on the screen.
You would have to write an interface for those functions using DLLCC. I
think that ensuring a constant frame rate, scrolling and scaling may be
challenging too, if you have to do everything yourself. After all, this
amounts to writing a movie player, doesn't it?

You could also create a temporary movie file from the bitmaps, and
render it using an external movie player. This would make rendering
speed independent of the speed of the camera's interface, and ensure
that you get fast output with a constant frame rate. I found example
programs generating movie files in C++ on Windows at
http://www.geocities.com/krishnapg/createmovie.html

> By the way, is using the non-commercial distribution ok for something like this,
> or do I have to get something like an evaluation license? I haven't found
> anything like this on Cincom's home page, and since at the moment this is a
> purely private project that can hopefully spawn a commercial project later on I
> had the impression that using the non-commercial version is ok.

This should be okay. There are no evaluation licences. You have to buy a
commercial licence once you start earning money with a VisualWorks based
product, or use it in production in a commercial setting, or if you need
technical support from Cincom Systems. Disclaimer: This is my
understanding of the licence, not necessarily Cincom's, and I am not a
lawyer. ;-)

Best regards,
Joachim Geidel
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc