MATLAB 矩阵转化为灰度图
A=[
1.00 0.96 0.98 0.88 0.94 0.61 0.96 0.80 0.98 0.89
0.96 1.00 0.94 0.90 0.95 0.71 0.96 0.83 0.90 0.88
0.98 0.94 1.00 0.84 0.91 0.54 0.93 0.73 0.97 0.90
0.88 0.90 0.84 1.00 0.89 0.85 0.94 0.94 0.80 0.82
0.94 0.95 0.91 0.89 1.00 0.72 0.94 0.84 0.90 0.90
0.61 0.71 0.54 0.85 0.72 1.00 0.74 0.90 0.48 0.64
0.96 0.96 0.93 0.94 0.94 0.74 1.00 0.90 0.92 0.87
0.80 0.83 0.73 0.94 0.84 0.90 0.90 1.00 0.70 0.75
0.98 0.90 0.97 0.80 0.90 0.48 0.92 0.70 1.00 0.85
0.89 0.88 0.90 0.82 0.90 0.64 0.87 0.75 0.85 1.00];
mat = A; %# A n-by-n matrix of random values from 0 to 1
imagesc(mat); %# Create a colored plot of the matrix values
colormap(flipud(gray)); %# Change the colormap to gray (so higher values are
%# black and lower values are white)
textStrings = num2str(mat(:),'%0.2f'); %# Create strings from the matrix values
textStrings = strtrim(cellstr(textStrings)); %# Remove any space padding
[x,y] = meshgrid(1:10); %# Create x and y coordinates for the strings,it should be set based on the number of labels.
hStrings = text(x(:),y(:),textStrings(:),... %# Plot the strings
'HorizontalAlignment','center');
midValue = mean(get(gca,'CLim')); %# Get the middle value of the color range
set(gca,'XTick',1:10,... %# Change the axes tick marks
'XTickLabel',{'能源','材料','工业','可选消费','日常消费','医疗保健','金融','信息技术','电信服务','公共事业'},... %# and tick labels
'YTick',1:10,...
'YTickLabel',{'能源','材料','工业','可选消费','日常消费','医疗保健','金融','信息技术','电信服务','公共事业'},...
'TickLength',[0 0]);
[x,y] = meshgrid(1:10); %# Create x and y coordinates for the strings
hStrings = text(x(:),y(:),textStrings(:),... %# Plot the strings
'HorizontalAlignment','center');
midValue = mean(get(gca,'CLim')); %# Get the middle value of the color range
textColors = repmat(mat(:) > midValue,1,3); %# Choose white or black for the
%# text color of the strings so
%# they can be easily seen over
%# the background color
set(hStrings,{'Color'},num2cell(textColors,2)); %# Change the text colors
MATLAB 矩阵转化为灰度图的更多相关文章
- caffe matlab 借口怎么提取灰度图的 feature ? What happened if I mixed the color images with gray images together for training ?
1. caffe matlab 接口提供了提取feature的脚本,但是由于中间要对这些图像进行RGB ---> BGR 的变换,卧槽,灰度图没有三通道啊?怎么破?从上午就在纠结怎么会跑着跑着程 ...
- 图像处理基础---RGB图 灰度图 索引图 调色板
(1)二进制图 在二进制图中,像素的取值为两个离散数值0或1中的一个,0代表黑色,1代表白色 例 A=[0 0 1;1 1 0; 0 0 1];>> imshow(A,'InitialMa ...
- C#机器视觉入门系列1-转化为灰度图&&3*3模糊
这是我入门机器视觉的系列学习经验之开篇,本来想着依靠opencv快速实现一些功能,但是想了一下既然是学数学的,还是应该自己多算算,写一些自己理解的东西才好. 入门篇很简单,就只是实现了转化成灰度图以及 ...
- S0.2 灰度图
目录 灰度图定义 灰度图优点 RGB转灰度算法(OpenCV3) 量化 算法公式 OpenCV自带函数实现 综合比较 灰度图定义 对于单色(灰度)图像而言,每个像素的亮度用一个数值来表示,通常数值范围 ...
- 怎么样用opencv将彩色图片转化成像素值只有0和255的灰度图?
分类: OpenCV [Q1]怎么样用opencv将彩色图片转化成像素值只有0和255的灰度图? 进行灰度化,IplImage* pImg = cvLoadImage( "C:\\1.b ...
- matlab中,在灰度解剖图上叠加阈值图,by by DR. Rajeev Raizada
1.参考 reference 1. tutorial主页:http://www.bcs.rochester.edu/people/raizada/fmri-matlab.htm. 2.speech_b ...
- Matlab 如何/怎样 读取图片 显示图片 转换成灰度图
% 读取图片 im = imread('路径') >> im = imread('ny.png'); % 显示图片 imshow(im) >> imshow(im) % 转换成 ...
- python将图片转化为字符图
最近看到将图片转化为字符图的小实验,我觉得很有趣,所以决定自己实现一下. 步骤和原理如下: 读取图片的灰度值矩阵(0-255之间),灰度值矩阵主要反映的是图片的黑白程度,越黑越接近与0,越白越接近于2 ...
- MATLAB矩阵操作大全
转载自:http://blog.csdn.net/dengjianqiang2011/article/details/8753807 MATLAB矩阵操作大全 一.矩阵的表示 在MATLAB中创建矩阵 ...
随机推荐
- html之a标签
屏蔽跳转 1.href属性删除 2.href="javascript:void(0);" void是一个操作符,void(0)返回undefined,地址不发生跳转. 3.s ...
- [SAP ABAP开发技术总结]ABAP程序之间数据共享与传递
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- ios 学习线路(图片)(摘录)
iOS学习路线
- unity3d中asset store 的资源下载到本地的目录位置
来源:http://blog.csdn.net/fzhlee/article/details/8613688 C:/Users/[当前用户]/AppData/Roaming/Unity/Asset S ...
- C# 线程(六):定时器
From : http://kb.cnblogs.com/page/42532/ Timer类:设置一个定时器,定时执行用户指定的函数. 定时器启动后,系统将自动建立一个新的线程,执行用户指定的函数. ...
- Maven仓库构建
什么是Maven仓库 在不用Maven的时候,比如说以前我们用Ant构建项目,在项目目录下,往往会看到一个名为/lib的子目录,那里存放着各类第三方依赖jar文件,如log4j.jar,junit.j ...
- Web浏览器的缓存机制
Web缓存的工作原理 所有的缓存都是基于一套规则来帮助他们决定什么时候使用缓存中的副本提供服务(假设有副本可用的情况下,未被销毁回收或者未被删除修改).这些规则有的在协议中有定义(如HTTP协议1.0 ...
- Android5.0新控件CardView的介绍和使用
CardView也是5.0的新控件,这控件其实就是一个卡片啦,当然我们自己也完全可以定义这样一个卡片,从现在的微博等社App中可以看到各式各样的自定义卡片,所以这个控件意义不是很大.suppor ...
- Apache mod_jk
http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html http://tomcat.apache.org/co ...
- hiho_1078_线段树区间修改
题目 给定一组数,要求进行若干次操作,这些操作可以分为两种类型: (1) CMD 1 beg end value 将数组中下标在[beg, end] 区间内数字都变为value (2) CMD 2 b ...