Board index » delphi » TCanvas image start pointer for fast image filtering

TCanvas image start pointer for fast image filtering

Hello Programmer

I have a small Probelm ...

I will get the start adress from a Canvas so I can work with the
Pixels. The algorithm from the Canvas like Pixels(x,y) works to slow.

I have a Video Image at a 512*768 Pixels and will filtering it. The
filters are threshold, object finding routines and so on...

At my Programm I do it at this time with this code:

for y:=0 to maxY to
for x:=0 to maxY do
begin
  pix:=canvas.pixels[x,y];
  PixeltoRGB(pix:dwordf,r,g,b);
    //small ASM-routine for splitting color to r,g,b
    // filter
  RGBtoPixel(pix,r,g,b);
    //small ASM-routine for concat r,g,b to color
  canvas.pixels[x,y]:=pix;
end;

A special Version I have coded runs with a 4kByte Buffer. But
it is not faster then this.

Can you send me information to do this faster.

Thank you very mutch for helping

Daniel Ingmar Heuer

 

Re:TCanvas image start pointer for fast image filtering


Daniel Ingmar Heuer <dan...@speedy.ruhr.de> wrote in article
<347BF709.7582E...@speedy.ruhr.de>...

Quote
> I will get the start adress from a Canvas so I can work with the
> Pixels. The algorithm from the Canvas like Pixels(x,y) works to slow.

In Delphi 3 you can access the pixel array of an image (scanlines).
In earlier versions you'll have to use DIBs (device independant bitmaps).
There is a technical article on the Borland site (www.borland.com, go to
TechInfo) about printing the screen. This gives a good idea of how to use
DIBs. Also: see online help (w32) for CreateDibSection, SetDIBits and
GetDIBits.

Wim

Other Threads