void ShowHistogram(float ** patchFeature, int patchNum)
{
IplImage *HistImg = cvCreateImage(cvSize(4000,600),IPL_DEPTH_8U,3);
cvZero(HistImg);
int binNum = patchNum*16;
int bin_w = HistImg->width/binNum;
int i,j,binnum=0;
float value;
for(i=0;i<patchNum;i++)
{
for(j=0;j<16;j++,binnum++)
{
value = patchFeature[i][j]*600;
CvScalar color = CV_RGB(255,255,255);
cvRectangle( HistImg, cvPoint(binnum*bin_w,HistImg->height),
cvPoint((binnum+1)*bin_w,(float)(HistImg->height - value)),
color, 1, 8, 0 );
}
}
cvSaveImage("apple3.jpg",HistImg);
cvReleaseImage(&HistImg);
}