图像优化毕业论文求帮助,急急急急急!

weixin_37696991 2017-05-05 03:15:22
论文题目是图像优化算法,本人对图像优化不了解,于是写论文时就用的论坛里的代码。
现在导师要求写出:计算流程,配算法说明
可是我看不懂给出的算法代码,所以贴出借鉴的代码,希望有好心人能够帮忙写一下计算流程和算法说明
总共有四种算法,第一种:灰度直方图均衡化
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

using namespace cv;

int main(int argc, char *argv[])
{
Mat image = imread("Test.jpg", 1);
if (image.empty())
{
std::cout << "打开图片失败,请检查" << std::endl;
return -1;
}
imshow("原图像", image);
Mat imageRGB[3];
split(image, imageRGB);
for (int i = 0; i < 3; i++)
{
equalizeHist(imageRGB[i], imageRGB[i]);
}
merge(imageRGB, 3, image);
imshow("直方图均衡化图像增强效果", image);
waitKey();
return 0;
}



第二种:拉普拉斯算子增强
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

using namespace cv;

int main(int argc, char *argv[])
{
Mat image = imread("Test.jpg", 1);
if (image.empty())
{
std::cout << "打开图片失败,请检查" << std::endl;
return -1;
}
imshow("原图像", image);
Mat imageEnhance;
Mat kernel = (Mat_<float>(3, 3) << 0, -1, 0, 0, 5, 0, 0, -1, 0);
filter2D(image, imageEnhance, CV_8UC3, kernel);
imshow("拉普拉斯算子图像增强效果", imageEnhance);
waitKey();
return 0;
}




第三种:log对数变换
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;

int main(int argc, char *argv[])
{
Mat image = imread("Test.jpg");
Mat imageLog(image.size(), CV_32FC3);
for (int i = 0; i < image.rows; i++)
{
for (int j = 0; j < image.cols; j++)
{
imageLog.at<Vec3f>(i, j)[0] = log(1 + image.at<Vec3b>(i, j)[0]);
imageLog.at<Vec3f>(i, j)[1] = log(1 + image.at<Vec3b>(i, j)[1]);
imageLog.at<Vec3f>(i, j)[2] = log(1 + image.at<Vec3b>(i, j)[2]);
}
}
//归一化到0~255
normalize(imageLog, imageLog, 0, 255, CV_MINMAX);
//转换成8bit图像显示
convertScaleAbs(imageLog, imageLog);
imshow("Soure", image);
imshow("after", imageLog);
waitKey();
return 0;
}



第四种:伽马变换
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;

int main(int argc, char *argv[])
{
Mat image = imread("Test.jpg");
Mat imageGamma(image.size(), CV_32FC3);
for (int i = 0; i < image.rows; i++)
{
for (int j = 0; j < image.cols; j++)
{
imageGamma.at<Vec3f>(i, j)[0] = (image.at<Vec3b>(i, j)[0])*(image.at<Vec3b>(i, j)[0])*(image.at<Vec3b>(i, j)[0]);
imageGamma.at<Vec3f>(i, j)[1] = (image.at<Vec3b>(i, j)[1])*(image.at<Vec3b>(i, j)[1])*(image.at<Vec3b>(i, j)[1]);
imageGamma.at<Vec3f>(i, j)[2] = (image.at<Vec3b>(i, j)[2])*(image.at<Vec3b>(i, j)[2])*(image.at<Vec3b>(i, j)[2]);
}
}
//归一化到0~255
normalize(imageGamma, imageGamma, 0, 255, CV_MINMAX);
//转换成8bit图像显示
convertScaleAbs(imageGamma, imageGamma);
imshow("原图", image);
imshow("伽马变换图像增强效果", imageGamma);
waitKey();
return 0;
}



求各位大神帮忙写一下计算流程和算法说明。跪谢!!!!!!!!!!!
...全文
366 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2017-05-11
  • 打赏
  • 举报
回复
logaB=lnB/lna
赵4老师 2017-05-11
  • 打赏
  • 举报
回复
log, log10 Calculates logarithms. double log( double x ); double log10( double x ); Routine Required Header Compatibility log <math.h> ANSI, Win 95, Win NT log10 <math.h> ANSI, Win 95, Win NT For additional compatibility information, see Compatibility in the Introduction. Libraries LIBC.LIB Single thread static library, retail version LIBCMT.LIB Multithread static library, retail version MSVCRT.LIB Import library for MSVCRT.DLL, retail version Return Value The log functions return the logarithm of x if successful. If x is negative, these functions return an indefinite (same as a quiet NaN). If x is 0, they return INF (infinite). You can modify error handling by using the _matherr routine. Parameter x Value whose logarithm is to be found Example /* LOG.C: This program uses log and log10 * to calculate the natural logarithm and * the base-10 logarithm of 9,000. */ #include <math.h> #include <stdio.h> void main( void ) { double x = 9000.0; double y; y = log( x ); printf( "log( %.2f ) = %f\n", x, y ); y = log10( x ); printf( "log10( %.2f ) = %f\n", x, y ); } Output log( 9000.00 ) = 9.104980 log10( 9000.00 ) = 3.954243 Floating-Point Support Routines See Also exp, _matherr, pow
weixin_37696991 2017-05-10
  • 打赏
  • 举报
回复
Mat image = imread("Test.jpg"); Mat imageLog(image.size(), CV_32FC3); for (int i = 0; i < image.rows; i++) { for (int j = 0; j < image.cols; j++) { imageLog.at<Vec3f>(i, j)[0] = log(1 + image.at<Vec3b>(i, j)[0]); imageLog.at<Vec3f>(i, j)[1] = log(1 + image.at<Vec3b>(i, j)[1]); imageLog.at<Vec3f>(i, j)[2] = log(1 + image.at<Vec3b>(i, j)[2]); } } 哪位大神能告诉我,我如果要修改log的参数应该怎么改。
赵4老师 2017-05-08
  • 打赏
  • 举报
回复
提醒:OpenCV是开源的。
叶恭介叶恭介 2017-05-06
  • 打赏
  • 举报
回复
只调用opencv函数,写不了什么东西,还是楼主将这些算法自己实现出来吧,网上不是有写好的代码吗,赶紧吧
weixin_37696991 2017-05-05
  • 打赏
  • 举报
回复
主要的时间已经不够了,所以才求助的。有没有大神能够帮忙解释一下
三岁、就很帅 2017-05-05
  • 打赏
  • 举报
回复
都是写常见算法 百度看介绍就有了啊 你拿这个当论文 你能过的去么 没有自己的代码啊
Davis_Dai 2017-05-05
  • 打赏
  • 举报
回复
这些代码完全没意义,核心算法的函数定义没有。建议直接查图像算法的资料吧,这种东西应该不难找。

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧