[openrtm-commit:01133] r103 - in branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram: include/Histogram src
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 11月 14日 (木) 16:48:22 JST
Author: kawauchi
Date: 2013-11-14 16:48:22 +0900 (Thu, 14 Nov 2013)
New Revision: 103
Modified:
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/include/Histogram/Histogram.h
branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/src/Histogram.cpp
Log:
Histogram component: Align the indentation, and converted to the UTF-8 character code. refs #2704
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/include/Histogram/Histogram.h
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/include/Histogram/Histogram.h 2013-10-11 08:40:29 UTC (rev 102)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/include/Histogram/Histogram.h 2013-11-14 07:48:22 UTC (rev 103)
@@ -24,15 +24,15 @@
#include <cxcore.h>
#include <highgui.h>
-#define DIMENSIONS 1 // qXgO̳
-#define UNIFORM 1 // êl«ÉÖ·étO
-#define ACCUMULATE 0 // vZtO
-#define TRACKBAR_MAX_VALUE 200 // gbNo[ÌÅål
+#define DIMENSIONS 1 // ãã¹ãã°ã©ã ã®æ¬¡å
æ°
+#define UNIFORM 1 // ä¸æ§æ§ã«é¢ãããã©ã°
+#define ACCUMULATE 0 // è¨ç®ãã©ã°
+#define TRACKBAR_MAX_VALUE 200 // ãã©ãã¯ãã¼ã®æ大å¤
-#define SCALE_SHIFT 0 // XP[Oµ½üÍzñÌvfÉÁ¦él
-#define LINE_THICKNESS -1 // ü̾³
-#define LINE_TYPE 1 // üÌíÞ
-#define SHIFT 0 // ÀW̬_ȺÌ
ð\·rbg
+#define SCALE_SHIFT 0 // ã¹ã±ã¼ãªã³ã°ããå
¥åé
åã®è¦ç´ ã«å ããå¤
+#define LINE_THICKNESS -1 // ç·ã®å¤ªã
+#define LINE_TYPE 1 // ç·ã®ç¨®é¡
+#define SHIFT 0 // 座æ¨ã®å°æ°ç¹ä»¥ä¸ã®æ¡ã表ããããæ°
// Service implementation headers
// <rtc-template block="service_impl_h">
@@ -299,14 +299,14 @@
// <rtc-template block="private_operation">
// </rtc-template>
- IplImage* imageBuff; // JÌC[W
+ IplImage* imageBuff; // ã«ã¡ã©ã®ã¤ã¡ã¼ã¸
IplImage* grayImage;
IplImage* destinationImage;
IplImage* histogramImage;
IplImage* histogramBarImage;
CvHistogram *histogram;
- CvMat* lookUpTableMatrix; // ZxÎsñ
+ CvMat* lookUpTableMatrix; // æ¿åº¦å¯¾å¿è¡å
int histogramSize;
int bin_w;
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/src/Histogram.cpp
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/src/Histogram.cpp 2013-10-11 08:40:29 UTC (rev 102)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/Histogram/src/Histogram.cpp 2013-11-14 07:48:22 UTC (rev 103)
@@ -115,35 +115,35 @@
RTC::ReturnCode_t Histogram::onActivated(RTC::UniqueId ec_id)
{
- // C[WpÌú»
+ // ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®åæå
imageBuff = NULL;
grayImage = NULL;
destinationImage = NULL;
histogramImage = NULL;
histogramBarImage = NULL;
- // OutPortæÊTCYÌú»
+ // OutPortç»é¢ãµã¤ãºã®åæå
m_image_histogram.width = 0;
m_image_histogram.height = 0;
m_image_histogramImage.width = 0;
m_image_histogramImage.height = 0;
- // qXgOÉ`æ³êéc_Ì
+ // ãã¹ãã°ã©ã ã«æç»ããã縦æ£ã®æ°
histogramSize = 128;
- // qXgOÌÍÍ
+ // ãã¹ãã°ã©ã ã®ç¯å²
range_0[0] = 0;
range_0[1] = 256;
- // qXgOe³ÌÍÍð¦·zñÌ|C^
+ // ãã¹ãã°ã©ã å次å
ã®ç¯å²ã示ãé
åã®ãã¤ã³ã¿
ranges[0] = range_0 ;
- // qXgOð¶¬
+ // ãã¹ãã°ã©ã ãçæ
histogram = cvCreateHist( DIMENSIONS, &histogramSize, CV_HIST_ARRAY, ranges, UNIFORM );
- // sñð¶¬
+ // è¡åãçæ
lookUpTableMatrix = cvCreateMatHeader( 1, 256, CV_8UC1 );
- // ZxÎsñÉZxÎ\ðZbg
+ // æ¿åº¦å¯¾å¿è¡åã«æ¿åº¦å¯¾å¿è¡¨ãã»ãã
cvSetData( lookUpTableMatrix, lookUpTable, NULL );
return RTC::RTC_OK;
@@ -154,7 +154,7 @@
{
if( imageBuff != NULL )
{
- // C[WpÌðú
+ // ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªã®è§£æ¾
cvReleaseImage(&imageBuff);
cvReleaseImage(&grayImage);
cvReleaseImage(&destinationImage);
@@ -168,18 +168,18 @@
RTC::ReturnCode_t Histogram::onExecute(RTC::UniqueId ec_id)
{
- // Vµ¢f[^Ì`FbN
+ // æ°ãããã¼ã¿ã®ãã§ãã¯
if(m_image_origIn.isNew()){
- // InPortf[^ÌÇÝÝ
+ // InPortãã¼ã¿ã®èªã¿è¾¼ã¿
m_image_origIn.read();
- // InPortÆOutPortÌæÊTCY¨æÑC[WpmÛ
+ // InPortã¨OutPortã®ç»é¢ãµã¤ãºå¦çããã³ã¤ã¡ã¼ã¸ç¨ã¡ã¢ãªç¢ºä¿
if(m_image_orig.width != m_image_histogram.width || m_image_orig.height != m_image_histogram.height)
{
m_image_histogram.width = m_image_histogramImage.width = m_image_orig.width;
m_image_histogram.height = m_image_histogramImage.height = m_image_orig.height;
- // InPortÌC[WTCYªÏX³ê½ê
+ // InPortã®ã¤ã¡ã¼ã¸ãµã¤ãºãå¤æ´ãããå ´å
if( imageBuff != NULL )
{
cvReleaseImage(&imageBuff);
@@ -189,108 +189,108 @@
cvReleaseImage(&histogramBarImage);
}
- // 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 = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 1 );
histogramImage = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 3 );
histogramBarImage = cvCreateImage( cvSize(m_image_orig.width, m_image_orig.height), IPL_DEPTH_8U, 3 );
- // qXgOÌc_Ì¡ðvZ·é
+ // ãã¹ãã°ã©ã ã®ç¸¦æ£ã®æ¨ªå¹
ãè¨ç®ãã
bin_w = cvRound( ( double )histogramBarImage->width / histogramSize );
}
- // 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);
- int brightness = m_brightness - TRACKBAR_MAX_VALUE / 2; // Pxl
- int contrast = m_contrast - TRACKBAR_MAX_VALUE / 2; // RgXg
+ int brightness = m_brightness - TRACKBAR_MAX_VALUE / 2; // è¼åº¦å¤
+ int contrast = m_contrast - TRACKBAR_MAX_VALUE / 2; // ã³ã³ãã©ã¹ã
if ( contrast > 0 ) {
- double delta = 127.0 * contrast / 100.0;
- double a = 255.0 / ( 255.0 - delta * 2 );
- double b = a * ( brightness - delta );
- for (int i = 0; i < 256; i++ ){
- // Ï·ãÌK²ðßé
- int v = cvRound( a * i + b );
- if( v < 0 ){
- v = 0;
- }
- if( v > 255 ){
- v = 255;
- }
- lookUpTable[i] = ( unsigned char )v;
+ double delta = 127.0 * contrast / 100.0;
+ double a = 255.0 / ( 255.0 - delta * 2 );
+ double b = a * ( brightness - delta );
+ for (int i = 0; i < 256; i++ ){
+ // å¤æå¾ã®é調ãæ±ãã
+ int v = cvRound( a * i + b );
+ if( v < 0 ){
+ v = 0;
}
- } else {
- double delta = -128.0 * contrast / 100.0;
- double a = (256.0 - delta * 2.0) / 255.0;
- double b = a * brightness + delta;
- for(int i = 0; i < 256; i++ ){
- int v = cvRound( a * i + b);
- if( v < 0 ){
- v = 0;
- }
- if( v > 255 ){
- v = 255;
- }
- lookUpTable[i] = ( unsigned char )v;
+ if( v > 255 ){
+ v = 255;
}
+ lookUpTable[i] = ( unsigned char )v;
}
+ } else {
+ double delta = -128.0 * contrast / 100.0;
+ double a = (256.0 - delta * 2.0) / 255.0;
+ double b = a * brightness + delta;
+ for(int i = 0; i < 256; i++ ){
+ int v = cvRound( a * i + b);
+ if( v < 0 ){
+ v = 0;
+ }
+ if( v > 255 ){
+ v = 255;
+ }
+ lookUpTable[i] = ( unsigned char )v;
+ }
+ }
- // ZxÎsñðp¢½ZxK²Ï·ðs¤
+ // æ¿åº¦å¯¾å¿è¡åãç¨ããæ¿åº¦é調å¤æãè¡ã
cvLUT( grayImage, destinationImage, lookUpTableMatrix );
- // O[XP[©çRGBÉÏ·
+ // ã°ã¬ã¼ã¹ã±ã¼ã«ããRGBã«å¤æ
cvCvtColor( destinationImage, histogramImage, CV_GRAY2RGB );
- // æf[^ÌTCYæ¾
+ // ç»åãã¼ã¿ã®ãµã¤ãºåå¾
int len = histogramImage->nChannels * histogramImage->width * histogramImage->height;
m_image_histogramImage.pixels.length(len);
- // Ï]µ½æf[^ðOutPortÉRs[
+ // å¤è»¢ããç»åãã¼ã¿ãOutPortã«ã³ãã¼
memcpy((void *)&(m_image_histogramImage.pixels[0]), histogramImage->imageData,len);
- // Ï]µ½æf[^ðOutPort©çoÍ
+ // å¤è»¢ããç»åãã¼ã¿ãOutPortããåºå
m_image_histogramImageOut.write();
- // æÌqXgOðvZ·é
+ // ç»åã®ãã¹ãã°ã©ã ãè¨ç®ãã
cvCalcHist( &destinationImage, histogram, ACCUMULATE, NULL );
float max_value = 0;
- // qXgOlÌÅålð¾é
- cvGetMinMaxHistValue( histogram, NULL, &max_value, NULL, NULL );
+ // ãã¹ãã°ã©ã å¤ã®æ大å¤ãå¾ã
+ cvGetMinMaxHistValue( histogram, NULL, &max_value, NULL, NULL );
- // qXgOðÅålÉæÁijK»·é
+ // ãã¹ãã°ã©ã ãæ大å¤ã«ãã£ã¦æ£è¦åãã
cvConvertScale( histogram->bins, histogram->bins,
( ( double )histogramBarImage->height ) / max_value, SCALE_SHIFT );
- // qXgOæðÅú»·é
+ // ãã¹ãã°ã©ã ç»åãç½ã§åæåãã
cvSet( histogramBarImage, cvScalarAll( 255 ), NULL );
- // qXgOÌc_ð`æ·é
+ // ãã¹ãã°ã©ã ã®ç¸¦æ£ãæç»ãã
for ( int i = 0; i < histogramSize; i++ ) {
- cvRectangle(
- histogramBarImage,
- cvPoint( i * bin_w, histogramBarImage->height ),
- cvPoint( ( i + 1 ) * bin_w,histogramBarImage->height - cvRound( cvGetReal1D( histogram->bins, i) ) ),
- cvScalarAll( 0 ),
- LINE_THICKNESS,
- LINE_TYPE,
- SHIFT
- );
+ cvRectangle(
+ histogramBarImage,
+ cvPoint( i * bin_w, histogramBarImage->height ),
+ cvPoint( ( i + 1 ) * bin_w,histogramBarImage->height - cvRound( cvGetReal1D( histogram->bins, i) ) ),
+ cvScalarAll( 0 ),
+ LINE_THICKNESS,
+ LINE_TYPE,
+ SHIFT
+ );
}
- // æf[^ÌTCYæ¾
+ // ç»åãã¼ã¿ã®ãµã¤ãºåå¾
len = histogramBarImage->nChannels * histogramBarImage->width * histogramBarImage->height;
m_image_histogram.pixels.length(len);
- // Ï]µ½æf[^ðOutPortÉRs[
+ // å¤è»¢ããç»åãã¼ã¿ãOutPortã«ã³ãã¼
memcpy((void *)&(m_image_histogram.pixels[0]), histogramBarImage->imageData,len);
- // Ï]µ½æf[^ðOutPort©çoÍ
+ // å¤è»¢ããç»åãã¼ã¿ãOutPortããåºå
m_image_histogramOut.write();
}
More information about the openrtm-commit
mailing list