 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dave Guest
|
Posted: Sat Feb 04, 2006 2:36 am Post subject: Using the difference in an image |
|
|
Hi
I need to implement some screen viewing functionality into my client server app. It will involve allowing the user on one machine to be able to allow upto 30 users on other machines in a LAN to 'view' their desktop, for demonstration purposes. Although there are plenty of 3rd party apps already doing this, I need the functionality built into mine!
The big problem to overcome seems to be the potential lag that will result in constantly sending the whole grabbed image.
My initial research has led me to believe that the best way to achieve this is to send the one full screen capture, grab another screen capture, and by comparing with the previous capture, transmit the differences only.
However, although I have found examples of comparing images using scanline, they normally return a true or false. How would I go about aquiring the 'difference' and re-creating the new image from the old image plus the difference?
Thanks for any help given
D |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Sat Feb 04, 2006 7:10 am Post subject: Re: Using the difference in an image |
|
|
Hi Dave,
You can go to the pixel level with the differences, so only send over pixels
that are different. One way to do this is to send the delta image (B - A).
The delta image will contain zeroes wherever B=A. You could use RLE encoding
to avoid sending large numbers of zeroes. You can also use some kind of PNG
encoding on the delta image, it will automatically also crunch the zeroes.
Another option is to divide the image in a lot of small blocks (eg. 16x16
pixels) and only send over blocks that contain differences (and a list of
block numbers with differences).
Hope that helps, Nils
"Dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e3db06$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Hi
I need to implement some screen viewing functionality into my client
server app. It will involve allowing the user on one machine to be able to
allow upto 30 users on other machines in a LAN to 'view' their desktop,
for demonstration purposes. Although there are plenty of 3rd party apps
already doing this, I need the functionality built into mine!
The big problem to overcome seems to be the potential lag that will result
in constantly sending the whole grabbed image.
My initial research has led me to believe that the best way to achieve
this is to send the one full screen capture, grab another screen capture,
and by comparing with the previous capture, transmit the differences only.
However, although I have found examples of comparing images using
scanline, they normally return a true or false. How would I go about
aquiring the 'difference' and re-creating the new image from the old image
plus the difference?
Thanks for any help given
D
|
|
|
| Back to top |
|
 |
dave Guest
|
Posted: Sat Feb 04, 2006 4:02 pm Post subject: Re: Using the difference in an image |
|
|
Hi
Cheers That was a stupid mistake. I think I also had a problem due to my pixelformat not being pf32bit. The original image was only 24bit.
Thanks again
"Nils Haeck" <bla (AT) bla (DOT) com> wrote:
| Quote: | You set the width and the height of the delta image from the original
*before* you've loaded the original, so it will be set to zero. Of course
then it goes wrong.
Nils
"dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e4b096$1 (AT) newsgroups (DOT) borland.com...
Hi
I've been looking for examples of how to implement a delta image as you
suggested, but have had little luck. I tried combining a few examples i
found to produce a test project.
So I've been trying to implement the delta image by:
procedure TForm1.Button3Click(Sender: TObject);
var
x,row : Integer;
original,new,delta : TBitMap;
PtrOrigRow,PtrNewRow : PByte;
y : Integer;
LineO,lineN,LineD : PRGB32Array;
begin
// PixelFormat := pf32bit;
original := TBitMap.create;
new:= TBitMap.create;
delta:= TBitMap.create;
delta.PixelFormat:=original.PixelFormat;
delta.Width:=original.Width;
delta.Height:=original.Height;
try
original.LoadFromFile('C:\Program Files\Common Files\Borland
Shared\Images\Splash\256color\factory.bmp');
new.LoadFromFile('C:\Program Files\Common Files\Borland
Shared\Images\Splash\256color\factory1.bmp');
Canvas.Draw(0,0,original);
canvas.Draw(400,0,new);
for y := 0 to original.Height - 1 do
begin
LineO := original.Scanline[y];
LineN := new.Scanline[y];
LineD:=delta.ScanLine[y];
for x := 0 to Width - 1 do
begin
LineD[x].B:=LineN[x].B -LineO[x].B;
LineD[x].G:=LineN[x].G -LineO[x].G;
LineD[x].R:=LineN[x].R -LineO[x].R;
LineD[x].A:=LineN[x].A -LineO[x].A;
end;
end;
Canvas.Draw(200,400,delta);
finally
Canvas.Draw(200,400,delta);
original.Free;
new.Free;
delta.Free;
end;
end;
However this causes an exception error at line:
LineD:=delta.ScanLine[y];
Can you point out where I am going wrong?
Many thanks
Pete
"Nils Haeck" <bla (AT) bla (DOT) com> wrote:
Hi Dave,
You can go to the pixel level with the differences, so only send over
pixels
that are different. One way to do this is to send the delta image (B - A).
The delta image will contain zeroes wherever B=A. You could use RLE
encoding
to avoid sending large numbers of zeroes. You can also use some kind of
PNG
encoding on the delta image, it will automatically also crunch the zeroes.
Another option is to divide the image in a lot of small blocks (eg. 16x16
pixels) and only send over blocks that contain differences (and a list of
block numbers with differences).
Hope that helps, Nils
"Dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e3db06$1 (AT) newsgroups (DOT) borland.com...
Hi
I need to implement some screen viewing functionality into my client
server app. It will involve allowing the user on one machine to be able
to
allow upto 30 users on other machines in a LAN to 'view' their desktop,
for demonstration purposes. Although there are plenty of 3rd party apps
already doing this, I need the functionality built into mine!
The big problem to overcome seems to be the potential lag that will
result
in constantly sending the whole grabbed image.
My initial research has led me to believe that the best way to achieve
this is to send the one full screen capture, grab another screen
capture,
and by comparing with the previous capture, transmit the differences
only.
However, although I have found examples of comparing images using
scanline, they normally return a true or false. How would I go about
aquiring the 'difference' and re-creating the new image from the old
image
plus the difference?
Thanks for any help given
D
|
|
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Sat Feb 04, 2006 4:02 pm Post subject: Re: Using the difference in an image |
|
|
You set the width and the height of the delta image from the original
*before* you've loaded the original, so it will be set to zero. Of course
then it goes wrong.
Nils
"dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e4b096$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Hi
I've been looking for examples of how to implement a delta image as you
suggested, but have had little luck. I tried combining a few examples i
found to produce a test project.
So I've been trying to implement the delta image by:
procedure TForm1.Button3Click(Sender: TObject);
var
x,row : Integer;
original,new,delta : TBitMap;
PtrOrigRow,PtrNewRow : PByte;
y : Integer;
LineO,lineN,LineD : PRGB32Array;
begin
// PixelFormat := pf32bit;
original := TBitMap.create;
new:= TBitMap.create;
delta:= TBitMap.create;
delta.PixelFormat:=original.PixelFormat;
delta.Width:=original.Width;
delta.Height:=original.Height;
try
original.LoadFromFile('C:\Program Files\Common Files\Borland
Shared\Images\Splash\256color\factory.bmp');
new.LoadFromFile('C:\Program Files\Common Files\Borland
Shared\Images\Splash\256color\factory1.bmp');
Canvas.Draw(0,0,original);
canvas.Draw(400,0,new);
for y := 0 to original.Height - 1 do
begin
LineO := original.Scanline[y];
LineN := new.Scanline[y];
LineD:=delta.ScanLine[y];
for x := 0 to Width - 1 do
begin
LineD[x].B:=LineN[x].B -LineO[x].B;
LineD[x].G:=LineN[x].G -LineO[x].G;
LineD[x].R:=LineN[x].R -LineO[x].R;
LineD[x].A:=LineN[x].A -LineO[x].A;
end;
end;
Canvas.Draw(200,400,delta);
finally
Canvas.Draw(200,400,delta);
original.Free;
new.Free;
delta.Free;
end;
end;
However this causes an exception error at line:
LineD:=delta.ScanLine[y];
Can you point out where I am going wrong?
Many thanks
Pete
"Nils Haeck" <bla (AT) bla (DOT) com> wrote:
Hi Dave,
You can go to the pixel level with the differences, so only send over
pixels
that are different. One way to do this is to send the delta image (B - A).
The delta image will contain zeroes wherever B=A. You could use RLE
encoding
to avoid sending large numbers of zeroes. You can also use some kind of
PNG
encoding on the delta image, it will automatically also crunch the zeroes.
Another option is to divide the image in a lot of small blocks (eg. 16x16
pixels) and only send over blocks that contain differences (and a list of
block numbers with differences).
Hope that helps, Nils
"Dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e3db06$1 (AT) newsgroups (DOT) borland.com...
Hi
I need to implement some screen viewing functionality into my client
server app. It will involve allowing the user on one machine to be able
to
allow upto 30 users on other machines in a LAN to 'view' their desktop,
for demonstration purposes. Although there are plenty of 3rd party apps
already doing this, I need the functionality built into mine!
The big problem to overcome seems to be the potential lag that will
result
in constantly sending the whole grabbed image.
My initial research has led me to believe that the best way to achieve
this is to send the one full screen capture, grab another screen
capture,
and by comparing with the previous capture, transmit the differences
only.
However, although I have found examples of comparing images using
scanline, they normally return a true or false. How would I go about
aquiring the 'difference' and re-creating the new image from the old
image
plus the difference?
Thanks for any help given
D
|
|
|
| Back to top |
|
 |
dave Guest
|
Posted: Sat Feb 04, 2006 4:02 pm Post subject: Re: Using the difference in an image |
|
|
Hi
I've been looking for examples of how to implement a delta image as you suggested, but have had little luck. I tried combining a few examples i found to produce a test project.
So I've been trying to implement the delta image by:
procedure TForm1.Button3Click(Sender: TObject);
var
x,row : Integer;
original,new,delta : TBitMap;
PtrOrigRow,PtrNewRow : PByte;
y : Integer;
LineO,lineN,LineD : PRGB32Array;
begin
// PixelFormat := pf32bit;
original := TBitMap.create;
new:= TBitMap.create;
delta:= TBitMap.create;
delta.PixelFormat:=original.PixelFormat;
delta.Width:=original.Width;
delta.Height:=original.Height;
try
original.LoadFromFile('C:\Program Files\Common Files\Borland Shared\Images\Splash\256color\factory.bmp');
new.LoadFromFile('C:\Program Files\Common Files\Borland Shared\Images\Splash\256color\factory1.bmp');
Canvas.Draw(0,0,original);
canvas.Draw(400,0,new);
for y := 0 to original.Height - 1 do
begin
LineO := original.Scanline[y];
LineN := new.Scanline[y];
LineD:=delta.ScanLine[y];
for x := 0 to Width - 1 do
begin
LineD[x].B:=LineN[x].B -LineO[x].B;
LineD[x].G:=LineN[x].G -LineO[x].G;
LineD[x].R:=LineN[x].R -LineO[x].R;
LineD[x].A:=LineN[x].A -LineO[x].A;
end;
end;
Canvas.Draw(200,400,delta);
finally
Canvas.Draw(200,400,delta);
original.Free;
new.Free;
delta.Free;
end;
end;
However this causes an exception error at line:
LineD:=delta.ScanLine[y];
Can you point out where I am going wrong?
Many thanks
Pete
"Nils Haeck" <bla (AT) bla (DOT) com> wrote:
| Quote: | Hi Dave,
You can go to the pixel level with the differences, so only send over pixels
that are different. One way to do this is to send the delta image (B - A).
The delta image will contain zeroes wherever B=A. You could use RLE encoding
to avoid sending large numbers of zeroes. You can also use some kind of PNG
encoding on the delta image, it will automatically also crunch the zeroes.
Another option is to divide the image in a lot of small blocks (eg. 16x16
pixels) and only send over blocks that contain differences (and a list of
block numbers with differences).
Hope that helps, Nils
"Dave" <deepthinker (AT) btinternet (DOT) com> schreef in bericht
news:43e3db06$1 (AT) newsgroups (DOT) borland.com...
Hi
I need to implement some screen viewing functionality into my client
server app. It will involve allowing the user on one machine to be able to
allow upto 30 users on other machines in a LAN to 'view' their desktop,
for demonstration purposes. Although there are plenty of 3rd party apps
already doing this, I need the functionality built into mine!
The big problem to overcome seems to be the potential lag that will result
in constantly sending the whole grabbed image.
My initial research has led me to believe that the best way to achieve
this is to send the one full screen capture, grab another screen capture,
and by comparing with the previous capture, transmit the differences only.
However, although I have found examples of comparing images using
scanline, they normally return a true or false. How would I go about
aquiring the 'difference' and re-creating the new image from the old image
plus the difference?
Thanks for any help given
D
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|