Opencv— — mix channels
// define head function
#ifndef PS_ALGORITHM_H_INCLUDED
#define PS_ALGORITHM_H_INCLUDED
#include <iostream>
#include <string>
#include "cv.h"
#include "highgui.h"
#include "cxmat.hpp"
#include "cxcore.hpp"
#include "math.h"
using namespace std;
using namespace cv;
void Show_Image(Mat&, const string &);
#endif // PS_ALGORITHM_H_INCLUDED
// The program will mix the color channels.
#include "PS_Algorithm.h"
int main()
{
string Image_name("4.jpg");
Mat Image=imread(Image_name.c_str());
Mat Image_test(Image.size(),CV_32FC3);
Image.convertTo(Image_test, CV_32FC3);
Mat New_img(Image_test.size(), CV_32FC3);
Mat r, g, b;
Mat bgr[]={b,g,r};
split(Image_test, bgr);
b=bgr[0];
g=bgr[1];
r=bgr[2];
float blueGreen, redBlue, greenRed;
blueGreen=0.5;
redBlue=0.5;
greenRed=0.5;
float intoR, intoG, intoB;
intoR=0.75;
intoG=0.25,
intoB=0.75;
Mat N_R(r.size(), CV_32FC1);
Mat N_G(r.size(), CV_32FC1);
Mat N_B(r.size(), CV_32FC1);
Mat new_bgr[]={N_B, N_G, N_R};
N_R=(intoR * (blueGreen*g+(1-blueGreen)*b) + (1-intoR)*r);
N_G=(intoG * (redBlue*b+(1-redBlue)*r) + (1-intoG)*g);
N_B=(intoB * (greenRed*r+(1-greenRed)*g) + (1-intoB)*b);
merge(new_bgr, 3, New_img);
New_img=New_img/255.0;
Show_Image(New_img, "New_img");
cout<<"All is well."<<endl;
waitKey();
}
// define the show image
#include "PS_Algorithm.h"
#include <iostream>
#include <string>
using namespace std;
using namespace cv;
void Show_Image(Mat& Image, const string& str)
{
namedWindow(str.c_str(),CV_WINDOW_AUTOSIZE);
imshow(str.c_str(), Image);
}
图像效果:
http://blog.csdn.net/matrix_space/article/details/46790129
Opencv— — mix channels的更多相关文章
- Convolutions in TensorFlow
Convolutions in TensorFlow Convolutions without training You might already be familiar with the term ...
- Tensorflow.nn 核心模块详解
看过前面的例子,会发现实现深度神经网络需要使用 tensorflow.nn 这个核心模块.我们通过源码来一探究竟. # Copyright 2015 Google Inc. All Rights Re ...
- [OpenCV] Samples 16: Decompose and Analyse RGB channels
物体的颜色特征决定了灰度处理不是万能,对RGB分别处理具有相当的意义. #include <iostream> #include <stdio.h> #include &quo ...
- OpenCV中对Mat里面depth,dims,channels,step,data,elemSize和数据地址计算的理解 (转)
cv::Matdepth/dims/channels/step/data/elemSizeThe class Mat represents an n-dimensional dense numeric ...
- OpenCV 用二进制位表示 type & channels 的方式
OpenCV 的类型与通道的表示方法. 参考文件 https://github.com/opencv/opencv/blob/05b15943d6a42c99e5f921b7dbaa8323f3c04 ...
- OpenCV中对Mat里面depth,dims,channels,step,data,elemSize和数据地址计算的理解
原文:OpenCV中对Mat里面depth,dims,channels,step,data,elemSize和数据地址计算的理解 Title : cv::Mat depth/dims/channels ...
- OpenCV Error: Assertion failed (src.size == dst.size && src.channels() == dst.channels()) in cvConvertScale
发现问题:在做kinect采集的深度图去噪的时候遇到了cvConvertScale格式转换的问题. OpenCV Error: Assertion failed (src.size == dst.si ...
- opencv inrange 和 mix
opencv inrange: http://blog.csdn.net/xiaoyufei117122/article/details/53572904 http://blog.csdn.net/w ...
- opencv源码:cascadedetect
级联分类器检测类CascadeClassifier,提供了两个重要的方法: CascadeClassifier cascade_classifier; cascade_classifier.load( ...
随机推荐
- CheckedListBoxControl 或CheckedListBox 控件中显示水平滚动条 z
public partial class Form1 : Form { public Form1() { InitializeComponent(); DisplayHScroll(); } /// ...
- POJ3114 有些图缩点/改图/最短路
没想到手感还在~ 不须要又一次建图.仅仅要依据条件改改权值就可以. 还跑k次SPFA~ #include<cstdio> #include<iostream> #include ...
- springMVC前后端分离开发模式下支持跨域请求
1.web.xml中添加cors规则支持(请修改包名) <filter> <filter-name>cors</filter-name> <filter-cl ...
- 启动eclipse时出现“Failed to load the JNI shared library jvm.dll”错误及解决-及eclipse版本查看
启动eclipse时出现“Failed to load the JNI shared library jvm.dll”错误及解决-及eclipse版本查看 学习了:https://www.cnblog ...
- 2016 第七届蓝桥杯 c/c++ B组省赛真题及解题报告
2016 第七届蓝桥杯 c/c++ B组省赛真题及解题报告 勘误1:第6题第4个 if最后一个条件粗心写错了,答案应为1580. 条件应为abs(a[3]-a[7])!=1,宝宝心理苦啊.!感谢zzh ...
- mysql主从一致问题
https://www.cnblogs.com/gomysql/p/3662264.html
- C#动态编译dll或exe
string strCode = @" using System; using System.Text; using System.Collections.Generic; using Sy ...
- 图像处理算法2——Otsu最佳阈值分割法http://blog.csdn.net/xiaqunfeng123/article/details/17121195
http://blog.csdn.net/xiaqunfeng123/article/details/17121195Otsu法是1979年由日本大津提出的.该方法在类间方差最大的情况下是最佳的,即统 ...
- OI知识体系
- VMware安装ubuntu学习笔记(只是笔记)
VMware安装ubuntu开机黑屏/死机 1- Edit Ubuntu VM Configuration file (.vmx) 2- Add the following line cpuid.1. ...