洛伦(Matlab)的艺术

将想法变成MATLAB

笔记

洛伦(Matlab)的艺术已经退休,不会被更新。

Four Color Images

I recently attended a show at the Institute for Contemporary Art in Boston featuring work by Shepard Fairey. It got me thinking how simple it can be in MATLAB to make a 4-color image and adjust it however you like.

内容

Import Image

首先,让我得到图像。这是一个灰度图像。

ic = imread('pout.tif');imshow(ic)

注意:我正在使用imshowfrom图像处理工具box帮助管理颜色和轴缩放。

定义四种颜色

接下来,让我选择一个颜色的调色板,然后显示它们。

lilac = [.5 .4 .9]; darkblue = [.1 .3 .8]; lightblue = [0 .5 .6]; red = [.8 0 0]; cm = [darkblue; red; lightblue; lilac]; image([1 3;2 4]),colormap(cm), axis离开

Segment Gray Image into Four Levels

接下来,我选择将像素值分组为4个颜色箱的级别。我的图像的最小值和最大值足够接近0和255,以免拉伸范围。

min(ic(:))max(ic(:))
ANS = 74 ANS = 224

我的第一次尝试创建了相等的垃圾箱。

latve = linspace(0,255,5)
levels = 0 63.75 127.5 191.25 255

Next I create a new image by combining 4 binary images with the appropriate multipliers.

idb =(ic <= latve(2));ir = ic <=级别(3)&ic>级别(2);ilb = ic <=级别(4)&ic>级别(3);ipy = ic <=级别(5)&ic>级别(4);IC4 = IDB+2*IR+3*ILB+4*IPY;IMShow(IC4,CM)

Change the Order of Colors

当我更改颜色顺序时会发生什么?功能与不同的颜色选择不同。

cm = [darkblue;浅蓝;紫丁香;红色的];IMShow(IC4,CM)

更改四种颜色的范围以带来细节

现在,我对颜色垃圾箱进行了修复,以更加重点从原始图像中进行更多细节。然后,我根据新垃圾箱重新计算二进制图像,然后重组它们。

Levels = [0 90 128 155 255] IDB =(IC <= latve(2));ir = ic <=级别(3)&ic>级别(2);ilb = ic <=级别(4)&ic>级别(3);ipy = ic <=级别(5)&ic>级别(4);IC4 = IDB+2*IR+3*ILB+4*IPY;IMShow(IC4,CM)
水平= 0 90 128 155 255

菌落很重要

Choosing appropriate colormaps for displaying data is very important. You need to be careful to not exaggerate unimportant details. Here's an interesting reference from one of my geophysics periodicals.

A. Light&P.J. Bartlein,“彩虹?配色方案的末端,用于改进的数据图形”,EOS,第1卷。85,第40号,2004年10月5日。

您是否有用于探索或显示数据的特殊菌落?如果是这样,您可以发布信息(也许与图的链接一起查看)here




以MATLAB®7.8出版

|
  • 打印
  • 发送电子邮件