<font size=3>Hello,<br>
<br>
I have the following code that works fine to separate two interlaced images
that arrive in a single port and separates them into two frames that are
sent out in two different ports:<br>
<br>
void Task::updateHook()<br>
{<br>
&nbsp;&nbsp;&nbsp; TaskBase::updateHook();<br>
&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if (_frame_in.read(input_frame)==RTT::NewData)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; Frame* left = new Frame(input_frame-&gt;size.width,
input_frame-&gt;size.height, 8, input_frame-&gt;frame_mode);<br>
&nbsp;&nbsp;&nbsp; Frame* right = new Frame(input_frame-&gt;size.width,
input_frame-&gt;size.height, 8, input_frame-&gt;frame_mode);<br>
&nbsp;&nbsp;&nbsp; deInterlace(*input_frame,*left,*right);<br>
&nbsp;&nbsp;&nbsp; Frame*&nbsp; left_gray = new Frame(left-&gt;size.width,
left-&gt;size.height, 8, MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp; Frame*&nbsp; right_gray = new Frame(right-&gt;size.width,
right-&gt;size.height, 8, MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp; frame_helper.convertColor(*left,*left_gray);<br>
&nbsp;&nbsp;&nbsp; frame_helper.convertColor(*right,*right_gray);<br>
&nbsp;&nbsp;&nbsp; frame_left.reset(left_gray);<br>
&nbsp;&nbsp;&nbsp; frame_right.reset(right_gray);<br>
&nbsp;&nbsp;&nbsp; _frame_left.write(frame_left);<br>
&nbsp;&nbsp;&nbsp; _frame_right.write(frame_right);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
void Task::deInterlace(const base::samples::frame::Frame &amp;input, base::samples::frame::Frame
&amp;left, base::samples::frame::Frame &amp;right)<br>
{</font>
<br><font size=3>&nbsp; &nbsp; //! Note: input frame has a data depth of
16bits while the left and right have a data depth of 8 bits. Bytes in the
input frame are mixed in order, one byte from the left, one byte from the
right, and so on.</font>
<br><font size=3>&nbsp; &nbsp; //! So in &quot;one pixel&quot; of 16bits
of the input frame there are &quot;two pixels&quot; of 8bits one of each
left and right frames.<br>
&nbsp;&nbsp;&nbsp; uint32_t width=(input.size.width*2);<br>
&nbsp;&nbsp;&nbsp; uint32_t height=input.size.height;<br>
<br>
&nbsp;&nbsp;&nbsp; int i = (width*height)-1;<br>
&nbsp;&nbsp;&nbsp; int j = ((width*height)&gt;&gt;1)-1;<br>
<br>
&nbsp;&nbsp;&nbsp; while (i &gt;= 0) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; right.image[j] = input.image[i--];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left.image[j--] = input.image[i--];<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; left.copyImageIndependantAttributes(input);<br>
&nbsp;&nbsp;&nbsp; right.copyImageIndependantAttributes(input);<br>
<br>
}<br>
<br>
input_frame, frame_left and frame_right are ReadOnlyPointers of type Frame
defined in Task.hpp. Rest of the Hooks are empty/default.<br>
<u><br>
Question</u>: Even thought this does the work for me, I would like to know
if this is a correct way of doing it. Mostly regarding the creation of
several Frame pointers and allocation of memory for those in the middle
of the updateHook? (This is actually important because it is related to
the question below)<br>
<br>
Now, I would like to send out both images left and right in a single port
using the structure FramePair, to make sure that they arrive together to
the stereo processing component with a single timestamp for both (as they
were both taken at the same time by a stereo camera). However, I have tried
to replicate the same logic using the FramePair structure and always got
errors in execution (compilation is ok).<br>
<br>
Changing the last part of the updateHook to the following:<br>
<br>
void Task::updateHook()<br>
{<br>
&nbsp;&nbsp;&nbsp; TaskBase::updateHook();<br>
&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if (_frame_in.read(input_frame)==RTT::NewData)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; Frame* left = new Frame(input_frame-&gt;size.width,
input_frame-&gt;size.height, 8, input_frame-&gt;frame_mode);<br>
&nbsp;&nbsp;&nbsp; Frame* right = new Frame(input_frame-&gt;size.width,
input_frame-&gt;size.height, 8, input_frame-&gt;frame_mode);<br>
&nbsp;&nbsp;&nbsp; deInterlace(*input_frame,*left,*right);<br>
&nbsp;&nbsp;&nbsp; Frame*&nbsp; left_gray = new Frame(left-&gt;size.width,
left-&gt;size.height, 8, MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp; Frame*&nbsp; right_gray = new Frame(right-&gt;size.width,
right-&gt;size.height, 8, MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp; frame_helper.convertColor(*left,*left_gray);<br>
&nbsp;&nbsp;&nbsp; frame_helper.convertColor(*right,*right_gray);<br>
&nbsp;&nbsp;&nbsp; FramePair* frame_pair;<br>
&nbsp;&nbsp;&nbsp; frame_pair-&gt;id=index_frame++;&nbsp; //! index_frame
is defined in Task.hpp and initialized to 0 in configureHook.<br>
&nbsp;&nbsp;&nbsp; frame_pair-&gt;time = input_frame-&gt;time;<br>
&nbsp;&nbsp;&nbsp; frame_pair-&gt;first = *left_gray;<br>
&nbsp;&nbsp;&nbsp; frame_pair-&gt;second = *right_gray;<br>
&nbsp;&nbsp;&nbsp; output_frame_pair.reset(frame_pair); //! output_frame_pair
is also a ReadOnlyPointer in Task.hpp<br>
&nbsp;&nbsp;&nbsp; _frame_out.write(output_frame_pair);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
gives me the following error when I run it: Orocos[WARN]: deployment <i>[myTaskContext]</i>
unexpectedly terminated with signal 11<br>
<br>
After trying several ways of assigning the frames's data to the frame_pair
structure without success I understood I was not using FramePair the right
way. So I tried something very simple as:<br>
<br>
void Task::updateHook()<br>
{<br>
&nbsp;&nbsp;&nbsp; TaskBase::updateHook();&nbsp;&nbsp; <br>
<br>
&nbsp;&nbsp;&nbsp; if (_frame_in.read(input_frame)==RTT::NewData)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FramePair* frame_pair;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;time=input_frame-&gt;time;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;id=index_frame++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;first.init(1024,768,8,MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;second.init(1024,768,8,MODE_GRAYSCALE);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output_frame_pair.reset(frame_pair);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _frame_out.write(output_frame_pair);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
And it gives the same error as above and actually the execution stops before
the end of the updateHook at the line where the first.init() function is
called.<br>
<br>
I make it even simpler:<br>
<br>
void Task::updateHook()<br>
{<br>
&nbsp;&nbsp;&nbsp; TaskBase::updateHook();&nbsp;&nbsp; <br>
<br>
&nbsp;&nbsp;&nbsp; if (_frame_in.read(input_frame)==RTT::NewData)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FramePair* frame_pair;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;time=input_frame-&gt;time;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame_pair-&gt;id=index_frame++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output_frame_pair.reset(frame_pair);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _frame_out.write(output_frame_pair);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
I get the same error when exiting the updateHook.<br>
<u><br>
Question:</u> What is it that I am missing about FramePair structure that
makes it so different to the Frame structure when it comes to memory allocation?
Somebody can put some light in this?<br>
<br>
Thank you very much for your attention,<br>
<br>
Martin</font><font size=2 face="sans-serif"><br>
</font><font size=3><br>
</font>
<p><font size=2 color=#001fe2 face="Verdana">Martin Azkarate</font>
<p><font size=1 color=#8f8f8f face="Verdana"><b>ESA - European Space Agency</b><br>
Spanish Trainee, TEC-MMA - Automation and Robotics Section </font>
<p><font size=1 color=#8f8f8f face="Verdana"><b>ESTEC - European Space
research and TEchnology Centre</b><br>
Keplerlaan 1, PO Box 299 <br>
NL-2200 AG Noordwijk, The Netherlands <br>
Martin.Azkarate@esa.int | </font><a href=www.esa.int><font size=1 color=#8f8f8f face="Verdana">www.esa.int</font></a><font size=1 color=#8f8f8f face="Verdana">
<br>
Tel +31 71 565 3480 | Mob +31 650 625 564 </font><PRE>This message and any attachments are intended for the use of the addressee or addressees only. The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its content is not permitted. If you received this message in error, please notify the sender and delete it from your system. Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.
</PRE>