On Thu, 26 Sep 2013 13:05:48 +0200 Nicolas ALCOUFFE <nicolas.alcou...@free.fr> said:
> Ok, it is working perfectly with: > > evas_object_image_size_set(evas_image, opencv_image.size().width, > opencv_image.size().height); > if (opencv_image.data) { > evas_object_image_data_copy_set(evas_image, opencv_image.data); > evas_object_image_data_update_add(evas_image, 0, 0, > opencv_image.size().width, opencv_image.size().height); > } and now... it's doing a copy into evas's memory that it manages for the buffer. :) > I see in documentation: > Note that the caller is responsible for freeing the buffer when finished > with it, as user-set image data will not be automatically freed when the > image object is deleted. > > How can i free, the buffer ? you got it from opencv... i guess via some opencv method.. :) > > Thanks > Nicolas. > > On Thu, 26 Sep 2013 12:18:57 +0200 Nicolas ALCOUFFE > > <nicolas.alcou...@free.fr> said: > > > > when you set the image data, evas doesnt COPY it... it refers to it. > > directly. at any point that image object may possibly need to be rendered > > evas will need access to the image data pointer and it must be VALID at all > > times until the image object stops pointing to that data (set data to > > NULL). if you set data without that data ptr being the ptr you get from > > getting the data form evas (when evas itself manages and allocates the > > image data)... then you are setting foreign data that YOU then manage (not > > evas), and YOU must ensure the data is valid and available (given the image > > size that has been set) for the lifespan of the image object as long as it > > doesnt have the data unset... :) > > > >> What do you mean ? > >>> you're freeing your image data before it gets rendered. > >>> > >>> > >>> On Thu, Sep 26, 2013 at 10:58 AM, Nicolas ALCOUFFE > >>> <nicolas.alcou...@free.fr > >>>> wrote: > >>>> Hi, > >>>> > >>>> For some reason, i need to convert an OpenCV image to Evas Image, i do: > >>>> > >>>> opencv_image = imread("fruits.jpg", 1); > >>>> cvtColor(opencv_image, opencv_image, CV_BGR2BGRA); > >>>> > >>>> evas_image = evas_object_image_add(canvas); > >>>> evas_object_image_colorspace_set(evas_image, EVAS_COLORSPACE_ARGB8888); > >>>> evas_object_image_size_set(evas_image, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_image_fill_set(evas_image, 0, 0, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_resize (evas_image, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_image_data_set(evas_image, opencv_image.data); > >>>> evas_object_show(evas_image); > >>>> > >>>> This code is perfectly working, for only one image, so i created an > >>>> Ecore Timer to get image in real time from my webcam: > >>>> timer = ecore_timer_add(0.01, update, NULL); > >>>> > >>>> My update function is: > >>>> > >>>> Mat opencv_image; > >>>> opencv_image = cvQueryFrame(capture); > >>>> cvtColor(opencv_image, opencv_image, CV_BGR2BGRA); > >>>> evas_object_image_size_set(evas_image, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_image_fill_set(evas_image, 0, 0, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_resize (evas_image, opencv_image.size().width, > >>>> opencv_image.size().height); > >>>> evas_object_image_data_set(evas_image, opencv_image.data); > >>>> > >>>> but when i'm running this, i get: > >>>> > >>>> Program received signal SIGSEGV, Segmentation fault. > >>>> [Switching to Thread 0xb4ae4b40 (LWP 2383)] > >>>> _op_copy_p_dp_mmx () at > >>>> lib/evas/common/./evas_op_copy/op_copy_pixel_i386.c:8 > >>>> 8 MOVE_16DWORDS_MMX(s, d); > >>>> (gdb) bt > >>>> #0 _op_copy_p_dp_mmx () at > >>>> lib/evas/common/./evas_op_copy/op_copy_pixel_i386.c:8 > >>>> #1 0xb78c0d54 in evas_common_scale_rgba_sample_draw () at > >>>> lib/evas/common/evas_scale_sample.c:212 > >>>> #2 0xb78d5d3d in _draw_thread_image_draw () at > >>>> modules/evas/engines/software_generic/evas_engine.c:1196 > >>>> #3 0xb78c83cb in evas_thread_worker_func () at > >>>> lib/evas/common/evas_thread_render.c:107 > >>>> #4 0xb5e1552c in _eina_internal_call () at lib/eina/eina_thread.c:280 > >>>> #5 0xb7788d4c in start_thread (arg=0xb4ae4b40) at pthread_create.c:308 > >>>> #6 0xb76c7dde in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130 > >>>> > >>>> Someone know if it's a bug in evas or if i do something wrong ? > >>>> I'm using efl from git. > >>>> > >>>> Thanks in advance for your response. > >>>> Nicolas. > >>>> > >>>> > >>>> ------------------------------------------------------------------------------ > >>>> October Webinars: Code for Performance > >>>> Free Intel webinars can help you accelerate application performance. > >>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > >>>> from > >>>> the latest Intel processors and coprocessors. See abstracts and register > >>>> > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk > >>>> _______________________________________________ > >>>> enlightenment-devel mailing list > >>>> enlightenment-devel@lists.sourceforge.net > >>>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > >>>> > >>> ------------------------------------------------------------------------------ > >>> October Webinars: Code for Performance > >>> Free Intel webinars can help you accelerate application performance. > >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > >>> from the latest Intel processors and coprocessors. See abstracts and > >>> register > > >>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk > >>> _______________________________________________ enlightenment-devel > >>> mailing list enlightenment-devel@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > >>> > >> > >> ------------------------------------------------------------------------------ > >> October Webinars: Code for Performance > >> Free Intel webinars can help you accelerate application performance. > >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > >> from the latest Intel processors and coprocessors. See abstracts and > >> register > > >> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk > >> _______________________________________________ enlightenment-devel > >> mailing list enlightenment-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > >> > > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) ras...@rasterman.com ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel