manipulating JPEG images

Discussion in 'Perl Misc' started by George, Mar 14, 2006.

  1. George

    George Guest

    Murray R. Van Luyn wrote:
    > For an assignment I'm required to find out how to remove camera shake from
    > JPEG images using Perl.
    >
    > I'm stumped! I'm not after a solution, but would really appreciate direction
    > to sources of information that may help me to figure out how to accomplish
    > this task.


    the FAQ can point you into the right direction, in particular
    perlfaq2.pod:
    "What modules and extensions are available for Perl? What is CPAN?
    What does CPAN/src/... mean?"
     
    George, Mar 14, 2006
    #1
    1. Advertising

  2. George

    Guest

    George <> wrote:
    > Murray R. Van Luyn wrote:
    >> For an assignment I'm required to find out how to remove camera shake from
    >> JPEG images using Perl.


    >> I'm stumped! I'm not after a solution, but would really appreciate direction
    >> to sources of information that may help me to figure out how to accomplish
    >> this task.


    > the FAQ can point you into the right direction, in particular
    > perlfaq2.pod:
    > "What modules and extensions are available for Perl? What is CPAN?
    > What does CPAN/src/... mean?"


    I don't think there is anything on CPAN which addresses camera shake
    removal. And if the was such a module, I don't think simply using it
    would be helpful - I am assuming that the OP's assignment involves
    finding an algorithm and implementing it using Perl.

    Axel
     
    , Mar 14, 2006
    #2
    1. Advertising

  3. "Murray R. Van Luyn" <> wrote in
    news:4416a1cf$0$23302$:

    > Date: Tue, 14 Mar 2006 19:07:43 -0800


    Please fix the date on your computer.

    Sinan

    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Mar 14, 2006
    #3
  4. George

    robic0 Guest

    On Tue, 14 Mar 2006 19:07:43 -0800, "Murray R. Van Luyn" <> wrote:

    >For an assignment I'm required to find out how to remove camera shake from
    >JPEG images using Perl.

    Hey, I can never get the last few drops of piss from my dick when I take a
    leak, think you could write a perl program for me?

    No but seriously, I mean come on..... Its a hardware thing. Real time camera
    shake is removed from the framebuffer via jitter routines in the electronics.
    Have you gone onto Doom9.com and explored filters (plugins for frameserverving)
    written in asm?

    >
    >I'm stumped! I'm not after a solution, but would really appreciate direction
    >to sources of information that may help me to figure out how to accomplish
    >this task.
    >
    >Regards,
    >Murray R. Van Luyn.
    >
     
    robic0, Mar 15, 2006
    #4
  5. For an assignment I'm required to find out how to remove camera shake from
    JPEG images using Perl.

    I'm stumped! I'm not after a solution, but would really appreciate direction
    to sources of information that may help me to figure out how to accomplish
    this task.

    Regards,
    Murray R. Van Luyn.
     
    Murray R. Van Luyn, Mar 15, 2006
    #5
  6. George

    Guest

    On Tue, 14 Mar 2006 16:48:56 GMT, wrote:
    > George <> wrote:
    >> Murray R. Van Luyn wrote:
    >>> For an assignment I'm required to find out how to remove camera shake from
    >>> JPEG images using Perl.

    >
    >>> I'm stumped! I'm not after a solution, but would really appreciate direction
    >>> to sources of information that may help me to figure out how to accomplish
    >>> this task.

    >
    >> the FAQ can point you into the right direction, in particular
    >> perlfaq2.pod:
    >> "What modules and extensions are available for Perl? What is CPAN?
    >> What does CPAN/src/... mean?"

    >
    > I don't think there is anything on CPAN which addresses camera shake
    > removal. And if the was such a module, I don't think simply using it
    > would be helpful - I am assuming that the OP's assignment involves
    > finding an algorithm and implementing it using Perl.
    >
    > Axel
    >
    >

    There was an article in MAKE magazine about camera shake, I think it
    recommended a weight suspended from the camera. Some of the camera's
    are just too small to hold steady.



    --
    greymaus, the grumpy scrounger
     
    , Mar 15, 2006
    #6
  7. George

    Bart Lateur Guest

    wrote:

    >I don't think there is anything on CPAN which addresses camera shake
    >removal.


    Duh, you don't really want to take away all his fun!

    No, what George was saying, I think, was that there are modules on CPAN
    to read JPEG files and turn them into raw in memory bitmaps. I'm
    thinking of GD and ImageMagick, for example. From there, the real fun
    can begin.

    --
    Bart.
     
    Bart Lateur, Mar 15, 2006
    #7
  8. George

    robic0 Guest

    On Tue, 14 Mar 2006 19:07:43 -0800, "Murray R. Van Luyn" <> wrote:

    >For an assignment I'm required to find out how to remove camera shake from
    >JPEG images using Perl.
    >
    >I'm stumped! I'm not after a solution, but would really appreciate direction
    >to sources of information that may help me to figure out how to accomplish
    >this task.
    >
    >Regards,
    >Murray R. Van Luyn.
    >

    Just a followup, mpegs are composed of many thousands, if not millions of frames
    depending on how big it is, which I'm sure you know. I wouldn't imagine those frames
    just lying around on a hardisk in the un-compressed state.

    You can't just "edit" bitmap images and remake the mpeg video. Its a process that has
    to be done on the fly. Each frame is decompressed, then altered, then recompressed
    into a new video. In that process, it loses bit information and degrades in quality.
    As each frame is decompressed in the stream, it can be altered, then sent to a
    compressor like CCE (CinemaCraft Encoder or a couple of others).
    CCE costs around $2,000 for a license. Or you could purchace a license for a copy
    of the mpeg2 specifications for around $3,000 and write your own encoder in Perl.

    There are not really 30 fps stored in the mpeg. An algo is used that just
    stores the difference binary between frames (back to the I-Frame). When the difference
    passes the size of a full frame threshold, a new datum, called an I-Frame is inserted,
    then the process repeats. Of course this is in general as sub D-Frames are factored
    out as well as other optimizations.
    When a frame (image) is to be reconstituted (decompressed), it's formed from several
    binary regions in the I-Frame grouping. In general, the difference binary goes through
    an encoding so decoding will produce the image that was encoded, mostly for viewing.
    Encoding then decoding will not produce the exact same image that was originally encoded.

    There are many utilities on "Doom9.org" that can help you to filter streaming frames (images).
    The folks that write them are real genius types. All these are proofs. By that I mean
    its a pure software solution, but could easily be ported to realtime video specific
    hardware/firmware, and I'm sure they are. Doom9 will give you the poor man's solution to
    big time video production. Even though its shareware, its fairly complex and arcane for
    beginners.

    Fully uncompressed images from a 2-hour mpeg2 medium-high bitrate, 2 hour, quality movie, will
    generate about 300-500 gigabytes of data on a harddrive. For that reason, image processing is
    usually done on the frame level, then that frame is fed to the encoder. I'm not saying those
    500 gigs of images can't be fed to the encoder, but its just not done that way, usually.

    The methods used usually include a decompressor prgram (with an available codec) as a first
    step. Dvd2Svcd is a good choice for this but not necessary.

    Next is the heart of video processing, a program like AviSynth, which is a frameserver but
    more important, a program that knows how to use plug-in filters, that modify the frames
    (individually or in groups). This is where a possible jitter removal algo is used.
    Filtering here is very complicated. Anything that can be done with any paint program,
    stretching, gamma, sharp, contrast, brightnes, dubbing, overlays, to name a few.
    There are hundreds of filters available. These are incredibly complex algols. They are
    written entirely in assembly and is the heard of video editing/processing occurs.

    After each frame (or series of frames) has run through AviSynth, it is sent on to the encoder.
    CCE or TmpgEnc where it is packed into mpeg2 format (I-Frames and all).

    AviSynth is a "master" program that coordinates this process. It is script driven, as with
    most of these programs.

    Don't worry about jitter removal. The assembly to do the simplest of filters on a single frame
    is something you could not understand.

    Doom9.org is your best bet, unless you think anybody here, or Perl could help you..
    Hey, anythings possible I guess!!

    good luck
     
    robic0, Mar 16, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Jones
    Replies:
    0
    Views:
    1,298
    Chris Jones
    Jun 25, 2003
  2. Kenneth Keeley

    Convert images to Jpeg format

    Kenneth Keeley, Dec 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    855
    Kevin Spencer
    Dec 17, 2004
  3. MCP
    Replies:
    1
    Views:
    2,567
    Marco Schmidt
    Jul 3, 2003
  4. lovaspillando
    Replies:
    0
    Views:
    1,052
    lovaspillando
    Aug 26, 2007
  5. Ivan Alameda Carballo
    Replies:
    0
    Views:
    506
    Ivan Alameda Carballo
    Aug 26, 2007
Loading...

Share This Page