Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Taddeüs Kroes
uva
Commits
0374d175
Commit
0374d175
authored
13 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
ImProc ass3: Fixed some stuff.
parent
ce1e1305
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
improc/ass3/intersect.py
+9
-14
9 additions, 14 deletions
improc/ass3/intersect.py
with
9 additions
and
14 deletions
improc/ass3/intersect.py
+
9
−
14
View file @
0374d175
...
...
@@ -10,11 +10,11 @@ def domainIterator(image):
yield
x
,
y
def
colHist
(
image
,
bins
,
model
):
h
=
zeros
(
bins
)
image
*=
bins
h
=
zeros
(
tuple
(
bins
)
)
image
*=
list
(
bins
)
if
model
==
'
rgb
'
:
image
/=
255
image
/=
255
.
elif
model
==
'
rgba
'
:
pass
...
...
@@ -37,20 +37,15 @@ def histogramIntersect(h1, h2):
return
match
/
h2
.
sum
()
# Create table of intersections
if
__name__
==
'
__main
'
:
if
__name__
==
'
__main
__
'
:
bins
=
[
8
]
*
3
print
'
Reading images...
'
db
=
map
(
lambda
x
:
imread
(
'
database/%d.jpg
'
%
x
),
range
(
1
,
3
))
print
'
done
'
table
=
zeros
((
len
(
db
),
len
(
db
)))
for
i
,
im1
in
enumerate
(
db
):
print
i
for
j
,
im2
in
enumerate
(
db
):
print
j
if
i
!=
j
:
print
i
,
j
table
[
i
,
j
]
=
histogramIntersect
(
colHist
(
im1
,
bins
,
'
rgb
'
),
colHist
(
im2
,
bins
,
'
rgb
'
))
for
i
,
im
in
enumerate
(
db
):
for
j
in
xrange
(
i
+
1
,
len
(
db
)):
print
'
comparing
'
,
i
,
j
table
[
i
,
j
]
=
histogramIntersect
(
colHist
(
im
,
bins
,
'
rgb
'
),
colHist
(
db
[
j
],
bins
,
'
rgb
'
))
print
table
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