title: opencv image loading using buffer without saving?
body: <p>plugin for gimp to capture a frame from camera and to load it to gimp workspace.till nw i got the code to capture image and load the image but it is done by saving the captured image but i want to load image without saving the image.</p>
  
  <pre><code>#include &lt;libgimp/gimp.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;opencv/cv.h&gt;
  #include &lt;opencv/highgui.h&gt;
  #include &lt;opencv/cxcore.h&gt;
  #include &lt;stdio.h&gt;
  
  
  static void query (void);
  static void run   (const gchar      *name,
                 gint              nparams,
                 const GimpParam  *param,
                 gint             *nreturn_vals,
                 GimpParam       **return_vals);
  
  GimpPlugInInfo PLUG_IN_INFO =
  {
    NULL,
    NULL,
    query,
    run
  };
  
  MAIN()
  
  static void
  query (void)
  {
    static GimpParamDef args[] =
    {
      {
    GIMP_PDB_INT32,
    "run-mode",
    "Run mode"
      },
      {
    GIMP_PDB_IMAGE,
    "image",
    "Input image"
      },
      {
    GIMP_PDB_DRAWABLE,
    "drawable",
    "Input drawable"
      }
    };
  
    gimp_install_procedure (
      "plug-in-trail",
   "trail, SHOT!",
   "Displays \"trail!\" in a dialog",
   "JOSEPH,ARYA,CHINJU",
   "Copyright To JOSEPH",
   "2013",
   "_trail...",
   "RGB*, GRAY*",
   GIMP_PLUGIN,
   G_N_ELEMENTS (args), 0,
   args, NULL);
  
  gimp_plugin_menu_register ("plug-in-trail",
                           "&lt;Image&gt;/Filters/misc");
  }
  
  static void
  run (const gchar      *name,
   gint              nparams,
   const GimpParam  *param,
   gint             *nreturn_vals,
   GimpParam       **return_vals)
  {
   static GimpParam  values[1];
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
  GimpRunMode       run_mode;
  
  *nreturn_vals = 1;
  *return_vals  = values;
  
  values[0].type = GIMP_PDB_STATUS;
  values[0].data.d_status = status;
  
   gint32 image_ID;
   gint32 layer_ID;
   run_mode = param[0].data.d_int32;
  image_ID = param[1].data.d_image;
  CvCapture* camera = cvCreateCameraCapture(0); 
  
  IplImage*     frame = 0;
  
  cvSetCaptureProperty(camera,CV_CAP_PROP_FRAME_WIDTH,1024) ;
  cvSetCaptureProperty(camera,CV_CAP_PROP_FRAME_HEIGHT,768); 
  
  frame = cvQueryFrame(camera); 
  
  if (frame != NULL) {
  printf("Frame extracted from CAM1\n\r");
      cvSaveImage("/bin/test.jpg", frame,0);
  } else {
    printf("Null frame 1\n\r");
  }
  cvReleaseCapture(&amp;camera);
  cvReleaseImage(&amp;frame);
  layer_ID = gimp_file_load_layer (GIMP_RUN_NONINTERACTIVE,image_ID,"/bin/test.jpg");
  
  gimp_image_add_layer (image_ID,layer_ID,-1);
  gimp_displays_flush();
  if (run_mode != GIMP_RUN_NONINTERACTIVE)
   g_message("SNAPSHOT TAKEN!!");
  }
  </code></pre>
  
  <p>i want to load image without saving the image.how to find layer_id of captured image or i want to know is there any way to load image to gimp without saving captured image?</p>