MATLAB draws artistic color map of rice grains

close all;							%关闭当前所有图形窗口,清空工作空间变量,清除工作空间所有变量
clear all;
clc;
J=imread('rice.png');% 读取灰度图像,赋值给J
J1=im2bw(J);%将灰度图像转换成二值图像,赋值给J1
J2=imcomplement(J);%求灰度图像的补,赋值给J2
J3=imcomplement(J1);%求二值图像的补,赋值给J3
set(0,'defaultFigurePosition',[100,100,1000,500]);%修改图形图像位置的默认设置
set(0,'defaultFigureColor',[1 1 1])         %修改图形背景颜色的设置
figure,                              %显示运算结果
subplot(131),imshow(J1)             %显示灰度图像及其补图像
subplot(132),imshow(J2)         %显示二值图像及其补图像
subplot(133),imshow(J3) 
colormap parula

insert image description here

colormap turbo

insert image description here

colormap jet

insert image description here

colormap hot

insert image description here

colormap cool

insert image description here

colormap spring

insert image description here

colormap summer

insert image description here

colormap autumn

insert image description here

colormap winter

insert image description here

colormap gray

insert image description here

colormap bone

insert image description here

colormap copper

insert image description here

colormap pink

insert image description here

colormap lines

insert image description here

colormap colorcube

insert image description here

colormap prism

insert image description here

colormap flag

insert image description here

colormap default

insert image description here
Development tools: MATLAB 2022b
WeChat Alt+A screenshot tool

Guess you like

Origin blog.csdn.net/m0_38127487/article/details/131839958