<div dir="ltr">yes, I guess you are right Gonzalo.I too was thinking that there would be some pipeline issue because of which I am not able to get the image.Thanks for the help :-)</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Jul 21, 2014 at 5:43 PM, Gonzalo Odiard <span dir="ltr"><<a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I think yoou should get the photo data from the gstreamer side, <div>not from the widget where you are displaying it.</div><div>If you look at the Record activity code, </div><div>the logic used to take the photo is in glive.py take_photo method,</div>
<div>and adding a sink to a tee in the gstreamer pipeline,</div><div>and getting the data from there (_photo_handoff method)</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
<div><div class="h5">
On Mon, Jul 21, 2014 at 2:50 AM, James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org" target="_blank">quozl@laptop.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div><div>On Mon, Jul 21, 2014 at 11:14:16AM +0530, Puneet Kaur wrote:<br>
><br>
><br>
><br>
> On Mon, Jul 21, 2014 at 10:56 AM, James Cameron <<a href="mailto:quozl@laptop.org" target="_blank">quozl@laptop.org</a>> wrote:<br>
><br>
> On Mon, Jul 21, 2014 at 02:07:15AM +0530, Puneet Kaur wrote:<br>
> > Hey all,<br>
> ><br>
> > I was able to get the webcam stream using gStreamer through this :<br>
> ><br>
> > self.src = Gst.ElementFactory.make('autovideosrc', None)<br>
> > self.sink = Gst.ElementFactory.make('autovideosink', None)<br>
> ><br>
> > (and more related corde...)<br>
><br>
> Good.<br>
><br>
> > but how to modify in order to store the image (on click) to a file /<br>
> buffer ?<br>
> ><br>
> > I tried : <br>
> ><br>
> > 1) gdk_display = GdkX11.X11Display.get_default()<br>
> > gdk_window = GdkX11.X11Window.foreign_new_for_display<br>
> (gdk_display,self.xid)<br>
><br>
><br>
> the above two lines for fetching gdk window from a given xid<br>
> <br>
><br>
> > width = gdk_window.get_width()<br>
> > height = gdk_window.get_height() <br>
><br>
><br>
> width and height of the gdk window<br>
> <br>
><br>
> > ims = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) <br>
><br>
><br>
> make a cairo surface <br>
><br>
> <br>
> > pb = Gdk.pixbuf_get_from_window(gdk_window, 0, 0, width, height)<br>
><br>
><br>
> get the pixbuf from the gdk window<br>
> <br>
><br>
> > cr = cairo.Context(ims) <br>
><br>
><br>
> set the cairo context <br>
><br>
><br>
> <br>
> > Gdk.cairo_set_source_pixbuf(cr, pb, 0, 0) <br>
><br>
><br>
> set cairo source<br>
> <br>
><br>
> > cr.paint()<br>
><br>
><br>
><br>
> paint on the cairo context and then save the surface by : ims.write_to_png<br>
> ('testimage'+self.snapshot_name()+'.png') <br>
><br>
><br>
><br>
><br>
> How are you copying the camera image to the surface? I can't see how<br>
> you do that in the above example.<br>
><br>
><br>
><br>
> ^<br>
<br>
</div></div>Sorry, I don't understand. Yes, I agree with the comments you added<br>
to the code, but I don't see how you are copying the camera image to<br>
the surface. As far as I can tell, you _must_ end up with a blank<br>
surface if you don't put anything on it.<br>
<div><br>
--<br>
James Cameron<br>
<a href="http://quozl.linux.org.au/" target="_blank">http://quozl.linux.org.au/</a><br>
</div></div></div><div><div>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></div></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Software for children learning <br></div>
</div>
</font></span></div>
</blockquote></div><br></div>