The cvFlip() function flips a 2D array (i.e. an image) on the vertical axis, horizontal axis, or both axes at the same time.
void cvFlip(IplImage* src, IplImage* dst=NULL, int flip_mode=0); #define cvMirror cvFlip src Input array dst Output array. If dst is NULL, the result will be written into src. flip_mode Flag setting the axes to flip on. flip_mode = 0: Flip on the X axis (swap top and bottom) flip_mode > 0: Flip on the Y axis (swap left and right) flip_mode < 0: Flip on both axes
The component will flip an image received by an InPort and output it on an OutPort.
The flip mode will be controlled by an RTC configuration parameter called "flip_mode." Set flip_mode as below:
The specification of the component we will create is as follows:
※ TimedOctetSeq is a data type specified in BasicDataType.idl from OpenRTM-aist.
※ octet is a CORBA IDL base type that can store and transmit any data in 8-bit format without transformation.
struct Time { unsigned long sec; // sec unsigned long nsec; // nano sec }; struct TimedOctetSeq { Time tm; sequence<octet> data; };
Figure 1 illustrates the effects of different flip_mode settings.
We will generate the Flip component template using RTCBuilder.
Upon starting Eclipse with a new workspace, the Welcome page will be displayed.
Close this Welcome screen using the close button to display the default perspective view.
Click the "Open Perspective" button in the top right and select "Other..." from the menu.
Select "RTC Builder".
First, we will make an Eclipse project for the RT-Component. From the File menu, select "New," then "Project."
In the displayed dialog, select "Other," then "RTCBuilder" (RTC ビルダ) and click "Next".
Enter a project name and click "Finish."
A project using the given name will be created and displayed in the package explorer.
Within the generated project will be an RTC profile XML (RTC.xml) containing default values.
To open the RTC Profile Editor, click the "Open New RtcBuilder Editor" button on the toolbar, or select "Open New Builder Editor" from the File menu.
It is necessary to set the location of the IDL files that define data types used by data ports and service ports.
※ This value is valid for the entire workspace, so it does not need to be set for each project created within the same workspace.
1. Open the settings dialog by selecting "Settings" from the "Window" menu. 2. Expand the "RtcBuilder" branch and select "Data Type." 3. Click the "Add" button and enter values for "IDL File Directories." IDL files included with OpenRTM-aist are installed to this path by default: C:\Program Files\OpenRTM-aist\1.0\rtm\idl 4. Click the "OK" button to finish.
1. Select the "Basic" (基本) tab, and enter the basic component information as below.
2. Select the "Activity" (アクティビティ) tab and select the action callbacks that will be used.
For the Flip component, the onActivated(), onDeactivated() and onExecute() callbacks will be used. Check them as in Figure 14.
3. Select the ""Data port" (データポート) tab and enter the data port information.
4. Select the "Configuration" (コンフィギュレーション) tab and enter the configuration parameters.
5. Select the "Language/Environment" (言語・環境) tab and choose a programming language. For the Flip component, choose C++.
6. Click the "Generate code" (コード生成) button in the "Basic" tab to generate the component template.
※ The component template code will be generated in the currently-active Eclipse workspace directory. You can check this directory by selecting "Change workspace" from the File menu.