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
cf88e403
Commit
cf88e403
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Closes #34 (Count holes in the histogram)
parent
b640fe1c
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
+10
-2
10 additions, 2 deletions
analyze.sh
quack.sh
+3
-1
3 additions, 1 deletion
quack.sh
web/image_template.html
+1
-0
1 addition, 0 deletions
web/image_template.html
with
14 additions
and
3 deletions
analyze.sh
+
10
−
2
View file @
cf88e403
...
...
@@ -43,7 +43,7 @@ function im_identify() {
# Input: image
# Sample: foo.png
# Produces foo.grey with $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY
# Output: $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY
# Output: $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY
$ZEROES $HOLES
function
grey_stats
()
{
local
SRC
=
"
$1
"
if
[
!
-f
"
$SRC
"
]
;
then
...
...
@@ -56,6 +56,9 @@ function grey_stats() {
local
INFO
=
`
cat
"
$IDENTIFY
"
`
# 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="$INFO"
...
...
@@ -70,6 +73,11 @@ function grey_stats() {
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
ZEROES
=
$((
256
-
UNIQUE
))
local
SPAN
=
$((
LAST_GREY-FIRST_GREY+1
))
local
EDGE
=
$((
256
-
SPAN
))
local
HOLES
=
$((
ZEROES-EDGE
))
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'
`
...
...
@@ -87,7 +95,7 @@ function grey_stats() {
IFS
=
$SAVEIFS
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
$SPIKE_COUNT
$SPIKE_PERCENT
$SPIKE_GREY
"
echo
"
$PIXELS
$UNIQUE
$FIRST_COUNT
$PERCENT_FIRST
$FIRST_GREY
$LAST_COUNT
$PERCENT_LAST
$LAST_GREY
$SPIKE_COUNT
$SPIKE_PERCENT
$SPIKE_GREY
$ZEROES
$HOLES
"
}
# Produces a histogram over greyscale intensities in the given image
...
...
This diff is collapsed.
Click to expand it.
quack.sh
+
3
−
1
View file @
cf88e403
...
...
@@ -794,7 +794,7 @@ function makePreviewPage() {
# TODO: Use destination if that is lossless and faster to open?
local
GREY
=
`
grey_stats
"
$SOURCE_IMAGE
"
`
# $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY $COUNT_SPIKE $PERCENT_SPIKE $GREY_SPIKE
# $PIXELS $UNIQUE $FIRST_COUNT $PERCENT_FIRST $FIRST_GREY $LAST_COUNT $PERCENT_LAST $LAST_GREY $COUNT_SPIKE $PERCENT_SPIKE $GREY_SPIKE
$ZEROES $HOLES
# 1000095 512 82362 8.23 (0,0,0) 255 .02 (255,255,255)
GREY_PIXELS
=
`
echo
"
$GREY
"
|
cut
-d
\
-f1
`
GREY_UNIQUE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f2
`
...
...
@@ -807,6 +807,8 @@ function makePreviewPage() {
GREY_COUNT_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f9
`
GREY_PERCENT_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f10
`
GREY_SPIKE
=
`
echo
"
$GREY
"
|
cut
-d
\
-f11
`
GREY_ZEROES
=
`
echo
"
$GREY
"
|
cut
-d
\
-f12
`
GREY_HOLES
=
`
echo
"
$GREY
"
|
cut
-d
\
-f13
`
local
GREY_ALL_SOURCE
=
`
im_identify
"
$SOURCE_IMAGE
"
`
GREY_ALL
=
`
cat
"
$GREY_ALL_SOURCE
"
|
grep
-A
256 Histogram |
tail
-n
256
`
...
...
This diff is collapsed.
Click to expand it.
web/image_template.html
+
1
−
0
View file @
cf88e403
...
...
@@ -30,6 +30,7 @@ Dark ${GREY_FIRST}: ${GREY_PERCENT_FIRST}%<br/>
Spike ${GREY_SPIKE}: ${GREY_PERCENT_SPIKE}%
<br/>
Light ${GREY_LAST}: ${GREY_PERCENT_LAST}%
<br/>
Unique greyscale values: ${GREY_UNIQUE}
<br/>
Histogram holes: ${GREY_HOLES}
<br/>
ALTO-PC: ${ACCURACY}%
<p><input
type=
"checkbox"
id=
"toggle_grid"
onClick=
"toggleGrid();"
>
Grid
</input></p>
<p><input
type=
"checkbox"
id=
"toggle_textblock"
checked=
"checked"
onClick=
"toggleTextBlock();"
>
TextBlocks
</input></p>
...
...
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