Matlab中关于图像处理、去噪分析以及有关散点连线画图等程序

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

算法程序

1.找到图片

addpath('C:\Documents and Settings\user\My Documents\My Pictures');

imshow('3.jpg')

2.将彩色图片处理成灰度图片

addpath('C:\Documents and Settings\user\My Documents\My Pictures');

A=imread('3.jpg');

I=rgb2gray(A);

imshow(I)

3.改变图片大小

右键----编辑----属性-----输入想要的大小

4.两张图片相叠加(区分imadd和系数叠加)

直接把图像数据矩阵相加,可以设定叠加系数,如(系数可自由设定,按需要)

img_tot = img1 * 0.5 + img2 * 0.5; %两个图像大小要一致

图像的矩阵我再那里能找到

img1 = imread('tupian.bmp');

图片相加

addpath('C:\Documents and Settings\user\My Documents\My Pictures'); A=imread('2.jpg');

imshow(A)

>> B=imread('3.jpg');

imshow(B)

>> C=imadd(A,B);

imshow(C)

>> D=A*0.5+B*0.5;

imshow(D)

A图像

B图像

C图像

D图像

5.两张图片相减

addpath('C:\Documents and Settings\user\My Documents\My Pictures'); A=imread('2.jpg');

imshow(A)

>> B=imread('3.jpg');

imshow(B)

K=A-B;

imshow(K)

各种运算一次可以按照下面的方式用MATLAB呈现

6.噪声

图像增强

直方均衡,平滑,锐化A=imread('18.jpg'); B=rgb2gray(A);

figure,subplot(2,2,1),imshow(B);

subplot(2,2,2),imhist(B);

A1=imadjust(B,[0.2 0.5],[]);

subplot(2,2,3),imshow(A1);

subplot(2,2,4),imhist(A1);

C=imnoise(B,'salt & pepper');

h1=[0.1 0.1 0.1;0.1 0.2 0.1;0.1 0.1 0.1]; h2=1/4.*[1 2 1;2 4 2;1 2 1];

C1=filter2(h1,C);

C2=filter2(h2,C);

C3=medfilt2(C);

figure,subplot(2,2,1),imshow(C); subplot(2,2,2),imshow(C1,[]);

subplot(2,2,3),imshow(C2,[]);

subplot(2,2,4),imshow(C3);

h=[0 -1 0;-1 4 -1;0 -1 0];

D1=imfilter(B,h);

d2=fspecial('sobel');

D2=imfilter(B,d2);

D3=edge(B,'roberts',0.1);

figure,subplot(2,2,1),imshow(B); subplot(2,2,2),imshow(D1);

subplot(2,2,3),imshow(D2,[]);

subplot(2,2,4),imshow(D3);

Sas散点图程序:data a;

input x y; cards;

413 359

403 343

383.5 351 381 377.5

339 376

335 383

317 362

334.5 353.5 333 342

282 325

247 301

219 316

225 270

280 292

290 335

337 328

415 335

432 371

418 374

444 394

251 277

234 271

225 265

212 290

227 300

256 301

250.5 306 243 328

246 337

314 367

315 351

326 355

327 350

328 342.5

336 339

336 334

331 335

371 330

371 333

388.5 330.5

419 344

411 343

394 346

342 342

342 348

325 372

315 374

342 372

345 382 348.5 380.5 351 377

348 369

370 363

371 353

354 374

363 382.5 357 387

351 382

369 388

335 395

381 381

391 375

392 366

395 361

398 362

401 359

405 360

410 355

408 350

415 351

418 347

422 354 418.5 356 405.5 364.5 405 368

409 370

417 364

420 370

424 372

438 368 438.5 373 434 376

438 385

相关文档
最新文档