Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
exp-ml-2-hillengass-graf
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
igraf
exp-ml-2-hillengass-graf
Commits
b7735644
Commit
b7735644
authored
1 year ago
by
igraf
Browse files
Options
Downloads
Patches
Plain Diff
Add alternative way to read image
parent
320c4fd7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
project/minimal_examples/apply_filters.py
+4
-3
4 additions, 3 deletions
project/minimal_examples/apply_filters.py
project/minimal_examples/extract_features.py
+1
-0
1 addition, 0 deletions
project/minimal_examples/extract_features.py
with
5 additions
and
3 deletions
project/minimal_examples/apply_filters.py
+
4
−
3
View file @
b7735644
...
...
@@ -8,18 +8,19 @@ from skimage.io import imread
from
skimage.filters
import
sobel
# Read image from file
image
=
imread
(
"
../figures/examples_from_dataset/banana.jpg
"
,
as_gray
=
False
)
image
=
cv2
.
imread
(
"
../figures/examples_from_dataset/banana.jpg
"
)
#image = imread("../figures/examples_from_dataset/banana.jpg", as_gray=False) # Alternative way to read image
# Resizing image to 50x50
image_resized
=
cv2
.
resize
(
image
,
(
50
,
50
))
cv2
.
imwrite
(
'
../figures/examples_from_dataset/banana-resized.jpg
'
,
image_resized
)
# Use Canny edge detection filter and save to file
edge_img
=
cv2
.
Canny
(
image
,
threshold1
=
50
,
threshold2
=
8
0
)
edge_img
=
cv2
.
Canny
(
image
,
threshold1
=
1
50
,
threshold2
=
30
0
)
cv2
.
imwrite
(
'
../figures/examples_from_dataset/banana-edges.jpg
'
,
edge_img
)
# Use Canny edge detection filter for resized image and save to file
edge_img_resized
=
cv2
.
Canny
(
image_resized
,
threshold1
=
50
,
threshold2
=
8
0
)
edge_img_resized
=
cv2
.
Canny
(
image_resized
,
threshold1
=
1
50
,
threshold2
=
30
0
)
cv2
.
imwrite
(
'
../figures/examples_from_dataset/banana-edges-resized.jpg
'
,
edge_img_resized
)
# Use sobel filter and save to file
...
...
This diff is collapsed.
Click to expand it.
project/minimal_examples/extract_features.py
+
1
−
0
View file @
b7735644
...
...
@@ -12,6 +12,7 @@ from skimage.io import imread
# Read image from file
image
=
imread
(
"
../figures/examples_from_dataset/banana.jpg
"
,
as_gray
=
False
)
# image = cv2.imread("../figures/examples_from_dataset/banana.jpg") # Alternative way to read image
print
(
"
Shape of original image:
"
,
image
.
shape
)
# Save features in file
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment