資源簡介
1、詳情看博客http://blog.csdn.net/raby_gyl/article/details/12450885

代碼片段和文件信息
//------------------------------------------------------------------------------
//?Graphing?functions?for?OpenCV. Part?of?“ImageUtils.cpp“?a?set?of?handy?utility?functions?for?dealing?with?images?in?OpenCV.
//?by?Shervin?Emami?(http://www.shervinemami.co.cc/)?on?20th?May?2010.
//------------------------------------------------------------------------------
#define?USE_HIGHGUI //?Enable?this?to?display?graph?windows?using?OpenCV‘s?HighGUI.?(Supports?Windows?Linux?&?Mac?but?not?iPhone).
#include?
#include?
//#include?
//?OpenCV
#include?
#include?
#ifdef?USE_HIGHGUI
#include?
#endif
#ifndef?UCHAR
typedef?unsigned?char?UCHAR;
#endif
#include?“GraphUtils.h“
//------------------------------------------------------------------------------
//?Graphing?functions
//------------------------------------------------------------------------------
const?CvScalar?BLACK?=?CV_RGB(000);
const?CvScalar?WHITE?=?CV_RGB(255255255);
const?CvScalar?GREY?=?CV_RGB(150150150);
int?countGraph?=?0; //?Used?by?‘getGraphColor()‘
CvScalar?customGraphColor;
int?usingCustomGraphColor?=?0;
//?Get?a?new?color?to?draw?graphs.?Will?use?the?latest?custom?color?or?change?between?blue?green?red?dark-blue?dark-green?and?dark-red?until?a?new?image?is?created.
CvScalar?getGraphColor(void)
{
if?(usingCustomGraphColor)?{
usingCustomGraphColor?=?0;
return?customGraphColor;
}
countGraph++;
switch?(countGraph)?{
case?1: return?CV_RGB(6060255); //?light-blue
case?2: return?CV_RGB(6025560); //?light-green
case?3: return?CV_RGB(2556040); //?light-red
case?4: return?CV_RGB(0210210); //?blue-green
case?5: return?CV_RGB(1802100); //?red-green
case?6: return?CV_RGB(2100180); //?red-blue
case?7: return?CV_RGB(00185); //?dark-blue
case?8: return?CV_RGB(01850); //?dark-green
case?9: return?CV_RGB(18500); //?dark-red
default:
countGraph?=?0; //?start?rotating?through?colors?again.
return?CV_RGB(200200200); //?grey
}
}
//?Call?‘setGraphColor()‘?to?reset?the?colors?that?will?be?used?for?graphs.
void?setGraphColor(int?index)
{
countGraph?=?index;
usingCustomGraphColor?=?0; //?dont?use?a?custom?color.
}
//?Specify?the?exact?color?that?the?next?graph?should?be?drawn?as.
void?setCustomGraphColor(int?R?int?B?int?G)
{
customGraphColor?=?CV_RGB(R?G?B);
usingCustomGraphColor?=?1; //?show?that?it?will?be?used.
}
//?Draw?the?graph?of?an?array?of?floats?into?imageDst?or?a?new?image?between?minV?&?maxV?if?given.
//?Remember?to?free?the?newly?created?image?if?imageDst?is?not?given.
IplImage*?drawFloatGraph(const?float?*arraySrc?int?nArrayLength?IplImage?*imageDst?float?minV?float?maxV?int?width?int?height?char?*graphLabel?bool?showScale)
{
int?w?=?width;
int?h?=?height;
int?b?=?10; //?border?around?graph?within?the?image
if?(w?<=?20)
w?=?nArrayLength?+?b*2; //?width?of?the?image
if?(h
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????14810??2011-04-11?12:16??GraphUtils.cpp
?????文件????????3894??2010-06-02?00:40??GraphUtils.h
評論
共有 條評論