[openrtm-commit:01130] r100 - in branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion: include/DilationErosion src
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 10月 7日 (月) 17:00:30 JST
Author: kawauchi
Date: 2013-10-07 17:00:30 +0900 (Mon, 07 Oct 2013)
New Revision: 100
Modified:
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/include/DilationErosion/DilationErosion.h
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/src/DilationErosion.cpp
Log:
Dilationerosion component: Threshold has changed to the configuration and converted to the UTF-8 character code. refs #2704
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/include/DilationErosion/DilationErosion.h
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/include/DilationErosion/DilationErosion.h 2013-09-26 08:22:12 UTC (rev 99)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/include/DilationErosion/DilationErosion.h 2013-10-07 08:00:30 UTC (rev 100)
@@ -10,8 +10,7 @@
#ifndef DILATIONEROSION_H
#define DILATIONEROSION_H
-#define THRESHOLD 128 // 2l»ÌÛÌèl
-#define THRESHOLD_MAX_VALUE 255 // 2l»ÌÛÉgp·éÅål
+#define THRESHOLD_MAX_VALUE 255 // 2å¤åã®éã«ä½¿ç¨ããæ大å¤
#include <rtm/Manager.h>
#include <rtm/DataFlowComponentBase.h>
@@ -22,7 +21,7 @@
#include <rtm/idl/ExtendedDataTypesSkel.h>
#include <rtm/idl/InterfaceDataTypesSkel.h>
-// OpenCVHeadt@CÌIncluding
+// OpenCVHeadãã¡ã¤ã«ã®Including
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
@@ -234,27 +233,21 @@
/*!
*
* - Name: count_dilation
- * - DefaultValue: 1
+ * - DefaultValue: 3
*/
int m_count_dilation;
/*!
*
* - Name: count_erosion
- * - DefaultValue: 1
+ * - DefaultValue: 3
*/
int m_count_erosion;
/*!
*
- * - Name: img_height
- * - DefaultValue: 240
+ * - Name: nThreshold
+ * - DefaultValue: 128
*/
- int m_img_height;
- /*!
- *
- * - Name: img_width
- * - DefaultValue: 320
- */
- int m_img_width;
+ int m_nThreshold;
// </rtc-template>
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/src/DilationErosion.cpp
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/src/DilationErosion.cpp 2013-09-26 08:22:12 UTC (rev 99)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Dilationerosion/src/DilationErosion.cpp 2013-10-07 08:00:30 UTC (rev 100)
@@ -25,16 +25,15 @@
"language", "C++",
"lang_type", "compile",
// Configuration variables
- "conf.default.dilation_count", "1",
- "conf.default.erosion_count", "1",
- "conf.default.image_height", "240",
- "conf.default.image_width", "320",
+ "conf.default.dilation_count", "3",
+ "conf.default.erosion_count", "3",
+ "conf.default.threshold", "128",
// Widget
"conf.__widget__.dilation_count", "text",
"conf.__widget__.erosion_count", "text",
- "conf.__widget__.image_height", "text",
- "conf.__widget__.image_width", "text",
+ "conf.__widget__.threshold", "slider.1",
// Constraints
+ "conf.__constraints__.threshold", "0<=x<=255",
""
};
// </rtc-template>
@@ -86,10 +85,9 @@
// <rtc-template block="bind_config">
// Bind variables and configuration variable
- bindParameter("dilation_count", m_count_dilation, "1");
- bindParameter("erosion_count", m_count_erosion, "1");
- bindParameter("image_height", m_img_height, "240");
- bindParameter("image_width", m_img_width, "320");
+ bindParameter("dilation_count", m_count_dilation, "3");
+ bindParameter("erosion_count", m_count_erosion, "3");
+ bindParameter("threshold", m_nThreshold, "128");
// </rtc-template>
return RTC::RTC_OK;
@@ -119,7 +117,7 @@
RTC::ReturnCode_t DilationErosion::onActivated(RTC::UniqueId ec_id)
{
- //C[WpÌmÛ
+ //ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®ç¢ºä¿
m_image_buff = NULL;
m_gray_buff = NULL;
@@ -140,7 +138,7 @@
RTC::ReturnCode_t DilationErosion::onDeactivated(RTC::UniqueId ec_id)
{
- //ðú
+ //ã¡ã¢ãªè§£æ¾
if(m_image_buff != NULL){
cvReleaseImage(&m_image_buff);
}
@@ -185,10 +183,10 @@
RTC::ReturnCode_t DilationErosion::onExecute(RTC::UniqueId ec_id)
{
- //VC[WÌ`FbN
+ //æ°ã¤ã¡ã¼ã¸ã®ãã§ãã¯
if(m_img_origIn.isNew()){
- //f[^ÌÇÝÝ
+ //ãã¼ã¿ã®èªã¿è¾¼ã¿
m_img_origIn.read();
m_image_buff = cvCreateImage(cvSize(m_img_orig.width, m_img_orig.height), IPL_DEPTH_8U, 3);
@@ -204,46 +202,46 @@
m_ero_merge_img = cvCreateImage(cvSize(m_img_orig.width, m_img_orig.height), IPL_DEPTH_8U, 3);
m_noise_merge_img = cvCreateImage(cvSize(m_img_orig.width, m_img_orig.height), IPL_DEPTH_8U, 3);
- // InPortÌff[^
+ // InPortã®æ åãã¼ã¿
memcpy(m_image_buff->imageData,(void *)&(m_img_orig.pixels[0]), m_img_orig.pixels.length());
- // BGR©çO[XP[ÉÏ··é
+ // BGRããã°ã¬ã¼ã¹ã±ã¼ã«ã«å¤æãã
cvCvtColor( m_image_buff, m_gray_buff, CV_BGR2GRAY );
- // O[XP[©ç2lÉÏ··é
- cvThreshold( m_gray_buff, m_binary_buff, THRESHOLD, THRESHOLD_MAX_VALUE, CV_THRESH_BINARY );
+ // ã°ã¬ã¼ã¹ã±ã¼ã«ãã2å¤ã«å¤æãã
+ cvThreshold( m_gray_buff, m_binary_buff, m_nThreshold, THRESHOLD_MAX_VALUE, CV_THRESH_BINARY );
- //Dilation/ErosionðsÁÄmCYðÁ·
+ //Dilation/Erosionãè¡ã£ã¦ãã¤ãºãæ¶ã
cvDilate(m_binary_buff, m_dilation_buff, NULL, m_count_dilation);
cvErode(m_dilation_buff, m_erosion_buff, NULL, m_count_erosion);
- //DilationÌÝs¤
+ //Dilationã®ã¿è¡ã
cvDilate(m_binary_buff, m_dilation_image, NULL, m_count_dilation);
- //ErosionÌÝs¤
+ //Erosionã®ã¿è¡ã
cvErode(m_binary_buff, m_erosion_image, NULL, m_count_erosion);
- // æf[^ÌTCYæ¾
+ // ç»åãã¼ã¿ã®ãµã¤ãºåå¾
double len = (m_output_image_buff->nChannels * m_output_image_buff->width * m_output_image_buff->height);
m_img_out.pixels.length(len);
m_img_dilation.pixels.length(len);
m_img_erosion.pixels.length(len);
- //DilationImageð}[W·é
+ //DilationImageããã¼ã¸ãã
cvMerge(m_dilation_image, m_dilation_image, m_dilation_image, NULL, m_dila_merge_img);
- //ErosionImageð}[W·é
+ //ErosionImageããã¼ã¸ãã
cvMerge(m_erosion_image, m_erosion_image, m_erosion_image, NULL, m_ero_merge_img);
- //mCYðÁµ½Imageð}[W·é
+ //ãã¤ãºãæ¶ããImageããã¼ã¸ãã
cvMerge(m_erosion_buff, m_erosion_buff, m_erosion_buff, NULL, m_noise_merge_img);
- // YÌC[WðMemCopy·é
+ // 該å½ã®ã¤ã¡ã¼ã¸ãMemCopyãã
memcpy((void *)&(m_img_out.pixels[0]), m_noise_merge_img->imageData, len);
memcpy((void *)&(m_img_dilation.pixels[0]), m_dila_merge_img->imageData, len);
memcpy((void *)&(m_img_erosion.pixels[0]), m_ero_merge_img->imageData, len);
- // ½]µ½æf[^ðOutPort©çoÍ·éB
+ // å転ããç»åãã¼ã¿ãOutPortããåºåããã
m_img_out.width = m_image_buff->width;
m_img_out.height = m_image_buff->height;
More information about the openrtm-commit
mailing list