写在前面:本科南瓜大学核工程专业,现为积水潭女子师专核技术及应用男博一枚。研究方向为X射线/中子光学。最近疫情原因加上伤病,在家闲的扣脚,故开专栏,也算是消磨时光。我学习数字图像处理的原因在于:X射线实验有大量的实验数据,所写理论一般为求解实验数据,验证其可靠性服务,这是和数字图像处理的特点相契合的。五年时光有限,数字图像处理只是本人毕业论文工作里一小块,所以我选择冈萨雷斯的数字图像处理补基础。以下,本专栏并不具有用户友好的功能,只是本人对自己学习过程的记录,和书籍知识的压缩,可以看成学习笔记。选择matlab版本为开始,是因为matlab是最简单的(狗头保命),就这样。最后,这本书不管第几版,一定要咬牙坚持把英文原版看下来,这样才能疏通障碍,为探讨研究最新理论打下基础。下面是第一章,小白和大家一起云学习。
Chapter 1 Introduction
知识点:
1. f(p,q) : denotes the elements in row p and column q
2. Row vector: A 1×N matrix
Column vector: A M×1 matrix
Scalar: A 1×1 matrix
3. Gray-scale Image: [0.255] [0,65535] [0,1](double single)
Binary image: logical array of 1s and 0s
4. Array arithmetic operations: A.*B
Matrix arithmetic operations: A*B
Matlab函数:
1.Image I/O and display:
I: imread ('filename')->f = imread ('chestxray.jpg');
O: imshow (f);
2.To keep the first image and output a second image:
figure , imshow (g)
3.Image written to the current directory:
imwrite (f,'filename')
4.Numeric array consisting of 0s and 1s convert to binary:
B = logical (A)
5.To test if an array is of class:
islogical (C)
6.Logical array converted to numeric arrays:
B = im2uint8/im2uint16/im2double/im2single/mat2gray (A)
7.Convert an image to an array of class double scaled to the range[0 1]:
g = mat2gray (A,[Amin,Amax])
<Amin to 0s >Amax to 1
g = mat2gray (A)
Amin,Amax set to the actual min and max values in A
8.Function definition line form:
Function [outputs] = name (inputs)
y = sum (x);
Calling at the command prompt:
[s, p] = sumprod (f,g);
H1 line and call it
%SUMPROD Computes the sum and product of two images.
>>help function_name
Edit function in M.file
>>edit sumprod
9.A function to compute the sum and product (two different outputs) of two images:
function [s, p] = sumprod (f, g)
where f and g are the input images, s is the sum image, and p is the product image.
10.Vector:
row vector: v = [1 3 5 7 9]
column vector: (transpose operator) w = v.'
access blocks: v(1:3)
v(3:end)
v([1 4 5])
v(1:2:end)
11.Matrices:
A = [1 2 3; 4 5 6; 7 8 9]
A(2,:)
sum(A(:))
extract all the elements of A corresponding to 1-valued elements of D: A(D)
12.Function handle:
simple: f = @sin; f(pi/4)
anonymous function handle: @(input-argument-list) expression
g = @(x) x.^2
13.Cell:
C={f ,b , char_array}
C{3} = 'area' 'centorid‘
C(3) ans = {1*2 cell} discription
14.Structure:
function s = image_status (f)
s.dm = size(f);
s.AI = mean2(f);
15.Numel(x) gives the number of elements in array x:
16.Timing functions:
tic; func; toc; not reliable
s = timeit(f) reliable and repeatable results
17.Create a synthetic image based on f(x,y)=Asin(u_0 x+v_0 y):
twodsin1
18.Compute a function of two variables:
[C , R] = meshgrid (c , r)
---------------》欢迎学术交流,哔哩哔哩干杯》-------------------
------------》matlab系列完毕之后就是OpenCV了》--------------