[openrtm-commit:01131] r101 - in branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge: include/Edge src
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 10月 10日 (木) 15:24:45 JST
Author: kawauchi
Date: 2013-10-10 15:24:45 +0900 (Thu, 10 Oct 2013)
New Revision: 101
Modified:
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/include/Edge/Edge.h
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/src/Edge.cpp
Log:
Edge component: Operator size has changed to the configuration and converted to the UTF-8 character code. refs #2704
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/include/Edge/Edge.h
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/include/Edge/Edge.h 2013-10-07 08:00:30 UTC (rev 100)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/include/Edge/Edge.h 2013-10-10 06:24:45 UTC (rev 101)
@@ -24,14 +24,10 @@
#include <cxcore.h>
#include <highgui.h>
-#define SOBEL_X_APERTURE_SIZE 3 // SobelIy[^ÌTCY (t@XQÆ)
-#define SOBEL_Y_APERTURE_SIZE 3 // SobelIy[^ÌTCY (t@XQÆ)
-#define LAPLACIAN_APERTURE_SIZE 3 // LaplacianIy[^ÌTCY (t@XQÆ)
+// cvConvertScaleAbsç¨å®æ°
+#define SCALE 1 // ScaleAbsä¿æ°
+#define SHIFT 0 // ã¹ã±ã¼ãªã³ã°ããå
¥åé
åã®è¦ç´ ã«å ããå¤
-// cvConvertScaleAbspè
-#define SCALE 1 // ScaleAbsW
-#define SHIFT 0 // XP[Oµ½üÍzñÌvfÉÁ¦él
-
// Service implementation headers
// <rtc-template block="service_impl_h">
@@ -236,7 +232,24 @@
// Configuration variable declaration
// <rtc-template block="config_declare">
-
+ /*!
+ *
+ * - Name: sobel_x_size
+ * - DefaultValue: 3
+ */
+ int m_sobel_x_size;
+ /*!
+ *
+ * - Name: sobel_y_size
+ * - DefaultValue: 3
+ */
+ int m_sobel_y_size;
+ /*!
+ *
+ * - Name: laplacian_size
+ * - DefaultValue: 3
+ */
+ int m_laplacian_size;
// </rtc-template>
// DataInPort declaration
@@ -289,7 +302,7 @@
// <rtc-template block="private_operation">
// </rtc-template>
- IplImage* imageBuff; // JC[W
+ IplImage* imageBuff; // ã«ã¡ã©ã¤ã¡ã¼ã¸
IplImage* grayImage;
IplImage* destinationImage_x;
IplImage* destinationImage_y;
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/src/Edge.cpp
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/src/Edge.cpp 2013-10-07 08:00:30 UTC (rev 100)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Edge/src/Edge.cpp 2013-10-10 06:24:45 UTC (rev 101)
@@ -27,6 +27,18 @@
"max_instance", "1",
"language", "C++",
"lang_type", "compile",
+ // Configuration variables
+ "conf.default.sobel_x_size", "3",
+ "conf.default.sobel_y_size", "3",
+ "conf.default.laplacian_size", "3",
+ // Widget
+ "conf.__widget__.sobel_x_size", "radio",
+ "conf.__widget__.sobel_y_size", "radio",
+ "conf.__widget__.laplacian_size", "radio",
+ // Constraints
+ "conf.__constraints__.sobel_x_size", "(1,3,5,7)",
+ "conf.__constraints__.sobel_y_size", "(1,3,5,7)",
+ "conf.__constraints__.laplacian_size", "(1,3,5,7)",
""
};
// </rtc-template>
@@ -77,6 +89,9 @@
// </rtc-template>
// <rtc-template block="bind_config">
+ bindParameter("sobel_x_size", m_sobel_x_size, "3");
+ bindParameter("sobel_y_size", m_sobel_y_size, "3");
+ bindParameter("laplacian_size", m_laplacian_size, "3");
// </rtc-template>
return RTC::RTC_OK;
@@ -106,7 +121,7 @@
RTC::ReturnCode_t Edge::onActivated(RTC::UniqueId ec_id)
{
- // C[WpÌú»
+ // ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®åæå
imageBuff = NULL;
grayImage = NULL;
destinationImage_x = NULL;
@@ -115,7 +130,7 @@
destinationEdge = NULL;
edgeImage = NULL;
- // OutPortæÊTCYÌú»
+ // OutPortç»é¢ãµã¤ãºã®åæå
m_image_edge_sobel_x.width = m_image_edge_sobel_y.width = m_image_edge_LAPLACIAN.width = 0;
m_image_edge_sobel_x.height = m_image_edge_sobel_y.height = m_image_edge_LAPLACIAN.height = 0;
@@ -129,7 +144,7 @@
{
if(imageBuff != NULL)
{
- // C[WpÌðú
+ // ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®è§£æ¾
cvReleaseImage(&imageBuff);
cvReleaseImage(&destinationImage_x);
cvReleaseImage(&destinationImage_y);
@@ -145,18 +160,18 @@
RTC::ReturnCode_t Edge::onExecute(RTC::UniqueId ec_id)
{
- // Vµ¢f[^Ì`FbN
+ // æ°ãããã¼ã¿ã®ãã§ãã¯
if(m_image_origIn.isNew()){
- // InPortf[^ÌÇÝÝ
+ // InPortãã¼ã¿ã®èªã¿è¾¼ã¿
m_image_origIn.read();
- // InPortÆOutPortÌæÊTCY¨æÑC[WpÌmÛ
+ // InPortã¨OutPortã®ç»é¢ãµã¤ãºå¦çããã³ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®ç¢ºä¿
if( m_image_orig.width != m_image_edge_sobel_x.width || m_image_orig.height != m_image_edge_sobel_x.height)
{
m_image_edge_sobel_x.width = m_image_edge_sobel_y.width = m_image_edge_LAPLACIAN.width = m_image_orig.width;
m_image_edge_sobel_x.height = m_image_edge_sobel_y.height = m_image_edge_LAPLACIAN.height = m_image_orig.height;
- // InPortÌC[WTCYªÏX³ê½ê
+ // InPortã®ã¤ã¡ã¼ã¸ãµã¤ãºãå¤æ´ãããå ´å
if(imageBuff != NULL)
{
cvReleaseImage(&imageBuff);
@@ -168,7 +183,7 @@
cvReleaseImage(&edgeImage);
}
- // C[WpÌmÛ
+ // ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®ç¢ºä¿
imageBuff = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 3 );
grayImage = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 1 );
destinationImage_x = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_16S, 1 );
@@ -178,36 +193,36 @@
edgeImage = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 3 );
}
- // InPortÌæÊf[^ðRs[
+ // InPortã®ç»é¢ãã¼ã¿ãã³ãã¼
memcpy( imageBuff->imageData, (void *)&(m_image_orig.pixels[0]), m_image_orig.pixels.length() );
- // RGB©çO[XP[ÉÏ·
+ // RGBããã°ã¬ã¼ã¹ã±ã¼ã«ã«å¤æ
cvCvtColor( imageBuff, grayImage, CV_RGB2GRAY );
// Sobel_X
- // XûüÌSobelIy[^ð©¯é
- cvSobel( grayImage, destinationImage_x, 1, 0, SOBEL_X_APERTURE_SIZE );
+ // Xæ¹åã®Sobelãªãã¬ã¼ã¿ãããã
+ cvSobel( grayImage, destinationImage_x, 1, 0, m_sobel_x_size );
- // 16rbgÌ èf[^ð8rbgÌȵf[^ÉÏ··é
+ // 16ãããã®ç¬¦å·ãããã¼ã¿ã8ãããã®ç¬¦å·ãªããã¼ã¿ã«å¤æãã
cvConvertScaleAbs( destinationImage_x, destinationEdge, SCALE, SHIFT );
- // O[XP[©çRGBÉÏ·
+ // ã°ã¬ã¼ã¹ã±ã¼ã«ããRGBã«å¤æ
cvCvtColor( destinationEdge, edgeImage, CV_GRAY2RGB );
- // æf[^ÌTCYæ¾
+ // ç»åãã¼ã¿ã®ãµã¤ãºåå¾
len = edgeImage->nChannels * edgeImage->width * edgeImage->height;
m_image_edge_sobel_x.pixels.length(len);
- // ½]µ½æf[^ðOutPortÉRs[
+ // å転ããç»åãã¼ã¿ãOutPortã«ã³ãã¼
memcpy( (void *)&(m_image_edge_sobel_x.pixels[0]), edgeImage->imageData, len );
- // ½]µ½æf[^ðOutPort©çoÍ
+ // å転ããç»åãã¼ã¿ãOutPortããåºå
m_image_edge_sobel_xOut.write();
// Sobel_Y
- // YûüÌSobelIy[^ð©¯é
- cvSobel( grayImage, destinationImage_y, 0, 1, SOBEL_Y_APERTURE_SIZE );
+ // Yæ¹åã®Sobelãªãã¬ã¼ã¿ãããã
+ cvSobel( grayImage, destinationImage_y, 0, 1, m_sobel_y_size );
cvConvertScaleAbs( destinationImage_y, destinationEdge, SCALE, SHIFT );
@@ -221,7 +236,7 @@
// LAPLACIAN
- cvLaplace( grayImage, destinationImage_LAPLACIAN, LAPLACIAN_APERTURE_SIZE );
+ cvLaplace( grayImage, destinationImage_LAPLACIAN, m_laplacian_size );
cvConvertScaleAbs( destinationImage_LAPLACIAN, destinationEdge, SCALE, SHIFT );
More information about the openrtm-commit
mailing list