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
0b7f3e22
Commit
0b7f3e22
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Grey stats shows highest spike
parent
9e12b2d0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
analyze.sh
+13
-8
13 additions, 8 deletions
analyze.sh
image_template.html
+3
-2
3 additions, 2 deletions
image_template.html
quack.sh
+4
-1
4 additions, 1 deletion
quack.sh
with
20 additions
and
11 deletions
analyze.sh
+
13
−
8
View file @
0b7f3e22
...
@@ -51,21 +51,25 @@ function grey_stats() {
...
@@ -51,21 +51,25 @@ function grey_stats() {
local
IDENTIFY
=
$(
im_identify
"
$SRC
"
)
local
IDENTIFY
=
$(
im_identify
"
$SRC
"
)
local
GREY
=
${
SRC
%%.*
}
.grey
local
GREY
=
${
SRC
%%.*
}
.grey
local
INFO
=
`
cat
"
$IDENTIFY
"
`
local
INFO
=
`
cat
"
$IDENTIFY
"
`
# TODO: No good as
large images does not produce a Colormap
# TODO: No good as
the histogram data might be much less than 256
local
VALUES
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256 Histogram
`
local
VALUES
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256 Histogram
`
local
RAW_VALUES
=
`
echo
"
$VALUES
"
|
grep
"[0-9]
\\
+: ("
`
# local VALUES="$INFO"
# local VALUES="$INFO"
local
SAVEIFS
=
$IFS
local
SAVEIFS
=
$IFS
IFS
=
$(
echo
-en
"
\n
"
)
IFS
=
$(
echo
-en
"
\n
"
)
local
UNIQUE
=
`
echo
$VALUES
|
grep
"[0-9]
\\
+: ("
|
wc
-l
`
local
UNIQUE
=
`
echo
$
RAW_
VALUES
|
wc
-l
`
local
FIRST_COUNT
=
`
echo
$VALUES
|
grep
"[0-9]
\\
+: ("
|
head
-n
1 |
grep
-o
" [0-9]
\\
+:"
|
grep
-o
"[0-9]
\\
+"
`
local
FIRST_COUNT
=
`
echo
$RAW_VALUES
|
head
-n
1 |
grep
-o
" [0-9]
\\
+:"
|
grep
-o
"[0-9]
\\
+"
`
local
FIRST_GREY
=
`
echo
$VALUES
|
grep
"[0-9]
\\
+: ("
|
head
-n
1 |
grep
-o
" ([0-9 ,]*)"
|
sed
's/ //g'
`
local
FIRST_GREY
=
`
echo
$RAW_VALUES
|
head
-n
1 |
grep
-o
" ([0-9 ,]*)"
|
sed
's/ //g'
`
local
LAST_COUNT
=
`
echo
$VALUES
|
grep
"[0-9]
\\
+: ("
|
tail
-n
1 |
grep
-o
" [0-9]
\\
+:"
|
grep
-o
"[0-9]
\\
+"
`
local
LAST_GREY
=
`
echo
$VALUES
|
grep
"[0-9]
\\
+: ("
|
tail
-n
1 |
grep
-o
" ([0-9 ,]*)"
|
sed
's/ //g'
`
local
LAST_COUNT
=
`
echo
$RAW_VALUES
|
tail
-n
1 |
grep
-o
" [0-9]
\\
+:"
|
grep
-o
"[0-9]
\\
+"
`
local
LAST_GREY
=
`
echo
$RAW_VALUES
|
tail
-n
1 |
grep
-o
" ([0-9 ,]*)"
|
sed
's/ //g'
`
local
SPIKE_COUNT
=
`
echo
$RAW_VALUES
|
sort
-n
|
tail
-n
1 |
grep
-o
" [0-9]
\\
+:"
|
grep
-o
"[0-9]
\\
+"
`
local
SPIKE_GREY
=
`
echo
$RAW_VALUES
|
sort
-n
|
tail
-n
1 |
grep
-o
" ([0-9 ,]*)"
|
sed
's/ //g'
`
local
GEOMETRY
=
`
echo
$INFO
|
grep
"Geometry: [0-9]
\\
+x[0-9]
\\
+"
|
grep
-o
"[0-9]
\\
+x[0-9]
\\
+"
`
local
GEOMETRY
=
`
echo
$INFO
|
grep
"Geometry: [0-9]
\\
+x[0-9]
\\
+"
|
grep
-o
"[0-9]
\\
+x[0-9]
\\
+"
`
local
X
=
`
echo
$GEOMETRY
|
grep
-o
"[0-9]
\\
+x"
|
grep
-o
"[0-9]
\\
+"
`
local
X
=
`
echo
$GEOMETRY
|
grep
-o
"[0-9]
\\
+x"
|
grep
-o
"[0-9]
\\
+"
`
local
Y
=
`
echo
$GEOMETRY
|
grep
-o
"x[0-9]
\\
+"
|
grep
-o
"[0-9]
\\
+"
`
local
Y
=
`
echo
$GEOMETRY
|
grep
-o
"x[0-9]
\\
+"
|
grep
-o
"[0-9]
\\
+"
`
...
@@ -74,12 +78,13 @@ function grey_stats() {
...
@@ -74,12 +78,13 @@ function grey_stats() {
# http://stackoverflow.com/questions/8402181/how-do-i-get-bc1-to-print-the-leading-zero
# http://stackoverflow.com/questions/8402181/how-do-i-get-bc1-to-print-the-leading-zero
local
PERCENT_FIRST
=
`
echo
"scale=2;x=
$FIRST_COUNT
*100/
$PIXELS
; if(x<1) print 0; x"
| bc
`
local
PERCENT_FIRST
=
`
echo
"scale=2;x=
$FIRST_COUNT
*100/
$PIXELS
; if(x<1) print 0; x"
| bc
`
local
PERCENT_LAST
=
`
echo
"scale=2;x=
$LAST_COUNT
*100/
$PIXELS
; if(x<1) print 0; x"
| bc
`
local
PERCENT_LAST
=
`
echo
"scale=2;x=
$LAST_COUNT
*100/
$PIXELS
; if(x<1) print 0; x"
| bc
`
local
SPIKE_PERCENT
=
`
echo
"scale=2;x=
$SPIKE_COUNT
*100/
$PIXELS
; if(x<1) print 0; x"
| bc
`
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
"
>
"
$GREY
"
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
"
>
"
$GREY
"
IFS
=
$SAVEIFS
IFS
=
$SAVEIFS
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
"
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
$SPIKE_COUNT
$SPIKE_PERCENT
$SPIKE_GREY
"
}
}
# Produces a histogram over greyscale intensities in the given image
# Produces a histogram over greyscale intensities in the given image
...
...
This diff is collapsed.
Click to expand it.
image_template.html
+
3
−
2
View file @
0b7f3e22
...
@@ -26,8 +26,9 @@ ${IDPREVS}
...
@@ -26,8 +26,9 @@ ${IDPREVS}
${ALTERNATIVES}
${ALTERNATIVES}
<p
class=
"histogram"
><img
src=
"${HISTOGRAM}"
width=
"256"
height=
"200"
alt=
"histogram"
/></p>
<p
class=
"histogram"
><img
src=
"${HISTOGRAM}"
width=
"256"
height=
"200"
alt=
"histogram"
/></p>
<p
class=
"greystats"
>
<p
class=
"greystats"
>
${GREY_FIRST}: ${GREY_PERCENT_FIRST}%
<br/>
Darkest ${GREY_FIRST}: ${GREY_PERCENT_FIRST}%
<br/>
${GREY_LAST}: ${GREY_PERCENT_LAST}%
<br/>
Spike ${GREY_SPIKE}: ${GREY_PERCENT_SPIKE}%
<br/>
Lightest ${GREY_LAST}: ${GREY_PERCENT_LAST}%
<br/>
Unique greyscale values: ${GREY_UNIQUE}
<br/>
Unique greyscale values: ${GREY_UNIQUE}
<br/>
ALTO-accuracy: ${ACCURACY}%
ALTO-accuracy: ${ACCURACY}%
<p><input
type=
"checkbox"
id=
"toggle_grid"
onClick=
"toggleGrid();"
>
Grid
</input></p>
<p><input
type=
"checkbox"
id=
"toggle_grid"
onClick=
"toggleGrid();"
>
Grid
</input></p>
...
...
This diff is collapsed.
Click to expand it.
quack.sh
+
4
−
1
View file @
0b7f3e22
...
@@ -700,7 +700,7 @@ function makePreviewPage() {
...
@@ -700,7 +700,7 @@ function makePreviewPage() {
# TODO: Use destination if that is lossless and faster to open?
# TODO: Use destination if that is lossless and faster to open?
local
GREY
=
`
grey_stats
"
$SOURCE_IMAGE
"
`
local
GREY
=
`
grey_stats
"
$SOURCE_IMAGE
"
`
# $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY
# $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY
$COUNT_SPIKE $PERCENT_SPIKE $GREY_SPIKE
# 1000095 512 82362 8.23 (0,0,0) 255 .02 (255,255,255)
# 1000095 512 82362 8.23 (0,0,0) 255 .02 (255,255,255)
GREY_PIXELS
=
`
echo
"
$GREY
"
|
cut
-d
\
-f1
`
GREY_PIXELS
=
`
echo
"
$GREY
"
|
cut
-d
\
-f1
`
GREY_UNIQUE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f2
`
GREY_UNIQUE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f2
`
...
@@ -710,6 +710,9 @@ function makePreviewPage() {
...
@@ -710,6 +710,9 @@ function makePreviewPage() {
GREY_COUNT_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f6
`
GREY_COUNT_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f6
`
GREY_PERCENT_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f7
`
GREY_PERCENT_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f7
`
GREY_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f8
`
GREY_LAST
=
`
echo
"
$GREY
"
|
cut
-d
\
-f8
`
GREY_COUNT_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f9
`
GREY_PERCENT_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f10
`
GREY_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f11
`
local
GREY_ALL_SOURCE
=
`
im_identify
$SOURCE_IMAGE
`
local
GREY_ALL_SOURCE
=
`
im_identify
$SOURCE_IMAGE
`
GREY_ALL
=
`
cat
"
$GREY_ALL_SOURCE
"
|
grep
-A
256 Histogram |
tail
-n
256
`
GREY_ALL
=
`
cat
"
$GREY_ALL_SOURCE
"
|
grep
-A
256 Histogram |
tail
-n
256
`
...
...
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