Useful function ~ ^^
A = magic(3)
A =
8 1 6
3 5 7
4 9 2
>> B = reshape(A, 1, 3*3)
B =
8 3 4 1 5 9 6 7 2
1/02/2013
Image Normalization using Standard deviation - example source code
You can understand Standard deviation normalization, referenced on this web page.
http://www.d.umn.edu/~deoka001/Normalization.html
This web page introduce that..(wrote by Siddharth Deokar)
-------------------------------------------------------------------------
Normalization by Standard Deviation
We normalize the attribute values by using standard deviation.
For Example:
Consider 5 instances which has attribute A with the follwing values: {-5, 6, 9, 2, 4}
First we calculate the mean as follows:
Mean = (-5+6+9+2+4) / 5 = 3.2
Second, we subtract the mean from all the values and square them:
(-5-3.2)^2 = 67.24
(6-3.2)^2 = 7.84
(9-3.2)^2 = 33.64
(2-3.2)^2 = 1.44
(4-3.2)^2 = 0.64
Then we find the deviation as follows:
Deviation = sqrt ((67.24 + 7.84 + 33.64 + 1.44 + 0.64) / 5) = 4.71
Now we normalize the attribute values:
x => (x - Mean) / Deviation
-5 => (-5 - 3.2) / 4.71 = -1.74
6 => (6 - 3.2) / 4.71 = 0.59
9 => (9 - 3.2) / 4.71 = 1.23
2 => (2 - 3.2) / 4.71 = -0.25
4 => (4 - 3.2) / 4.71 = 0.17
-------------------------------------------------------------------------
This is sample source code:
http://www.d.umn.edu/~deoka001/Normalization.html
This web page introduce that..(wrote by Siddharth Deokar)
-------------------------------------------------------------------------
Normalization by Standard Deviation
We normalize the attribute values by using standard deviation.
For Example:
Consider 5 instances which has attribute A with the follwing values: {-5, 6, 9, 2, 4}
First we calculate the mean as follows:
Mean = (-5+6+9+2+4) / 5 = 3.2
Second, we subtract the mean from all the values and square them:
(-5-3.2)^2 = 67.24
(6-3.2)^2 = 7.84
(9-3.2)^2 = 33.64
(2-3.2)^2 = 1.44
(4-3.2)^2 = 0.64
Then we find the deviation as follows:
Deviation = sqrt ((67.24 + 7.84 + 33.64 + 1.44 + 0.64) / 5) = 4.71
Now we normalize the attribute values:
x => (x - Mean) / Deviation
-5 => (-5 - 3.2) / 4.71 = -1.74
6 => (6 - 3.2) / 4.71 = 0.59
9 => (9 - 3.2) / 4.71 = 1.23
2 => (2 - 3.2) / 4.71 = -0.25
4 => (4 - 3.2) / 4.71 = 0.17
-------------------------------------------------------------------------
This is sample source code:
// int i,j,z; double sum=0; double Mean; //sum, mean for(j=0; j< Height; ++j) { for(i=0; i< Width; ++i) { sum = sum + Pdata[i][j]; } } Mean = sum/(Height*Width); //Deviation double dSum=0; double deviation; double std_dev; for(j=0; j< Height; ++j) { for(i=0; i< Width; ++i) { Pdata[i][j] = (Pdata[i][j] - Mean); dSum = dSum + (Pdata[i][j]*Pdata[i][j]); } } deviation = dSum / (Width*Height); std_dev = sqrt(deviation); //Normalization for(j=0; j< Height; ++j) { for(i=0; i< Width; ++i) { Pdata[i][j] = (Pdata[i][j] / std_dev); } }
Subscribe to:
Posts (Atom)
-
make well divided linear coordinate And make pair coordinate Please see code for detail explanation. import numpy as np import cv2 ...
-
As you can see in the following video, I created a class that stitching n cameras in real time. https://www.youtube.com/user/feelmare/sear...
-
In past, I wrote an articel about YUV 444, 422, 411 introduction and yuv <-> rgb converting example code. refer to this page -> ht...
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
Created Date : 2011.8 Language : Matlab Tool : Matlab 2010 Library & Utilized : - Reference : Multiple View Geometry (Hartly and Z...
-
This post is about how to copy Mat data to vector and copy vector data to Mat. Reference this example source code. printf("///////...
-
opencv lecture 4-1 example code < gist start > < gist end >
-
This is dithering example, it make image like a stippling effect. I referenced to blew website. wiki page: https://en.wikipedia.org/wik...
-
1. Map : Tasks read from and write to specific data elements. 2. Gather : each calculation gathers input data elements together from di...
