-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
1,043 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
function [smoothImg, loadNum] = combinedSmooth(img, thresh, M, N, loadNum, totLoad) | ||
%function [smoothImg, loadNum] = combinedSmooth(img, thresh, M, N, loadNum, totLoad) | ||
% Inputs: | ||
% img: matrix of uint8 image data to be corrected | ||
% thresh: the decimal value between 0 and 1 of the minimum median | ||
% difference a pixel must be from its surrounding pixels for | ||
% filtering to occur | ||
% M: x/row size dimension of box surrounding a pixel that is included | ||
% in the median filtering. | ||
% N: y/column sized dimension of box surrounding a pixel that is | ||
% included in the median filtering. | ||
% loadNum: current number of times the waitbar has updated | ||
% totLoad: total number of times waitbar will update | ||
% Output: | ||
% smoothImg: matrix of uint8 corrected image data | ||
% loadNum: updated counter value | ||
% | ||
% Andrew Sack | ||
% Lab LA | ||
% 5/10/17 | ||
|
||
|
||
iDub = im2double(img); % converts uint8 to double | ||
[numRows, numCols, numChan] = size(img); | ||
|
||
smoothImg = img; | ||
|
||
m = round((M-1)/2); | ||
n = round((N-1)/2); | ||
|
||
for curChan = 1:numChan | ||
for row = 1:numRows | ||
for col = 1:numCols | ||
tempDiffs = []; | ||
for curRow = row-m : row+m | ||
for curCol = col-n : col+n | ||
if (curRow >= 1) && (curRow <= numRows) && (curCol >= 1) && (curCol <= numCols)&& (~((curCol == col)&&(curRow == row))) | ||
tempDiffs = [tempDiffs abs(iDub(curRow, curCol, curChan)-iDub(row,col,curChan))]; | ||
end | ||
end | ||
end | ||
iMag = median(tempDiffs); | ||
if iMag > thresh | ||
tempVal = []; | ||
for curRow = row-m : row+m | ||
for curCol = col-n : col+n | ||
if (curRow >= 1) && (curRow <= numRows) && (curCol >= 1) && (curCol <= numCols) | ||
tempVal = [tempVal img(curRow, curCol, curChan)]; | ||
end | ||
end | ||
end | ||
smoothImg(row, col, curChan) = median(tempVal); | ||
end | ||
end | ||
loadNum = loadNum + 1; | ||
waitbar(loadNum/totLoad); | ||
end | ||
end | ||
|
||
smoothImg = uint8(smoothImg); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
function newImg = distortImg(img, distortPercent) | ||
%function newImg = distortImg(img, distortPercent) | ||
% Inputs: | ||
% img: input image of any number of channels | ||
% distortPercent: Percentage (0-100) # of pixel distortions/# of | ||
% pixels in image (The actual percentage of distorted pixels will be | ||
% lower due to repeated pixels) | ||
% Output: | ||
% newImg: distorted image | ||
% | ||
% Andrew Sack | ||
% Lab LA | ||
% 5/10/17 | ||
|
||
% This function will randomly select the desired number of pixels and then | ||
% replace their values with random color values across all channels | ||
|
||
[rows, columns, ~] = size(img); | ||
|
||
distortAmount = distortPercent/100; | ||
pixels = rows * columns; | ||
distortNum = round(pixels * distortAmount); % # of pixels to distort | ||
|
||
distortIndex = zeros(distortNum, 2); % matrix of distorted pixel locations | ||
|
||
|
||
distortIndex(:, 1) = randi(rows, distortNum, 1); % x values of distorted pixels | ||
distortIndex(:, 2) = randi(columns, distortNum, 1); % y values of distorted pixels | ||
|
||
distortValue = randi(255, distortNum, 3);% separate matrix of distorted pixel values | ||
|
||
newImg = img; | ||
|
||
for k = 1:distortNum | ||
newImg(distortIndex(k,1),distortIndex(k,2),:) = distortValue(k, :); | ||
end | ||
|
||
newImg = uint8(newImg); | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function [smoothImg, loadNum, totLoad] = smoothAll(img, M, N, loadNum, totLoad) | ||
%function [smoothImg, loadNum, totLoad] = smoothAll(img, M, N, loadNum, totLoad) | ||
% Inputs: | ||
% img: matrix of uint8 image data to be corrected | ||
% M: x/row size dimension of box surrounding a pixel that is included | ||
% in the median filtering. | ||
% N: y/column sized dimension of box surrounding a pixel that is | ||
% included in the median filtering. | ||
% loadNum: current number of times the waitbar has updated | ||
% totLoad: total number of times waitbar will update | ||
% Output: | ||
% smoothImg: matrix of uint8 corrected image data | ||
% loadNum: updated counter value | ||
% | ||
% Andrew Sack | ||
% Lab LA | ||
% 5/10/17 | ||
|
||
iDub = im2double(img); % converts uint8 to double | ||
[numRows, numCols, numChan] = size(img); | ||
|
||
smoothImg = img; | ||
|
||
m = round((M-1)/2); | ||
n = round((N-1)/2); | ||
|
||
for curChan = 1:numChan | ||
for row = 1:numRows | ||
for col = 1:numCols | ||
tempVal = []; | ||
for curRow = row-m : row+m | ||
for curCol = col-n : col+n | ||
if (curRow >= 1) && (curRow <= numRows) && (curCol >= 1) && (curCol <= numCols) | ||
tempVal = [tempVal img(curRow, curCol, curChan)]; | ||
end | ||
end | ||
end | ||
smoothImg(row, col, curChan) = median(tempVal); | ||
end | ||
loadNum = loadNum + 1; | ||
waitbar(loadNum/totLoad); | ||
end | ||
end | ||
|
||
smoothImg = uint8(smoothImg); | ||
|
||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 256 x 256 pixels | ||
|
||
*image was not distorted* | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: non-selective | ||
M: 25 | ||
N: 1 | ||
number of iterations: 1 | ||
proccessing time: 7.1 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 14:17:48 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 256 x 256 pixels | ||
|
||
*image was not distorted* | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: non-selective | ||
M: 3 | ||
N: 15 | ||
number of iterations: 1 | ||
proccessing time: 11.7 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 14:18:30 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
Results/CompareDistortAmounts/puppy_distort100_selective.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 270 x 360 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 100.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 7.4 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 13:59:56 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
Results/CompareDistortAmounts/puppy_distort20_selective.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 270 x 360 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 20.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 5.0 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 13:57:31 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
Results/CompareDistortAmounts/puppy_distort40_selective.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 270 x 360 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 40.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 5.6 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 13:57:03 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
Results/CompareDistortAmounts/puppy_distort60_selective.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 270 x 360 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 60.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 6.5 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 13:59:20 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
Results/CompareDistortAmounts/puppy_distort80_selective.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 270 x 360 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 80.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 6.9 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 13:58:28 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 370 x 410 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 30.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.10 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 8.9 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 14:02:14 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Image Correction Details | ||
------------------------------------------------ | ||
|
||
Original Image: | ||
--------------- | ||
size: 370 x 410 pixels | ||
|
||
Image Distortion: | ||
----------------- | ||
distortion percent: 30.0% | ||
|
||
Image Correction: | ||
----------------- | ||
parameters: | ||
correction method: selective | ||
threshold: 0.50 | ||
M: 3 | ||
N: 3 | ||
number of iterations: 1 | ||
proccessing time: 6.6 seconds | ||
|
||
------------------------------------------------ | ||
|
||
created: 12-May-2017 14:04:24 -0400 | ||
Andrew Sack |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.