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 矩阵转化为灰度图的更多相关文章

  1. caffe matlab 借口怎么提取灰度图的 feature ? What happened if I mixed the color images with gray images together for training ?

    1. caffe matlab 接口提供了提取feature的脚本,但是由于中间要对这些图像进行RGB ---> BGR 的变换,卧槽,灰度图没有三通道啊?怎么破?从上午就在纠结怎么会跑着跑着程 ...

  2. 图像处理基础---RGB图 灰度图 索引图 调色板

    (1)二进制图 在二进制图中,像素的取值为两个离散数值0或1中的一个,0代表黑色,1代表白色 例 A=[0 0 1;1 1 0; 0 0 1];>> imshow(A,'InitialMa ...

  3. C#机器视觉入门系列1-转化为灰度图&&3*3模糊

    这是我入门机器视觉的系列学习经验之开篇,本来想着依靠opencv快速实现一些功能,但是想了一下既然是学数学的,还是应该自己多算算,写一些自己理解的东西才好. 入门篇很简单,就只是实现了转化成灰度图以及 ...

  4. S0.2 灰度图

    目录 灰度图定义 灰度图优点 RGB转灰度算法(OpenCV3) 量化 算法公式 OpenCV自带函数实现 综合比较 灰度图定义 对于单色(灰度)图像而言,每个像素的亮度用一个数值来表示,通常数值范围 ...

  5. 怎么样用opencv将彩色图片转化成像素值只有0和255的灰度图?

      分类: OpenCV [Q1]怎么样用opencv将彩色图片转化成像素值只有0和255的灰度图? 进行灰度化,IplImage* pImg = cvLoadImage( "C:\\1.b ...

  6. matlab中,在灰度解剖图上叠加阈值图,by by DR. Rajeev Raizada

    1.参考 reference 1. tutorial主页:http://www.bcs.rochester.edu/people/raizada/fmri-matlab.htm. 2.speech_b ...

  7. Matlab 如何/怎样 读取图片 显示图片 转换成灰度图

    % 读取图片 im = imread('路径') >> im = imread('ny.png'); % 显示图片 imshow(im) >> imshow(im) % 转换成 ...

  8. python将图片转化为字符图

    最近看到将图片转化为字符图的小实验,我觉得很有趣,所以决定自己实现一下. 步骤和原理如下: 读取图片的灰度值矩阵(0-255之间),灰度值矩阵主要反映的是图片的黑白程度,越黑越接近与0,越白越接近于2 ...

  9. MATLAB矩阵操作大全

    转载自:http://blog.csdn.net/dengjianqiang2011/article/details/8753807 MATLAB矩阵操作大全 一.矩阵的表示 在MATLAB中创建矩阵 ...

随机推荐

  1. 05_IOC容器装配Bean(注解方式)

    IOC容器装配Bean(注解方式) 1.使用注解方式进行Bean注册 xml 方式: <bean id="" class=""> spring2.5 ...

  2. 通知(NSNotificationCenter)

    // 监听加载更多的通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadMoreDeals ...

  3. 用Jenkins+Gradle+Jetty实现持续集成、测试、部署

    自动集成有很多种方案,本例用到的工具是Jenkins(前身Hudson)+Gradle+Jetty,关于Gradle可参考上一篇,Gradle常见问题. 本例项目名称: WAP Jetty 安装Jen ...

  4. 创建XML

    //创建XML XElement xelement = new XElement("request", new XElement("head", new XEl ...

  5. 一张png图片 上面有多个图标,如何用CSS准确的知道其中某个图片的坐标

    一张png图片 上面有多个图标,如何用CSS准确的知道其中某个图片的坐标 ,如下图 可以使用  background background:url(images/xx.png) 40px 10px n ...

  6. mfc 可编辑 list control

    维护到一个古老的gm工具的时候 需要这个功能 在网上找到一份很好用的代码 贴到这里 再次感谢那位同僚 #pragma once //#include "OrangeMessage.h&quo ...

  7. CentOS下源码安装MySQL

    一.创建mysql用户与组,相关目录 useradd mysql -s /sbin/nologin mkdir /usr/local/mysql chown -R mysql.mysql mkdir ...

  8. python中self,cls

    cls主要用在类方法定义,而self则是实例方法. self, cls 不是关键字,完全可以使用自己写的任意变量代替实现一样的效果. 普通的实例方法,第一个参数需要是self,它表示一个具体的实例本身 ...

  9. 如何查看与刷新DNS本地缓存

    如何查看与刷新DNS本地缓存 一.查看DNS本地缓存 在cmd窗口输入:ipconfig/displaydns 二.刷新DNS本地缓存 在cmd窗口输入:ipconfig/flushdns 之后输入: ...

  10. MFC编程入门之前言

    本系列主要偏重于理论方面的知识,目的是打好底子,练好内功,在使用VC++编程时不至于丈二和尚摸不着头脑.本系列也会涉及到VC++的原理性的东西,同样更重视实用性,学完本系列以后,基本的界面程序都能很容 ...