对图像进行指数变换并分别以三通道输出

这篇博客详细介绍了如何对图像进行指数变换,并探讨了如何将变换后的图像以三通道的形式进行输出,内容涵盖了图像处理的基础知识和具体操作步骤。
摘要由CSDN通过智能技术生成

2018/8/23正确版本如下:

#include <iostream>  
#include <string.h>
#include <opencv2/core/core.hpp>  
#include <opencv2/highgui/highgui.hpp>  
#include <opencv2\core\mat.hpp>
#include<opencv2/opencv.hpp>
#define e 2.71828182845
using namespace cv;
using namespace std;

void main()
{
	Mat img = imread("pic2.jpg");//读取图像img。0表示转换为灰度图像读入
	imshow("原图", img);
	waitKey(0);
	int height = img.rows;
	int width = img.cols; 
	//浮点变换
	Mat fimg(height, width, CV_32FC3);
	img.convertTo(fimg, CV_32FC3,1/255.0);
	
	//将修改后的像素值放入另一个图片中
	Mat fimg2(height,width, CV_32FC3);
	for (int row = 0; row < height; row++)
		for (int col = 0; col < width; col++)
		{
			
			fimg2.at<Vec3f>(row, col)[0] = float(pow(fimg.at<Vec3f>(row, col)[0], e));
			fimg2.at<Vec3f>(row, col)[1] = float(pow(fimg.at<Vec3f>(row, col)[1], e));
			fimg2.at<Vec3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值