1538 1

[Weka及其他] MATLAB课程:代码示例之Image Processing and Computer Vision(一) [推广有奖]

企业贵宾

已卖:160份资源

巨擘

0%

还不是VIP/贵宾

-

威望
4
论坛币
624047 个
通用积分
180.5582
学术水平
918 点
热心指数
987 点
信用等级
841 点
经验
399203 点
帖子
9786
精华
48
在线时间
17322 小时
注册时间
2014-8-19
最后登录
2022-11-2

楼主
widen我的世界 学生认证  发表于 2016-3-14 11:54:38 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

MATLAB课程:代码示例之Image Processing and Computer Vision(一)


Deblurring Images Using a Regularized Filter


This example shows how to use regularized deconvolution to deblur images. Regularized deconvolution can be used effectively when constraints are applied on the recovered image (e.g., smoothness) and limited information is known about the additive noise. The blurred and noisy image is restored by a constrained least square restoration algorithm that uses a regularized filter.


Step 1: Read Image

The example reads in an RGB image and crops it to be 256-by-256-by-3. The deconvreg function can handle arrays of any dimension.

I = imread('tissue.png');I = I(125+(1:256),1:256,:);figure;imshow(I);title('Original Image');text(size(I,2),size(I,1)+15, ...    'Image courtesy of Alan Partin, Johns Hopkins University', ...    'FontSize',7,'HorizontalAlignment','right');


Step 2: Simulate a Blur and Noise

Simulate a real-life image that could be blurred (e.g., due to camera motion or lack of focus) and noisy (e.g., due to random disturbances). The example simulates the blur by convolving a Gaussian filter with the true image (using imfilter). The Gaussian filter represents a point-spread function, PSF.

PSF = fspecial('gaussian',11,5);Blurred = imfilter(I,PSF,'conv');figure;imshow(Blurred);title('Blurred');


We simulate the noise by adding a Gaussian noise of variance V to the blurred image (using imnoise).

V = .02;BlurredNoisy = imnoise(Blurred,'gaussian',0,V);figure;imshow(BlurredNoisy);title('Blurred & Noisy');


Step 3: Restore the Blurred and Noisy Image

Restore the blurred and noisy image supplying noise power, NP, as the third input parameter. To illustrate how sensitive the algorithm is to the value of noise power, NP, the example performs three restorations.

The first restoration, reg1, uses the true NP. Note that the example outputs two parameters here. The first return value, reg1, is the restored image. The second return value, LAGRA, is a scalar, Lagrange multiplier, on which the deconvreg has converged. This value is used later in the example.

NP = V*numel(I); % noise power[reg1, LAGRA] = deconvreg(BlurredNoisy,PSF,NP);figure,imshow(reg1),title('Restored with NP');


The second restoration, reg2, uses a slightly over-estimated noise power, which leads to a poor resolution.

reg2 = deconvreg(BlurredNoisy,PSF,NP*1.3);figure;imshow(reg2);title('Restored with larger NP');


The third restoration, reg3, is given an under-estimated NP value. This leads to an overwhelming noise amplification and "ringing" from the image borders.

reg3 = deconvreg(BlurredNoisy,PSF,NP/1.3);figure;imshow(reg3);title('Restored with smaller NP');


Step 4: Reduce Noise Amplification and Ringing

Reduce the noise amplification and "ringing" along the boundary of the image by calling the edgetaper function prior to deconvolution. Note how the image restoration becomes less sensitive to the noise power parameter. Use the noise power value NP from the previous example.

Edged = edgetaper(BlurredNoisy,PSF);reg4 = deconvreg(Edged,PSF,NP/1.3);figure;imshow(reg4);title('Edgetaper effect');


Step 5: Use the Lagrange Multiplier

Restore the blurred and noisy image, assuming that the optimal solution is already found and the corresponding Lagrange multiplier, LAGRA, is given. In this case, any value passed for noise power, NP, is ignored.

To illustrate how sensitive the algorithm is to the LAGRA value, the example performs three restorations. The first restoration (reg5) uses the LAGRA output from the earlier solution (LAGRA output from first solution in Step 3).

reg5 = deconvreg(Edged,PSF,[],LAGRA);figure;imshow(reg5);title('Restored with LAGRA');


The second restoration (reg6) uses 100*LAGRA which increases the significance of the constraint. By default, this leads to over-smoothing of the image.

reg6 = deconvreg(Edged,PSF,[],LAGRA*100);figure;imshow(reg6);title('Restored with large LAGRA');


The third restoration uses LAGRA/100 which weakens the constraint (the smoothness requirement set for the image). It amplifies the noise and eventually leads to a pure inverse filtering for LAGRA = 0.

reg7 = deconvreg(Edged,PSF,[],LAGRA/100);figure;imshow(reg7);title('Restored with small LAGRA');


Step 6: Use a Different Constraint

Restore the blurred and noisy image using a different constraint (REGOP) in the search for the optimal solution. Instead of constraining the image smoothness (REGOP is Laplacian by default), constrain the image smoothness only in one dimension (1-D Laplacian).

REGOP = [1 -2 1];reg8 = deconvreg(BlurredNoisy,PSF,[],LAGRA,REGOP);figure;imshow(reg8);title('Constrained by 1D Laplacian');




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Processing processI Computer MATLAB课程 compute MATLAB课程 代码示例 ImageProcessingandComputerVision DeblurringImagesUsingaRegularizedFilter

本帖被以下文库推荐


https://www.cda.cn/?seo-luntan
高薪就业·数据科学人才·16年教育品牌

沙发
离婚律师 在职认证  发表于 2016-3-14 11:55:28
太厉害了,受教受教……

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 23:21