Solved

# Unsharp filter: Matlab

Posted on 2009-03-29
2,531 Views
Hello,
I need to make an unsharp filter using following parameters:
%gaussian_size     size of the applied filter
&gaussian_std      standard deviation of the gaussian filter, sigma
for an image. in the folder images.
Following functions must be implemented:
Input:      <RGB frames>, Filterparameter
Output;    filtered <RGB frames>
Data: filter_unsharp.m

Would be grateful for your help
0
Question by:ihbemd6rb
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 1

Expert Comment

ID: 24015099
The basic setup is:

H = fspecial('unsharp');
sharpened = imfilter(I,H,'replicate');
subplot(2,2,4);
imshow(sharpened); title('Sharpened Image');

You can pass other options to fspecial (the filter parameters). Take a look at
doc fspecial
in Matlab. I'm assuming you have the Image Processing Toolbox?

Dave
0

Author Comment

ID: 24017111
Hello and thanks for the answer, I have already seen this code on the mathworks website. My problem is how to make this function from it:
function video = filter_unsharp(video, gaussian_size, gaussian_std);
......
As an example something similar to this:
function video = filter_rand_illumination(video, min_brightness, max_brightness)
RGB = video.frame(1).filtered;
HSV = rgb2hsv(RGB);
luma_factor = 0;
while(luma_factor < min_brightness || luma_factor > max_brightness)
luma_factor = rand(1);
end
v = HSV(:,:,3);
hue_v = v * luma_factor;
HSV(:,:,3) = hue_v;

RGB = hsv2rgb(HSV);
video.frame(1).filtered = RGB;
This is just an example of how do I need to construct unsharp filter.

Thanks
0

LVL 15

Accepted Solution

yuk99 earned 500 total points
ID: 24022453
AFAIK unsharp filter in Matlab does not use gaussian smoothing. It subtracts laplacian filter (with parameter ALPHA, which controls laplacian shape) from the original image.
If you  need to use those gaussian parameters, you'll have to develop your own filter function. Once you have it, run imfilter on separate frames within for-loop. Somethig like
H = fspecial('unsharp');
video2=video;
for i=1_numel(video)
video2(i).cdata = imfilter(video(i).cdata,H,'replicate');
end

0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Coordinate Geometry-Finding ratio of a point splitting a line 4 94
Problem to start Neon 20 158
rhino JavaScript import, load 25 131
Programatically extract date from website 8 89
We are taking giant steps in technological advances in the field of wireless telephony. At just 10 years since the advent of smartphones, it is crucial to examine the benefits and disadvantages that have been report to us.
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationâ€¦
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
###### Suggested Courses
Course of the Month6 days, 10 hours left to enroll