Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
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
commul
Zeit.shift
Quack
Commits
a89ae740
Commit
a89ae740
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Closes #46 (The histogram values sometimes contain colormap data)
parent
a8465ea4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
analyze.sh
+22
-12
22 additions, 12 deletions
analyze.sh
with
22 additions
and
12 deletions
analyze.sh
+
22
−
12
View file @
a89ae740
...
...
@@ -66,6 +66,19 @@ function im_identify() {
}
export
-f
im_identify
# Outputs all the greyscale values and their counts
# Input: Image [destination]
function
greys
()
{
local
IFILE
=
`
im_identify
"
$1
"
"
$2
"
`
local
VALUES
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256 Histogram
`
if
[
!
"."
==
".
`
grep
Colormap
"
$IFILE
"
`
"
]
;
then
cat
"
$IFILE
"
|
grep
-A
257 Histogram |
grep
-B
256 Colormap |
grep
"[0-9]
\\
+: ("
else
cat
"
$IFILE
"
|
grep
-A
256 Histogram |
grep
"[0-9]
\\
+: ("
fi
}
export
-f
greys
# TODO: Accept destination for grey-stats-file as input
...
...
@@ -92,15 +105,16 @@ function grey_stats() {
local
GREY
=
${
DEST_FOLDER
}
/
${
BASE
%%.*
}
.grey
local
INFO
=
`
cat
"
$IDENTIFY
"
`
local
RAW_VALUES
=
`
greys
"
$SRC
"
"
$DEST_FOLDER
"
`
# TODO: No good as the histogram data might be much less than 256
local
VALUES
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256 Histogram
`
if
[
!
"."
==
".
`
echo
"
$VALUES
"
|
grep
Colormap
`
"
]
;
then
local
VALUES
=
`
echo
"
$VALUES
"
|
grep
-B
256 Colormap
`
fi
local
RAW_VALUES
=
`
echo
"
$VALUES
"
|
grep
"[0-9]
\\
+: ("
`
#
local VALUES=`cat "$IDENTIFY" | grep -A 256 Histogram`
#
if [ ! "." == ".`echo "$VALUES" | grep Colormap`" ]; then
#
local VALUES=`echo "$VALUES" | grep -B 256 Colormap`
#
fi
#
local RAW_VALUES=`echo "$VALUES" | grep "[0-9]\\+: ("`
# local VALUES="$INFO"
local
SAVEIFS
=
$IFS
# ***
#
local SAVEIFS=$IFS
IFS
=
$(
echo
-en
$"
\n
"
)
local
UNIQUE
=
`
echo
"
$RAW_VALUES
"
|
wc
-l
`
...
...
@@ -203,11 +217,7 @@ function histogramScript() {
# into
# 0 78085
# 1 3410
if
[
"."
==
".
`
grep
\"
Colormap:
\"
\"
$IDENTIFY
\"
`
"
]
;
then
GREYS
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256
" Histogram:"
|
grep
-o
"
\\
+[0-9]
\\
+: ( *[0-9]
\\
+, *[0-9]
\\
+, *[0-9]
\\
+)"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
else
GREYS
=
`
cat
"
$IDENTIFY
"
|
grep
-A
9999
" Histogram:"
|
grep
-B
256
"Colormap:"
|
grep
-o
"
\\
+[0-9]
\\
+: ( *[0-9]
\\
+, *[0-9]
\\
+, *[0-9]
\\
+)"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
fi
GREYS
=
`
greys
"
$SRC
"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
# Find lowest and highest for both intensity and count
local
MIN_GREY
=
255
local
MAX_GREY
=
0
...
...
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