Monday, November 26, 2007

Does Mahabhringraj Oil Work?



Processing is a development environment that enables artists, designers and enthusiasts in general to create applications for manipulating images, sounds and interaction in general easily.
  • The idea is to present some of the possibilities of processing using a camera.
  • In this article I will concentrate on a program that captures and displays images from the camera constantly, when you click the mouse a new static image is directed toward the viewing area like a photo.

  • The way to implement this program is not unique, choose a form that is easy to read and display multiple processing elements. / / which packages to import. Import

    processing.

    video. *
    ;    
    / / declare objects that I use. / / The way to declare an object is: / / Object_type nombreDelObejto; / / myCapture represent the camera.

    Capture
    myCapture ;
    / / capturedPhoto: storing the captured image to
    / / when you click the mouse
    PIMAG capturedPhoto ;
    / / graphicBuffer is an intermediate object that allows
    / / manipulate graphics

    PGraphics graphicBuffer ;
    / / declare two integers and assign them the value:

    / / w represents the width of an image.
    / / h is the height of an image.

    int w


    = 320
    ;
    int h = 240;
    / / declare and initialize a variable that I will / / as an indicator to see if I dump a / / new image in the display. boolean

    newPhoto
    =

    false;
    / / initialization function: void setup () {

    / / Prepare the display area will be two
    / / images distributed horizontally, / / w * 2 therefore indicates a double width image
    size (w

    *
    2 ,

    h , P2D); / / Black to the bottom of the display area background ( 0 )

    / / I figure to save the picture intermediate
    / / captured graphicBuffer =
    CreateGraphics (
    w, h

    , P2D); / / I think the object that handles the camera: / / In this If used the last camera used by / / quicktime. Parameters: / / this: This application

    / / w, h: are the width and length of the captured image
    / / 5: the number of frames per second capture
    myCapture

    = new

    Capture (

    this
    , w, h , 5 ) } / / This function is called for whenever procesing / / user clicks the mouse void mouseClicked

    () {

    / / Save the current image, this area of \u200b\u200bgraphics
    / / me in the future will draw or work on / / image captured graphicBuffer
    . September
    (
    0 ,

    0 ,
    myCapture ) / / convert the graphics area in a common image / / to be shown easily. capturedPhoto =

    graphicBuffer
    .
    get ();
    / / Inida have captured a new image. newPhoto = true ;
    }

    / / This function is called for each image processing / / disposable camera Void
    captureEvent (

    Capture
    myCapture
    ) {
    / / Is there a new image from the camera? if ( myCapture . available ()) {


    / / Leo the camera's new image myCapture . read ();
    }}
    void
    draw () {

    / / Updates the display with the image obtained

    / / captureEvent () image ( myCapture ,
    0
    ,
    0

    )
    / / ask if there is an image captured with the click / / mouse if ( newPhoto
    ! =
    false) {

    / / If no image, the shift in the viewing area, / / next to the image drawn before, so the / / position of this new image will be w, 0 indicating / / a horizontal displacement equal to the width of a
    / / Image (w)

    image (
    capturedPhoto , w

    ,
    0
    ) / / Back on warning false image captured at newPhoto = false ;


    }}

    0 comments:

    Post a Comment