题目内容

以下是用LUT实现的自动对比度调整算法,请填空完成。/*输入参数:unsigned char *img8位灰度图像位图数据首地址int count图像像素个数输出参数:unsigned char *img8位灰度图像位图数据首地址功能:8位灰度图像的自动对比度增强*/void AutoContrast(unsigned char *img,int count){//求取图像中的最小像素值和最大像素值int grayLow = 255, grayHigh = 0;int i;unsigned char *p = img;for(i = 0; i < count; i++){if(*p < grayLow) grayLow = *p;if(*p > grayHigh) grayHigh = *p;p++;}if(grayHigh - grayLow == 0)return;//图像中的灰度值均相等,无法进行自动对比度调整unsigned char LUT[256];for(i = 0; i < 256;i++){LUT[i] = (i - _____________) *255/ ( grayHigh - grayLow );}//自动对比度映射p = img;for(i = 0; i < count; i++){*p++ =________________;}}

查看答案
更多问题

以下是二维高斯滤波器的xy分离实现形式。请填空。*输入参数:const unsigned char *src_data输入的8位灰度图像位图数据首地址int cols 像素列数int rows 像素行数double sigma 标准差输出参数:unsigned char *dst_data高斯滤波后的8位灰度图像位图数据首地址功能:8位灰度图像的二维高斯滤波*/void GaussianFilter(const unsigned char *src_data, unsigned char *dst_data,int cols,int rows,double sigma){int i,j,m,n;float sum=0;int center = (int)(3 * sigma);//3sigma原理int length = ____________;float* kernel = new float[length];double sigma2 = sigma*sigma;//由高斯公式计算滤波系数for(i = 0;i

图像几何变换一般包括两个步骤:空间变换和____________________

以下程序用OpenCV读入一幅彩色图像并显示。#include #include #include using namespace cv;using namespace std;int main( int argc, char** argv ){______________ image;image = ______________ (argv[1], CV_LOAD_IMAGE_COLOR);namedWindow( "Display window",CV_WINDOW_AUTOSIZE );_____________( "Display window", image );waitKey(0);return 0;}

以下程序先读入一幅彩色图像,然后将其转换为灰度图像后再将灰度图像保存成文件,最后显示彩色图像和灰度图像,请将程序补充完整。int main( int argc, char** argv ){char* imageName = argv[1];Mat image;image = imread( imageName, CV_LOAD_IMAGE_COLOR);Mat gray_image;_________( image, gray_image, CV_RGB2GRAY,1);_________( "../../images/Gray_Image.jpg", gray_image );namedWindow( imageName, CV_WINDOW_AUTOSIZE );namedWindow( "Gray image", CV_WINDOW_AUTOSIZE );_________ ( imageName, image );imshow( "Gray image", gray_image );waitKey(0);return 0;}

答案查题题库