Click to See Complete Forum and Search --> : Image Compression for Data Transfer
lonestarcomps
Feb 24th, 2006, 12:34 PM
I'm not sure if this is the right section to post this in, but I guess it's as good as any.
I want to compress a webcam image to transfer it over the p2p network I'm designing, although I'm not sure of the best mothod to accomplish this. It would have to be a reversable compression, so the image can be exploded into a readable format after transfer. Any ideas?
the182guy
Feb 24th, 2006, 12:44 PM
how about put it in a zip file and send that, then unzip it at other end
the182guy
Feb 24th, 2006, 12:46 PM
What type of image file is it? if its jpg or gif they should be fairly small anyway
lonestarcomps
Feb 24th, 2006, 01:21 PM
I was thinking Jpeg, But it's for a webcam. If I don't buffer the images somehow It'll be choppy doing zip decompression (although methinks I might try zip anyway)
the182guy
Feb 24th, 2006, 05:16 PM
Why will it be choppy?
lonestarcomps
Feb 24th, 2006, 05:33 PM
In theory, because of the time it takes to decompress the image and display it prior to a new frame arriving. (unless they are buffered)
the182guy
Feb 24th, 2006, 05:40 PM
Ah I see, so your getting the image from the webcam and sending it to remote side? For this I would try a socket using the UDP (user datagram protocol) where theres no connection required, it will be a lot quicker than TCP so it will look smoother
lonestarcomps
Feb 24th, 2006, 05:43 PM
but the thing is, each of the clients in the program are issued a session id (and I do this so the program doesn't end up like Y!Messenger back in early 02') upon logging in, so i think it has to be connection dependant protocol. I dunno, but I do appreciate your thoughts on this matter.
szlamany
Feb 24th, 2006, 06:56 PM
Compression is part of almost all image protocols - you should not want to compress the file but instead select a compression scheme with the image datatype you are using and understand what that will give you...
Lossy compression - not lossy compression - many, many factors.
the182guy
Feb 24th, 2006, 08:02 PM
I wouldnt use any compression, I would just transfer the raw file, if you compress each frame before sending, then decompress at the client before showing, it will be slow and laggy/choppy. There shouldnt be a problem with the file size as its fairly small for a web cam viewer image anyway.
do you save the image to a disk before sending? or does it literally just grab the image from the cam
lonestarcomps
Feb 25th, 2006, 09:01 AM
exactly, that is what I had predicted would happen. I guess I will just send raw image data, although I was hoping to improve on the looks of the low-speed connection webcam users. Oh well, if it works it works.
the182guy
Feb 25th, 2006, 10:47 AM
For the low speed users, cant you grab a smaller resolution/lower quality image from the webcam, which will speed it up?
lonestarcomps
Feb 25th, 2006, 10:48 AM
well yah, that's the normal method - but that is kind of what I was trying to avoid. <shrugz>
szlamany
Feb 25th, 2006, 10:57 AM
Which was exactly my point...
Select a level of compression that is part processing the image.
Usually you cannot get "smaller" image data by compressing with something like zip. Usually to get smaller image data you need to sacrifice something - quality - color levels...
lonestarcomps
Feb 25th, 2006, 11:00 AM
Right on. Which image compression would you suggest?
szlamany
Feb 25th, 2006, 11:06 AM
What gets exposed to you when you read the image in VB? Are you using API or DLL calls that came with the webcam?
What is the make of the webcam?
the182guy
Feb 26th, 2006, 10:36 AM
I dont understand why you dont just send the raw jpeg data by the time its endoded the entire file in a compression system, then decoded at the other end, it will of defeated the purpose of using compression since the file probably could of been sent without compression quicker than with it
lonestarcomps
Feb 27th, 2006, 03:46 PM
You're probably right, although I think i'm going to give the dial-up clients the ability to buffer their images a few seconds with higher res images, or if not use lower res with no buffering. Dunno, that's why I posted the question here. Looking for the best method to accomplish this task, since it's my first attempt at streaming images between clients.
the182guy
Feb 27th, 2006, 07:28 PM
Yea i would try what you said and see if it is suitable
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.