diagram = imread('C:\Users\Administrator\Desktop\Compressed\fiter\lena256.jpg')
%diagram = rgb2gray(diagram);%------------------------------将图片转换为灰度图
%diagram = logical(diagram)%
figure,imshow(diagram),title('Original picture');%----------显示原图
%figure,imshow(diagram(100,:)),title('Original picture');%--显示100行水平扫描线
%plot(diagram(255,:))
size(diagram)
whos diagram
% imfinfo lena256.jpg %---------------------------------------显示图片信息
diagram(256,256)
diagram(1:10,1:10) % diagram = imadjust(diagram,[0,1],[1,0]) %-----------------图像反转 亮度
% figure,imshow(diagram)
% diagram = intrans(diagram,'stretch',mean2(im2double(diagram)),0.9);

%%======================直方图============================%%
% h = imhist(diagram)
% h1 = h(1:1:256)
% horz = 1:1:256;
%bar(horz,h1)
%axis([0 255 0 1500])
%%======================图像复原===========================%%
%g = imnoise(diagram,'gaussian') %-------------------------添加高斯噪声
%figure,imshow(g) [M,N]=size(diagram)
R = imnoise2('salt & pepper',M,N,0.01,0) %-----------------椒盐噪声
c = find(R == 0);
gp = diagram
gp(c) = 255 %--------------------------------------------椒盐噪声
%figure,imshow(gp);title('salt noise ')
%g2 = imnoise(diagram,'poisson') %-------------------------珀松
%figure,imshow(g2);title('pospng noise ')
% fp = spfilt(gp,'chmean',3,3,-1)
% figure,imshow(fp)
%%=========================分离RGB========================%%
rgb_se = diagram
% rgb_se = im2double(rgb_se)
fr = rgb_se(:,:,1)
fg = rgb_se(:,:,2)
fb = rgb_se(:,:,3) R = rgb_se(:,:,1)
G = rgb_se(:,:,2)
B = rgb_se(:,:,3)
Y = 16+(0.256789*R+0.504129*G+0.097906*B)
Cb = 128+(-0.148223*R-0.290992*G+0.439215*B)
Cr = 128+(0.439215*R-0.367789*G-0.071426*B)
% figure,imshow(Y);title('Y ')
% ycbcr = cat(3,Y,Cb,Cr)
% figure,imshow(ycbcr);title('Ycbcr ')
% figure,imshow(fr) %--------------------------------------此时的不是红色,只是红色分量
% figure,imshow(fg)
% figure,imshow(fb)
% rgb_image = cat(3,fr,fg,fb) %------------------------------合并RGB分量
% figure,imshow(rgb_image)
%==========================提出R G B分量===================%%
a = diagram
[r,c,d]=size(a); red=a;%提取红色分量
red(:,:,1)=a(:,:,1);
red(:,:,2)=zeros(r,c);%--------------------------------------将其他两组分量置位0
red(:,:,3)=zeros(r,c);
% red=unit8(red);
% red=uint8(red);
%subplot(131),imshow(red);title('red separation')
%提取绿色分量
green=zeros(r,c);
green(:,:,2)=a(:,:,2);
green(:,:,1)=zeros(r,c);
green(:,:,3)=zeros(r,c);
green=uint8(green);
%subplot(132),imshow(green);title('green separation')
%提取蓝色分量
blue=zeros(r,c);
blue(:,:,1)=zeros(r,c);
blue(:,:,2)=zeros(r,c);
blue(:,:,3)=a(:,:,3);
blue=uint8(blue);
%subplot(133),imshow(blue);title('blue separation')
%%===========================颜色空间转换=====================%%
rgb_image = diagram
rgb_image = im2double(rgb_image)
yiq_image = rgb2ntsc(rgb_image) %---------------------------RGB to NTSC
%figure,imshow(yiq_image);title('RGB to NTSC ')
ycbcr_image = rgb2ycbcr(rgb_image)%--------------------------RGB to Ycbcr
% figure,imshow(ycbcr_image);title('RGB to Ycbcr ')
size(ycbcr_image)
%Here pick off the 256x256 luminance part of the ycbcr image
Y = ycbcr_image(:,:,1)
%figure, imshow(Y); title('Y part of Image');
size(Y) %Here pick off the 256x256 Cb part of the ycbcr image
CB = ycbcr_image(:,:,2)
%figure, imshow(CB); title('Cb part of Image');
size(CB) %Here pick off the 256x256 Cr part of the ycbcr image
CR = ycbcr_image(:,:,3)
%figure, imshow(CR); title('Cr part of Image');
size(CR) 

数字图象处理MATLAB学习的更多相关文章

  1. Matlab学习笔记 figure函数

    Matlab学习笔记 figure函数 matlab中的 figure 命令,能够创建一个用来显示图形输出的一个窗口对象.每一个这样的窗口都有一些属性,例如窗口的尺寸.位置,等等.下面一一介绍它们. ...

  2. matlab学习笔记 bsxfun函数

    matlab学习笔记 bsxfun函数 最近总是遇到 bsxfun这个函数,前几次因为无关紧要只是大概看了一下函数体去对比结果,今天再一次遇见了这个函数,想想还是有必要掌握的,遂查了些资料总结如下. ...

  3. matlab学习笔记(一)单元数组

    matlab学习笔记(一)单元数组 1.floor(x) :取最小的整数 floor(3.18)=3,floor(3.98)=3 ceil(x)  :取最大的整数 ceil(3.18)=4,ceil( ...

  4. matlab学习笔记---(1)

    Matlab学习笔记 一. Desktop Basics (Matlab 基础知识) 当你打开Matlab的时候,matlab按照以下默认的方式展示出来. 该桌面主要包括以下几部分内容: 当前文件夹: ...

  5. 【数学建模】MATLAB学习笔记——函数式文件

    MATLAB学习笔记——函数式文件 引入函数式文件 说明: 函数式文件主要用于解决计算中的参数传递和函数调用的问题. 函数式的标志是它的第一行为function语句. 函数式文件可以有返回值,也可以没 ...

  6. MATLAB学习总结(1)

    MATLAB学习总结(1)   path help path cd(current directory) savepath pathtool

  7. matlab学习路线

    知乎:matlab学习路线 MATLAB数学教学视频

  8. mnist手写数字识别——深度学习入门项目(tensorflow+keras+Sequential模型)

    前言 今天记录一下深度学习的另外一个入门项目——<mnist数据集手写数字识别>,这是一个入门必备的学习案例,主要使用了tensorflow下的keras网络结构的Sequential模型 ...

  9. 数字图像处理(MATLAB版)学习笔记(1)——第1章 绪言

    0.下定决心 当当入手数字图像处理一本,从此开此正式跨入数字图像处理大门.以前虽然多多少少接触过这些东西,也做过一些相关的事情,但感觉都不够系统,也不够专业,从今天开始,一步一步地学习下去,相信会有成 ...

随机推荐

  1. Hibernate Validation注解列表

    下面是主要的验证注解及说明: 注解 适用的数据类型 说明 @AssertFalse Boolean, boolean 验证注解的元素值是false @AssertTrue Boolean, boole ...

  2. Spring MVC @RequestMapping Annotation Example with Controller, Methods, Headers, Params, @RequestParam, @PathVariable--转载

    原文地址: @RequestMapping is one of the most widely used Spring MVC annotation.org.springframework.web.b ...

  3. Javascript操纵Cookie--转

    引用地址:http://www.imkevinyang.com/2009/06/javascript%E6%93%8D%E7%BA%B5cookie.html 在讲如何使用Javascript操纵Co ...

  4. Python操作MySQL之SQLAlchemy

      SQLAlchemy是Python编程语言下的一款ORM框架,该框架建立在数据库API之上,使用关系对象映射进行数据库操作,简言之便是:将对象转换成SQL,然后使用数据API执行SQL并获取执行结 ...

  5. RandomAccessFile的使用

    package com.lk.C; import java.io.IOException; import java.io.RandomAccessFile; public class RandomAc ...

  6. Sphinx 全文检索

    什么是全文检索: 全文检索是指以文档的全部文本信息作为检索对象的一种信息检索技术.检索的对象有可能是文章的标题,也有可能是文章的作者,也有可能是文章摘要或内容. 简介: Sphinx是由俄罗斯人And ...

  7. 每天一个Linux命令(1):ls命令

    转自http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html ls命令是Linux下最常用的命令.ls命令就是list的缩写,缺省下ls ...

  8. angularjs表格方式显示数据

    <table> <tr ng-repeat="x in names"> <td>{{ x.Name }}</td> <td&g ...

  9. ionic默认样式android和ios的一些不同(当时真是纠结啊~)

    当时测试的时候看到android和ios上有那么大差别,特别崩溃啊... 还好看到了这篇文章,文章原文是Ionicchina中文网上的:http://ionichina.com/topic/54e45 ...

  10. External Table

    CREATE TABLE AS SELECT,使用Oracle9i的External Table  Oracle 9i 的一项新特性就是 External Table,它就象通常的数据库表一样,拥有字 ...