**問題:**OpenCV的imshow無法正常顯示圖片
**解決方法:**在imshow()語句下一句添加waitKey(30)?
~~~
int main()
{
inputImg = imread("input.bmp");
imshow("input image", inputImg);//顯示原圖
//waitKey(30);
imgSplit(inputImg);//求取M(x)
imgBlur(mImg);//均值濾波
imgAvg(mImg);//求M(x)中所有元素均值
imgL(blurImg, mImg);//求L(x)
imgMaxInput(inputImg);//求maxImg
A = imgA(imgMaxpx(blurImg), imgMaxpx(maxImg));//求A
imgDefogged(inputImg);//去霧
imshow("defoggedImg", defoggedImg);//顯示去霧后的圖
imwrite("defoggedImg.bmp", defoggedImg);
//waitKey(0);
system("pause");
return 0;
}
~~~

~~~
#include<opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv/cv.h>
using namespace std;
using namespace cv;
int main()
{
inputImg = imread("input.bmp");
imshow("input image", inputImg);//顯示原圖
waitKey(30);
imgSplit(inputImg);//求取M(x)
imgBlur(mImg);//均值濾波
imgAvg(mImg);//求M(x)中所有元素均值
imgL(blurImg, mImg);//求L(x)
imgMaxInput(inputImg);//求maxImg
A = imgA(imgMaxpx(blurImg), imgMaxpx(maxImg));//求A
imgDefogged(inputImg);//去霧
imshow("defoggedImg", defoggedImg);//顯示去霧后的圖
imwrite("defoggedImg.bmp", defoggedImg);
waitKey(0);
system("pause");
return 0;
}
~~~

