Sunday, October 24, 2010

Determination of grain size


Image Processing

.. wala nang grades at stress this time


Plate 1. Unknown Sample


Jeffries Method


Table 1


Table 2



Mean Lineal Intercept Method (Heyn's Method)

Table 3

Table 4


Image processing using Scilab

Histogram

Table 5



clclclclclclclclcllclclclclclclclcllclclclclclclclclclclclclclclclclclclclclclclclclclclclclcllcllclcllclclclclcllclclclcllccccccccclllllllllllllllcllcl








Spheroidized Steel

Jeffries Method


Table 1


Table 2



Mean Lineal Intercept Method (Heyn's Method)

Table 3

Table 4


Image processing using Scilab

Histogram

Table 5










Saturday, October 3, 2009

A18 – Noise models and basic image restoration

In this activity this is what I did:

Procedure:

1. Add noise to the original image:

Original Image

Noises:
I applied the following noises using genradn and imnoise in Scilab and obtained their corresponding PDF p(z):



2. Filter the noisy images

I made and then applied the following filters on each type of noise in (1).

Assuming a rectangular sub-image with of size
n*m, n=m=3( for nearest neighbor perimeter)


1.ARITHEMETIC FILTER

2.GEOMETRIC FILTER

3.HARMONIC FILTER

4.CONTRAHARMNIC FILTER

Q=+1,- 1




3. Determined which type of filter suited for each type noise.


In the following images the arrangement is as follows:

from the top- left-right :
(1) NOISY image (2)
Filtered Image with Arithmetic Filter, (3) Arithmetic Filter
bottom-left-right is :
(4) Harmonic Filter, (5) Contraharmonic Filter : Q=-1, (6) Contraharmonic Filter : Q=+1.


1. GAUSSIAN OR NORMAL NOISE, PDF AND FILTERING


All but the geometric filter was able to somehow remove the gaussian noise in the image.


2. RAYLEIGH NOISE , PDF AND FILTERING



From these results, all the filter worked but I think the contraharmonic filter with positive Q =+1 was most effective in removing the uniform noise since the filter at Q=+1 is beginning to restore the white circle at the center.

3.EXPONENTIAL NOISE, PDF AND FILTERING

All the filter worked except the arithmetic filter.

4.GAMMA NOISE AND FILTERING


The arithmetic and geometric filter cannot remove gamma noise.

5.UNIFORM NOISE , PDF AND FILTERING

The contra-harmonic filter was most effective since its beginning to restore the white circle at the center.

6.SALT AND PEPPER NOISE AND FILTERING

Again , the contra-harmonic filter wins.

7.SPECKLE NOISE AND FILTERING
Again , the contra-harmonic filter wins (again).

SOURCE: A18 – Noise models and basic image restoration manual

ASSESSMENT: 10/10 because I was able to code and implement all the image noise and image filters :) and use imnoise. The main problem was that for the results I only used the imwrite outputs. The imshow rendered different effects that seemed better than end results saved in imwrite :) ..odd

GRATITUDE: I would like to thank Mandee and Alva for discussing with me :) (salamat) and Gibert for the rayleigh.

A19 – Restoration of blurred and noisy image


Objective: Be able to restore the original image from a degraded image using Wiener filter


Steps:

1.Motion blur the original image by taking

or the product of FT of f(image) and h (spatial degradation function) that is G(u,v):



where F(u,v) is the Fourier transform of the original image and H(u,v) is the trasfer function given by
where a and b is the total distance for which the image has been displaced in the x and y direction.
The blurred image g(x,y) is obtained by taking the ifft of G(u,v).This is shown below with a=b=0.01 and T=1.

2.Add noise to this blurred image


For the noise I used: n=grand(ix,iy,'nor',0.05,0.06);

The blurred and noisy image:



3.Use Wiener filter to restore the original image.


The Wiener filter aka minimum mean square error filter or least square error filter.


As stated earlier,the objective is to find an estimate of the original image f(x,y) from the of the corrupted image such that the mean square error between them is minimized. Based on these conditions, the minimum of the error function is given in the frequency domain by the expression :

where


From here the restored image f(x,y) can be retrieved as the ifft of F(u,v).





4. Effects of varying the values of a,b and at constant T=1(sec) and applied noise (normal / gaussian).



as expected , there will be no capture image as a=b=T=1.

Here we notice that as the distance a,b is reduced the image captured becomes less blurred and we can see that the text become more clear. Moreover, as the blurring is reduced the degradation due to the noise become more apparent and becomes a major factor in precluding the restoration of the image. So.


5.Effects of varying the noise added while at constant a=b=0.01, and T=1.


APPLYING RAYLEIGH NOISE:

APPLYING EXPONENTIAL NOISE:
APPLYING UNIFORM NOISE:
APPLYING NORMAL OR GAUSSIAN NOISE:
APPLYING SPECKLE NOISE:
The speckle noise was easily removed by the W.Filter as seen in the image above but the restored image still retained the degradation effects of the blur.


APPLYING SALT AND PEPPER NOISE:


Some errors and remarks:


I used the imwrite (Scilab) versions of the images for the blurred, noisy and restored and not the imshow.
I don't know but the resulting imshow and imwrite of the images are somewhat different:


(LEFT) imshow (RIGHT) imwrite

SOURCE: A19 Restoration of blurred and noisy image

ASSESSMENT: 10/10 since I was able to implement the motion blurr and Wiener filter in Scilab and get the results for various parameter :) I also enjoyed doing this activity.