Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-208
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-208
2021-208
Commits
64a584d0
Commit
64a584d0
authored
Oct 11, 2021
by
dewmalFernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1.17
parent
5a2bf325
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
503 additions
and
241 deletions
+503
-241
UI/app.js
UI/app.js
+6
-4
abnormal_behavior_detection/HumanDetection/Human_Detection_Video.py
...ehavior_detection/HumanDetection/Human_Detection_Video.py
+1
-0
app.py
app.py
+211
-186
imageEnhancement/ContrastEdjustments.py
imageEnhancement/ContrastEdjustments.py
+41
-0
imageEnhancement/CreateNewFolderForFrames.py
imageEnhancement/CreateNewFolderForFrames.py
+143
-9
imageEnhancement/CreateNewFolderForVideos.py
imageEnhancement/CreateNewFolderForVideos.py
+6
-15
imageEnhancement/EnhaceFramesUsingUnsharpMasking.py
imageEnhancement/EnhaceFramesUsingUnsharpMasking.py
+0
-5
imageEnhancement/FramesToVid.py
imageEnhancement/FramesToVid.py
+15
-22
imageEnhancement/ImageSharpening.py
imageEnhancement/ImageSharpening.py
+30
-0
imageEnhancement/RemoveGaussianNoise.py
imageEnhancement/RemoveGaussianNoise.py
+26
-0
imageEnhancement/Smooth.py
imageEnhancement/Smooth.py
+24
-0
No files found.
UI/app.js
View file @
64a584d0
...
...
@@ -33,12 +33,14 @@ if(result != null){
<!-- <p>Your account details are below:</p> -->
<table >
<tr >
<td>
Enhancement type :
</td>
<td>
Contrast Adjustment : Clahe
</td>
</tr>
<tr>
<td>Method Type :</td>
<td>Improve Image Shapness : Unsharp masking</td>
</tr>
<tr>
<td>Noise Type : Gaussian noise</td>
</tr>
</table>
</div>
</div>
...
...
@@ -247,7 +249,7 @@ function insertVideoAbnormal(newVideo) {
console
.
log
(
data
)
console
.
log
(
data
.
id
)
data
.
path
=
"
E:
\\
BACKBONE
\\
videos
\\
Input.mp4
"
//
data.path = "E:\\BACKBONE\\videos\\Input.mp4"
let
id
=
data
.
id
fetch
(
`http://127.0.0.1:5000/startAbnormalBehaviourDetection`
,
{
...
...
abnormal_behavior_detection/HumanDetection/Human_Detection_Video.py
View file @
64a584d0
...
...
@@ -10,6 +10,7 @@ from tifffile import askopenfilename
def
capture_humans
(
path
):
# path = "E:\\BACKBONE\\videos\\Input.mp4"
print
(
path
)
protopath
=
"E:/BACKBONE/abnormal_behavior_detection/Models/Human Detection/MobileNetSSD_deploy.prototxt"
...
...
app.py
View file @
64a584d0
This diff is collapsed.
Click to expand it.
imageEnhancement/ContrastEdjustments.py
0 → 100644
View file @
64a584d0
import
cv2
import
os
from
imageEnhancement
import
ImageSharpening
from
imageEnhancement
import
CreateNewFolderForFrames
def
adjustContrast
(
folder
,
rate
):
contrastAdjustedFrames
=
CreateNewFolderForFrames
.
createFolderForContrasted
(
folder
)
path
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folder
count
=
10000000
for
file
in
os
.
listdir
(
path
):
if
file
.
endswith
(
".jpg"
):
# -----Reading the image-----------------------------------------------------
img
=
cv2
.
imread
(
path
+
"
\\
"
+
file
)
# -----Converting image to LAB Color model-----------------------------------
lab
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2LAB
)
# -----Splitting the LAB image to different channels-------------------------
l
,
a
,
b
=
cv2
.
split
(
lab
)
# -----Applying CLAHE to L-channel-------------------------------------------
clahe
=
cv2
.
createCLAHE
(
clipLimit
=
3.0
,
tileGridSize
=
(
5
,
5
))
cl
=
clahe
.
apply
(
l
)
# -----Merge the CLAHE enhanced L-channel with the a and b channel-----------
limg
=
cv2
.
merge
((
cl
,
a
,
b
))
# -----Converting image from LAB Color model to RGB model--------------------
final
=
cv2
.
cvtColor
(
limg
,
cv2
.
COLOR_LAB2BGR
)
cv2
.
imwrite
(
contrastAdjustedFrames
+
"
\\
%
d.jpg"
%
count
,
final
)
count
+=
1
value
=
ImageSharpening
.
imageSharp
(
folder
,
contrastAdjustedFrames
,
rate
)
return
value
imageEnhancement/CreateNewFolderForFrames.py
View file @
64a584d0
# Python program to explain os.mkdir() method
# importing os module
import
os
def
createFolder
():
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames"
...
...
@@ -36,9 +34,10 @@ def createFolder():
print
(
"Directory '
%
s' created"
%
directory
)
return
directory
def
createFolderForEnhancedFrames
(
folderName
):
print
(
"folder name in createFolderForEnhancedFrames : "
+
folderName
)
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
print
(
"folder name in createFolderForEnhancedFrames : "
+
folderName
)
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
totalFiles
=
0
totalDir
=
0
...
...
@@ -58,7 +57,7 @@ def createFolderForEnhancedFrames(folderName):
directory
=
"Enhanced_Frames"
+
str
(
count
)
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
# Path
path
=
os
.
path
.
join
(
parent_dir
,
directory
)
...
...
@@ -71,7 +70,142 @@ def createFolderForEnhancedFrames(folderName):
print
(
"Directory '
%
s' created"
%
directory
)
return
directory
# if __name__ == '__main__':
# # Calling the function
# createFolder()
def
createFolderForContrasted
(
folderName
):
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
totalFiles
=
0
totalDir
=
0
for
base
,
dirs
,
files
in
os
.
walk
(
parentPath
):
print
(
'Searching in : '
,
base
)
for
directories
in
dirs
:
totalDir
+=
1
for
Files
in
files
:
totalFiles
+=
1
print
(
'Total Number of directories'
,
totalDir
)
count
=
totalDir
+
1
# Directory
directory
=
"Contrast_Adjusted_Frames"
+
str
(
count
)
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
# Path
path
=
os
.
path
.
join
(
parent_dir
,
directory
)
# Create the directory
# 'GeeksForGeeks' in
# '/home / User / Documents'
os
.
mkdir
(
path
)
print
(
"path : "
+
path
)
print
(
"Directory '
%
s' created"
%
directory
)
return
path
def
createFolderForSharpImages
(
folderName
):
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
totalFiles
=
0
totalDir
=
0
for
base
,
dirs
,
files
in
os
.
walk
(
parentPath
):
print
(
'Searching in : '
,
base
)
for
directories
in
dirs
:
totalDir
+=
1
for
Files
in
files
:
totalFiles
+=
1
print
(
'Total Number of directories'
,
totalDir
)
count
=
totalDir
+
1
# Directory
directory
=
"Sharp_Frames"
+
str
(
count
)
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
# Path
path
=
os
.
path
.
join
(
parent_dir
,
directory
)
# Create the directory
# 'GeeksForGeeks' in
# '/home / User / Documents'
os
.
mkdir
(
path
)
print
(
"path : "
+
path
)
print
(
"Directory '
%
s' created"
%
directory
)
return
path
def
DenoiseGaussian
(
folderName
):
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
totalFiles
=
0
totalDir
=
0
for
base
,
dirs
,
files
in
os
.
walk
(
parentPath
):
print
(
'Searching in : '
,
base
)
for
directories
in
dirs
:
totalDir
+=
1
for
Files
in
files
:
totalFiles
+=
1
print
(
'Total Number of directories'
,
totalDir
)
count
=
totalDir
+
1
# Directory
directory
=
"Gaussian_Denoised_Frames"
+
str
(
count
)
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
# Path
path
=
os
.
path
.
join
(
parent_dir
,
directory
)
# Create the directory
# 'GeeksForGeeks' in
# '/home / User / Documents'
os
.
mkdir
(
path
)
print
(
"path : "
+
path
)
print
(
"Directory '
%
s' created"
%
directory
)
return
path
def
smoothImagesFolder
(
folderName
):
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
totalFiles
=
0
totalDir
=
0
for
base
,
dirs
,
files
in
os
.
walk
(
parentPath
):
print
(
'Searching in : '
,
base
)
for
directories
in
dirs
:
totalDir
+=
1
for
Files
in
files
:
totalFiles
+=
1
print
(
'Total Number of directories'
,
totalDir
)
count
=
totalDir
+
1
# Directory
directory
=
"Smooth_Images"
+
str
(
count
)
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
# Path
path
=
os
.
path
.
join
(
parent_dir
,
directory
)
# Create the directory
# 'GeeksForGeeks' in
# '/home / User / Documents'
os
.
mkdir
(
path
)
print
(
"path : "
+
path
)
print
(
"Directory '
%
s' created"
%
directory
)
return
path
imageEnhancement/CreateNewFolderForVideos.py
View file @
64a584d0
# Python program to explain os.mkdir() method
# importing os module
import
os
def
createFolder
(
name
):
def
createFolderForEnhancedVideos
():
parentPath
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
EnhancedVideos"
totalFiles
=
0
...
...
@@ -21,22 +19,15 @@ def createFolder(name):
count
=
totalDir
+
1
# Directory
directory
=
name
# Parent Directory path
parent_dir
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
EnhancedVideos
\\
"
directory
=
"EnhancedVideo"
+
str
(
count
)
# Path
path
=
os
.
path
.
join
(
parent
_dir
,
directory
)
path
=
os
.
path
.
join
(
parent
Path
,
directory
)
# Create the directory
# 'GeeksForGeeks' in
# '/home / User / Documents'
os
.
mkdir
(
path
)
print
(
"path : "
+
path
)
print
(
"Directory '
%
s' created"
%
directory
)
return
directory
if
__name__
==
'__main__'
:
# Calling the function
createFolder
()
return
path
imageEnhancement/EnhaceFramesUsingUnsharpMasking.py
View file @
64a584d0
import
cv2
as
cv2
import
numpy
as
np
import
os
import
matplotlib.pyplot
as
plt
...
...
@@ -20,13 +19,9 @@ def enhanceFrames(folderName, rate):
for
file
in
os
.
listdir
(
path
):
if
file
.
endswith
(
".jpg"
):
image
=
cv2
.
imread
(
path
+
"
\\
"
+
file
)
# print(image)
# print("file : " + file)
gaussian_3
=
cv2
.
GaussianBlur
(
image
,
(
0
,
0
),
3.0
)
unsharp_image
=
cv2
.
addWeighted
(
image
,
5
,
gaussian_3
,
-
3.5
,
0
,
image
)
cv2
.
imwrite
(
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
+
"
\\
"
+
enhancedPath
+
"
\\
%
d.jpg"
%
count
,
unsharp_image
)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
count
+=
1
value
=
FramesToVid
.
generate_video
(
folderName
,
enhancedPath
,
rate
)
...
...
imageEnhancement/FramesToVid.py
View file @
64a584d0
...
...
@@ -3,25 +3,19 @@ import os
import
cv2
from
PIL
import
Image
# Video Generating function
from
imageEnhancement
import
CreateNewFolderForVideos
def
generate_video
(
folderName
,
enhancedPath
,
rate
):
print
(
"folder name : "
+
folderName
)
print
(
"enhancedPath : "
+
enhancedPath
)
video_folder_name
=
"video_"
+
folderName
CreateNewFolderForVideos
.
createFolder
(
video_folder_name
)
def
generate_video
(
folderName
,
parentFolder
,
rate
):
print
(
"Image folder : "
+
folderName
)
print
(
"parentFolder : "
+
parentFolder
)
video_folder_name
=
"video_"
+
folderName
.
split
(
'
\\
'
)[
5
]
# Checking the current directory path
#print(os.getcwd())
video_folder_path
=
CreateNewFolderForVideos
.
createFolderForEnhancedVideos
()
# Folder which contains all the images
# from which video is to be generated
#os.chdir("E:\\#ProgrammingWork\\Python\\VideoEnhance\\Frames\\"+folderName)
path
=
"E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
"
+
folderName
+
"
\\
"
+
enhancedPath
# path = "E:\\BACKBONE\\image_enhancement\\Frames\\"+folderName+"\\"+enhancedPath
path
=
folderName
mean_height
=
0
mean_width
=
0
...
...
@@ -44,9 +38,6 @@ def generate_video(folderName, enhancedPath, rate):
mean_width
=
int
(
mean_width
/
num_of_images
)
mean_height
=
int
(
mean_height
/
num_of_images
)
# print(mean_height)
# print(mean_width)
# Resizing of the images to give
# them same width and height
for
file
in
os
.
listdir
(
'.'
):
...
...
@@ -65,10 +56,12 @@ def generate_video(folderName, enhancedPath, rate):
print
(
im
.
filename
.
split
(
'
\\
'
)[
-
1
],
" is resized"
)
# ---------------------------------------------------------------------------------------------------------------
image_folder
=
'E:
\\
BACKBONE
\\
image_enhancement
\\
Frames
\\
'
+
folderName
+
'
\\
'
+
enhancedPath
# make sure to use your folder
video_name
=
'video_'
+
folderName
+
'.avi'
image_folder
=
folderName
print
(
"imagefolder "
,
image_folder
)
# make sure to use your folder
print
(
"video folder path "
,
video_folder_path
)
# make sure to use your folder
video_name
=
'Enhanced_Video.avi'
os
.
chdir
(
"E:
\\
BACKBONE
\\
image_enhancement
\\
EnhancedVideos
\\
"
+
video_folder_name
)
os
.
chdir
(
video_folder_path
)
images
=
[
img
for
img
in
os
.
listdir
(
image_folder
)
if
img
.
endswith
(
".jpg"
)
or
...
...
@@ -85,7 +78,7 @@ def generate_video(folderName, enhancedPath, rate):
# the width, height of first image
height
,
width
,
layers
=
frame
.
shape
video
=
cv2
.
VideoWriter
(
video_name
,
0
,
rate
,
(
width
,
height
))
video
=
cv2
.
VideoWriter
(
video_name
,
cv2
.
VideoWriter_fourcc
(
*
'MP4V'
)
,
rate
,
(
width
,
height
))
# Appending the images to the video one by one
for
image
in
images
:
...
...
@@ -94,5 +87,5 @@ def generate_video(folderName, enhancedPath, rate):
# Deallocating memories taken for window creation
# cv2.destroyAllWindows()
# video.release() # releasing the video generated
return
video_folder_name
+
"
\\
"
+
video_name
print
(
video_folder_path
.
split
(
'
\\
'
)[
4
])
return
video_folder_path
.
split
(
'
\\
'
)[
4
]
\ No newline at end of file
imageEnhancement/ImageSharpening.py
0 → 100644
View file @
64a584d0
import
cv2
import
numpy
as
np
import
os
from
imageEnhancement
import
CreateNewFolderForFrames
from
imageEnhancement
import
RemoveGaussianNoise
def
imageSharp
(
parentFolder
,
ContrastAdjustedFolder
,
rate
):
SharpImages
=
CreateNewFolderForFrames
.
createFolderForSharpImages
(
parentFolder
)
count
=
10000000
for
file
in
os
.
listdir
(
ContrastAdjustedFolder
):
if
file
.
endswith
(
".jpg"
):
image
=
cv2
.
imread
(
ContrastAdjustedFolder
+
"
\\
"
+
file
)
kernel_sharpening
=
np
.
array
([[
-
1
,
-
1
,
-
1
],
[
-
1
,
9
,
-
1
],
[
-
1
,
-
1
,
-
1
]])
# applying the sharpening kernel to the input image & displaying it.
sharpened
=
cv2
.
filter2D
(
image
,
-
1
,
kernel_sharpening
)
cv2
.
imwrite
(
SharpImages
+
"
\\
%
d.jpg"
%
count
,
sharpened
)
count
+=
1
value
=
RemoveGaussianNoise
.
removeGaussianNoise
(
parentFolder
,
SharpImages
,
rate
)
return
value
imageEnhancement/RemoveGaussianNoise.py
0 → 100644
View file @
64a584d0
import
cv2
import
os
from
imageEnhancement
import
CreateNewFolderForFrames
,
FramesToVid
from
imageEnhancement
import
Smooth
def
removeGaussianNoise
(
parentFolder
,
SharpImages
,
rate
):
GaussianDenoised
=
CreateNewFolderForFrames
.
DenoiseGaussian
(
parentFolder
)
count
=
10000000
for
file
in
os
.
listdir
(
SharpImages
):
if
file
.
endswith
(
".jpg"
):
img
=
cv2
.
imread
(
SharpImages
+
"
\\
"
+
file
)
dst
=
cv2
.
fastNlMeansDenoisingColored
(
img
,
None
,
10
,
10
,
7
,
5
)
cv2
.
imwrite
(
GaussianDenoised
+
"
\\
%
d.jpg"
%
count
,
dst
)
count
+=
1
# Smooth.imageSmooth(parentFolder, GaussianDenoised)
value
=
FramesToVid
.
generate_video
(
GaussianDenoised
,
parentFolder
,
rate
)
return
value
imageEnhancement/Smooth.py
0 → 100644
View file @
64a584d0
import
cv2
import
os
from
imageEnhancement
import
CreateNewFolderForFrames
def
imageSmooth
(
parentFolder
,
GaussianDenoised
):
smooth
=
CreateNewFolderForFrames
.
smoothImagesFolder
(
parentFolder
)
count
=
10000000
for
file
in
os
.
listdir
(
GaussianDenoised
):
if
file
.
endswith
(
".jpg"
):
img
=
cv2
.
imread
(
GaussianDenoised
+
"
\\
"
+
file
)
blur
=
cv2
.
bilateralFilter
(
img
,
60
,
90
,
90
)
cv2
.
imwrite
(
smooth
+
"
\\
%
d.jpg"
%
count
,
blur
)
count
+=
1
# if __name__ == '__main__':
# imageSmooth("Frames1", "E:\\BACKBONE\\image_enhancement\\Frames\\Frames1\\Sharp_Frames2")
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment