You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

482 line
19 KiB

  1. % This is LLNCS.DEM the demonstration file of
  2. % the LaTeX macro package from Springer-Verlag
  3. % for Lecture Notes in Computer Science,
  4. % version 2.2 for LaTeX2e
  5. %
  6. \documentclass{llncs}
  7. %
  8. \usepackage{makeidx} % allows for indexgeneration
  9. \usepackage{graphicx} % for gnuplot epslatex stuff
  10. \usepackage{color} % ditto
  11. \usepackage{pstricks} % for inkscape TeX output
  12. %
  13. \begin{document}
  14. %
  15. \mainmatter % start of the contributions
  16. %
  17. \title{Reinstating Floyd-Steinberg: Improved Metrics for Quality Assessment
  18. of Error Diffusion Algorithms}
  19. %
  20. \titlerunning{Adapting Qualitative Metrics to Common Error Diffusion Algorithms} % abbreviated title (for running head)
  21. % also used for the TOC unless
  22. % \toctitle is used
  23. %
  24. \author{Sam Hocevar\inst{1} \and Gary Niger\inst{2}}
  25. %
  26. \authorrunning{Sam Hocevar et al.} % abbreviated author list (for running head)
  27. %
  28. %%%% modified list of authors for the TOC (add the affiliations)
  29. \tocauthor{Sam Hocevar, Gary Niger (Laboratoire d'Imagerie Bureautique et de
  30. Conception Artistique)}
  31. %
  32. \institute{Laboratoire d'Imagerie Bureautique et de Conception Artistique\\
  33. 14 rue de Plaisance, Paris, France
  34. \and
  35. 143 Rolloffle Avenue, Tarzana, California 91356\\
  36. \email{sam@hocevar.net}, \email{gary\_niger@gnaa.us}}
  37. \maketitle % typeset the title of the contribution
  38. \begin{abstract}
  39. In this contribution we introduce a little-known property of error diffusion
  40. halftoning algorithms which we call {\it error diffusion displacement}.
  41. By accounting for the inherent sub-pixel displacement caused by the error
  42. propagation, we correct an important flaw in most metrics used to assess the
  43. quality of resulting halftones. We find these metrics to usually highly
  44. underestimate the quality of error diffusion in comparison to more modern
  45. algorithms such as direct binary search.
  46. Using empirical observation, we give a method for creating computationally
  47. efficient, image-independent, model-based metrics for this quality assessment.
  48. Finally, we use the properties of error diffusion displacement to justify
  49. Floyd and Steinberg's well-known choice of algorithm coefficients.
  50. {\bf Keywords}: halftoning, error diffusion, image quality, human visual
  51. system, color quantization
  52. \end{abstract}
  53. %
  54. \section{Introduction}
  55. Image dithering is the process of reducing continuous-tone images to images
  56. with a limited number of available colours. Applications vary tremendously,
  57. from laser and ink-jet printing to display on small devices such as cellphones,
  58. or even the design of banknotes.
  59. Countless methods have been published for the last 40 years that try to best
  60. address the problem of colour reduction. Comparing two algorithms in terms of
  61. speed or memory usage is often straightforward, but how exactly a halftoning
  62. algorithm performs quality-wise is a far more complex issue, as it highly
  63. depends on the display device and the inner workings of the human eye.
  64. Though this document focuses on the particular case of bilevel halftoning,
  65. most of our results can be directly adapted to the more generic problem of
  66. colour reduction.
  67. \section{Halftoning algorithms}
  68. The most ancient halftoning method is probably classical screening. This highly
  69. parallelisible algorithm consists in tiling a dither matrix over the image
  70. and using its elements as threshold values. Classical screening is known for
  71. its structural artifacts such as the cross-hatch patterns caused by Bayer
  72. ordered dither matrices \cite{bayer}. However, modern techniques such as the
  73. void-and-cluster method \cite{void1}, \cite{void2} allow to generate screens
  74. yielding visually pleasing results.
  75. \medskip Error diffusion dithering, introduced in 1976 by Floyd and Steinberg
  76. \cite{fstein}, tries to compensate for the thresholding error through the use
  77. of feedback. Typically applied in raster scan order, it uses an error diffusion
  78. matrix such as the following one, where $x$ denotes the pixel being processed:
  79. \[ \frac{1}{16} \left| \begin{array}{ccc}
  80. - & x & 7 \\
  81. 3 & 5 & 1 \end{array} \right| \]
  82. Though efforts have been made to make error diffusion parallelisable
  83. \cite{parfstein}, it is generally considered more computationally expensive
  84. than screening, but carefully chosen coefficients yield good visual results
  85. \cite{kite}.
  86. \medskip Model-based halftoning is the third important algorithm category. It
  87. relies on a model of the human visual system (HVS) and attempts to minimise
  88. an error value based on that model. One such algorithm is direct binary seach
  89. (DBS) \cite{allebach}, also referred to as least-squares model-based halftoning
  90. (LSMB) \cite{lsmb}.
  91. HVS models are usually low-pass filters. Nasanen \cite{nasanen}, Analoui
  92. and Allebach \cite{allebach} found that using Gaussian models gave visually
  93. pleasing results, an observation confirmed by independent visual perception
  94. studies \cite{mcnamara}.
  95. DBS yields halftones of impressive quality. However, despite efforts to make
  96. it more efficient \cite{bhatt}, it suffers from its large computational
  97. requirements and error diffusion remains a more widely used technique.
  98. \section{Error diffusion displacement}
  99. Most error diffusion implementations parse the image in raster scan order.
  100. Boustrophedonic (serpentine) scanning has been shown to cause fewer visual
  101. artifacts \cite{halftoning}, but other, more complex processing paths such as
  102. Hilbert curves \cite{spacefilling}, \cite{peano} are seldom used as they do not
  103. improve the image quality significantly.
  104. Intuitively, as the error is always propagated to the bottom-left or
  105. bottom-right of each pixel (Fig. \ref{fig:direction}), one may expect the
  106. resulting image to be slightly translated. This expectation is confirmed
  107. visually when rapidly switching between an error diffused image and the
  108. corresponding DBS halftone.
  109. \begin{figure}
  110. \begin{center}
  111. \input{direction}
  112. \caption{Floyd-Steinberg error diffusion direction in raster scan (left)
  113. and serpentine scan (right).}\label{fig:direction}
  114. \end{center}
  115. \end{figure}
  116. This small translation is visually innocuous but we found that it means a lot
  117. in terms of error computation. A common way to compute the error between an
  118. image $h_{i,j}$ and the corresponding binary halftone $b_{i,j}$ is to compute
  119. the mean square error between modified versions of the images, in the form:
  120. \begin{equation}
  121. E(h,b) = \frac{(||v * h_{i,j} - v * b_{i,j}||_2)^2}{wh}
  122. \end{equation}
  123. \noindent where $w$ and $h$ are the image dimensions, $*$ denotes the
  124. convolution and $v$ is a model for the human visual system.
  125. To compensate for the slight translation observed in the halftone, we use the
  126. following error metric instead:
  127. \begin{equation}
  128. E_{dx,dy}(h,b) = \frac{(||v * h_{i,j} - v * t_{dx,dy} * b_{i,j}||_2)^2}{wh}
  129. \end{equation}
  130. \noindent where $t_{dx,dy}$ is an operator which translates the image along the
  131. $(dx,dy)$ vector. By design, $E_{0,0} = E$.
  132. A simple example can be given using a Gaussian HVS model:
  133. \begin{equation}
  134. v(x,y) = e^{\frac{x^2+y^2}{2\sigma^2}}
  135. \end{equation}
  136. Finding the second filter is then straightforward:
  137. \begin{equation}
  138. (v * t_{dx,dy})(x,y) = e^{\frac{(x-dx)^2+(y-dy)^2}{2\sigma^2}}
  139. \end{equation}
  140. Experiments show that for a given image and a given corresponding halftone,
  141. $E_{dx,dy}$ has a local minimum almost always away from $(dx,dy) = (0,0)$ (Fig.
  142. \ref{fig:lena-min}). Let $E$ be an error metric where this remains true. We
  143. call the local minimum $E_{min}$:
  144. \begin{equation}
  145. E_{min}(h,b) = \min_{dx,dy}E_{dx,dy}(h,b)
  146. \end{equation}
  147. \begin{figure}
  148. \begin{center}
  149. \input{lena-min}
  150. \caption{Mean square error for the \textit{Lena} image. $v$ is a simple
  151. $11\times11$ Gaussian convolution kernel with $\sigma = 1.2$ and
  152. $(dx,dy)$ vary in $[-1,1]\times[-1,1]$.}
  153. \label{fig:lena-min}
  154. \end{center}
  155. \end{figure}
  156. For instance, a Floyd-Steinberg dither of \textit{Lena} with $\sigma = 1.2$
  157. yields a per-pixel mean square error of $3.67\times10^{-4}$. However, when
  158. taking the displacement into account, the error becomes $3.06\times10^{-4}$ for
  159. $(dx,dy) = (0.165,0.293)$. The new, corrected error is significantly smaller,
  160. with the exact same input and output images.
  161. Experiments show that the corrected error is always noticeably smaller except
  162. in the case of images that are already mostly pure black and white. The
  163. experiment was performed on a database of 10,000 images from common computer
  164. vision sets and from the image board \textit{4chan}, providing a representative
  165. sampling of the photographs, digital art and business graphics widely exchanged
  166. on the Internet nowadays \cite{4chan}.
  167. In addition to the classical Floyd-Steinberg and Jarvis-Judice-Ninke kernels,
  168. we tested two serpentine error diffusion algorithms: Ostromoukhov's simple
  169. error diffusion \cite{ostromoukhov}, which uses a variable coefficient kernel,
  170. and Wong and Allebach's optimum error diffusion kernel \cite{wong}.
  171. \begin{center}
  172. \begin{tabular}{|l|c|c|}
  173. \hline
  174. &~ $E\times10^4$ ~&~ $E_{min}\times10^4$ ~\\ \hline
  175. ~raster Floyd-Steinberg ~&~ 3.7902 ~&~ 3.1914 ~\\ \hline
  176. ~raster Ja-Ju-Ni ~&~ 9.7013 ~&~ 6.6349 ~\\ \hline
  177. ~Ostromoukhov ~&~ 4.6892 ~&~ 4.4783 ~\\ \hline
  178. ~optimum kernel ~&~ 7.5209 ~&~ 6.5772 ~\\
  179. \hline
  180. \end{tabular}
  181. \end{center}
  182. We clearly see that usual metrics underestimate the quality of error-diffused
  183. halftones, especially in raster scan. Algorithms such as direct binary search,
  184. on the other hand, do not suffer from this bias since they are designed to
  185. minimise the very error induced by the HVS model.
  186. \section{An image-independent corrected quality metric for error-diffused
  187. halftones}
  188. We have seen that for a given image, $E_{min}(h,b)$ is a better and fairer
  189. visual error measurement than $E(h,b)$. However, its major drawback is that it
  190. is highly computationally expensive: for each image, the new $(dx,dy)$ values
  191. need to be calculated to minimise the error value.
  192. Fortunately, we found that for a given raster or serpentine scan
  193. error diffusion algorithm, there was often very little variation in
  194. the optimal $(dx,dy)$ values (Fig. \ref{fig:table-historaster} and
  195. \ref{fig:table-histoserp}).
  196. \begin{figure}
  197. \begin{center}
  198. \begin{minipage}[c]{0.50\textwidth}
  199. \input{fs-histo}
  200. \end{minipage}
  201. \begin{minipage}[c]{0.40\textwidth}
  202. \input{jajuni-histo}
  203. \end{minipage}
  204. \caption{error diffusion displacement histograms for the raster
  205. Floyd-Steinberg (left) and raster Jarvis, Judis and Ninke (right)
  206. algorithms applied to a corpus of 10,000 images}
  207. \label{fig:table-historaster}
  208. \end{center}
  209. \end{figure}
  210. \begin{figure}
  211. \begin{center}
  212. \begin{minipage}[c]{0.50\textwidth}
  213. \input{ostro-histo}
  214. \end{minipage}
  215. \begin{minipage}[c]{0.40\textwidth}
  216. \input{serpopt-histo}
  217. \end{minipage}
  218. \caption{error diffusion displacement histograms for the Ostromoukhov (left) and optimum kernel (right) algorithms applied to a corpus
  219. of 10,000 images}
  220. \label{fig:table-histoserp}
  221. \end{center}
  222. \end{figure}
  223. For each algorithm, we choose the $(dx,dy)$ values at the histogram peak and
  224. we refer to them as the \textit{algorithm's displacement}, as opposed to the
  225. \textit{image's displacement} for a given algorithm. We call $E_{fast}(h,b)$
  226. the error computed at $(dx,dy)$. As $E_{fast}$ does not depend on the image, it
  227. is a lot faster to compute than $E_{min}$, and as it is statistically closer to
  228. $E_{min}$, we can expect it to be a better error estimation than $E$.
  229. \begin{center}
  230. \begin{tabular}{|l|c|c|c|c|}
  231. \hline
  232. &~ $E\times10^4$ ~&~ $dx$ ~&~ $dy$ ~&~ $E_{fast}\times10^4$ ~\\ \hline
  233. ~raster Floyd-Steinberg ~&~ 3.7902 ~&~ 0.16 ~&~ 0.28 ~&~ 3.3447 ~\\ \hline
  234. ~raster Ja-Ju-Ni ~&~ 9.7013 ~&~ 0.26 ~&~ 0.76 ~&~ 7.5891 ~\\ \hline
  235. ~Ostromoukhov ~&~ 4.6892 ~&~ 0.00 ~&~ 0.19 ~&~ 4.6117 ~\\ \hline
  236. ~optimum kernel ~&~ 7.5209 ~&~ 0.00 ~&~ 0.34 ~&~ 6.8233 ~\\
  237. \hline
  238. \end{tabular}
  239. \end{center}
  240. \section{Using error diffusion displacement for optimum kernel design}
  241. We believe that our higher quality $E_{min}$ error metric may be useful in
  242. kernel design, because it is the very same error that admittedly superior yet
  243. computationally expensive algorithms such as DBS try to minimise.
  244. Our first experiment was a study of the Floyd-Steinberg-like 4-block error
  245. diffusion kernels. According to the original authors, the coefficients were
  246. found "mostly by trial and error" \cite{fstein}. With our improved metric, we
  247. now have the tools to confirm or infirm Floyd and Steinberg's initial choice.
  248. We chose to do an exhaustive study of every $\frac{1}{16}\{a,b,c,d\}$ integer
  249. combination. We deliberately chose positive integers whose sum was 16: error
  250. diffusion coefficients smaller than zero or adding up to more than 1 are known
  251. to be unstable \cite{stability}, and diffusing less than 100\% of the error
  252. causes important loss of detail in the shadow and highlight areas of the image.
  253. We studied all possible coefficients on a pool of 3,000 images with an error
  254. metric $E$ based on a standard Gaussian HVS model. $E_{min}$ is only given here
  255. as an indication and only $E$ was used to elect the best coefficients:
  256. \begin{center}
  257. \begin{tabular}{|c|c|c|c|}
  258. \hline
  259. ~ rank ~&~ coefficients ~&~ $E\times10^4$ ~&~ $E_{min}\times10^4$ ~\\ \hline
  260. ~ 1 ~&~ 7 3 6 0 ~&~ 4.65512 ~&~ 3.94217 ~\\ \hline
  261. ~ 2 ~&~ 8 3 5 0 ~&~ 4.65834 ~&~ 4.03699 ~\\ \hline
  262. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\ \hline
  263. ~ 5 ~&~ 7 3 5 1 ~&~ 4.68588 ~&~ 3.79556 ~\\ \hline
  264. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\ \hline
  265. ~ 18 ~&~ 6 3 5 2 ~&~ 4.91020 ~&~ 3.70465 ~\\ \hline
  266. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\
  267. \hline
  268. \end{tabular}
  269. \end{center}
  270. The exact same operation using $E_{min}$ as the decision variable yields very
  271. different results. Similarly, $E$ is only given here as an indication:
  272. \begin{center}
  273. \begin{tabular}{|c|c|c|c|}
  274. \hline
  275. ~ rank ~&~ coefficients ~&~ $E_{min}\times10^4$ ~&~ $E\times10^4$ ~\\ \hline
  276. ~ 1 ~&~ 6 3 5 2 ~&~ 3.70465 ~&~ 4.91020 ~\\ \hline
  277. ~ 2 ~&~ 7 3 5 1 ~&~ 3.79556 ~&~ 4.68588 ~\\ \hline
  278. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\ \hline
  279. ~ 15 ~&~ 7 3 6 0 ~&~ 3.94217 ~&~ 4.65512 ~\\ \hline
  280. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\ \hline
  281. ~ 22 ~&~ 8 3 5 0 ~&~ 4.03699 ~&~ 4.65834 ~\\ \hline
  282. ~ \dots ~&~ \dots ~&~ \dots ~&~ \dots ~\\
  283. \hline
  284. \end{tabular}
  285. \end{center}
  286. Our improved metric allowed us to confirm that the original Floyd-Steinberg
  287. coefficients were indeed amongst the best possible for raster scan.
  288. More importantly, using $E$ as the decision variable may have elected
  289. $\frac{1}{16}\{8,4,4,0\}$, which is in fact a poor choice.
  290. For serpentine scan, however, our experiment suggests that
  291. $\frac{1}{16}\{7,4,5,0\}$ is a better choice than the Floyd-Steinberg
  292. coefficients that have nonetheless been widely in use so far (Fig.
  293. \ref{fig:lena7450}).
  294. \begin{figure}
  295. \begin{center}
  296. \includegraphics[width=0.8\textwidth]{lena.eps}
  297. \caption{halftone of \textit{Lena} using serpentine error diffusion and
  298. the optimum coefficients $\frac{1}{16}\{7,4,5,0\}$ that improve
  299. on the standard Floyd-Steinberg coefficients in terms of visual
  300. quality for the HVS model studied in section 3.}
  301. \label{fig:lena7450}
  302. \end{center}
  303. \end{figure}
  304. \section{Conclusion}
  305. We have disclosed an interesting property of error diffusion algorithms
  306. allowing to more precisely measure the quality of such halftoning methods.
  307. Having showed that such quality is often underestimated by usual metrics,
  308. we hope to see even more development in simple error diffusion methods.
  309. Confirming Floyd and Steinberg's 30-year old "trial-and-error" result with our
  310. work is only the beginning: future work may cover more complex HVS models,
  311. for instance by taking into account the angular dependance of the human eye
  312. \cite{sullivan}. We plan to use our new metric to improve all error diffusion
  313. methods that may require fine-tuning of their propagation coefficients.
  314. %
  315. % ---- Bibliography ----
  316. %
  317. \begin{thebibliography}{}
  318. %
  319. \bibitem[1]{bayer}
  320. B. Bayer,
  321. \textit{Color imaging array}.
  322. U.S. patent 3,971,065 (1976)
  323. \bibitem[2]{void1}
  324. R.A. Ulichney (Digital Equipment Corporation),
  325. \textit{Void and cluster apparatus and method for generating dither templates}.
  326. U.S. patent 5,535,020 (1992)
  327. \bibitem[3]{void2}
  328. H. Ancin, A. Bhattacharjya and J. Shu (Seiko Epson Corporation),
  329. \textit{Void-and-cluster dither-matrix generation for better half-tone
  330. uniformity}.
  331. U.S. patent 6,088,512 (1997)
  332. \bibitem[4]{fstein}
  333. R.W. Floyd, L. Steinberg,
  334. \textit{An adaptive algorithm for spatial grey scale}.
  335. Proceedings of the Society of Information Display 17, (1976) 75--77
  336. \bibitem[5]{parfstein}
  337. P. Metaxas,
  338. \textit{Optimal Parallel Error-Diffusion Dithering}.
  339. Color Imaging: Device-Indep. Color, Color Hardcopy, and Graphic Arts IV, Proc.
  340. SPIE 3648, 485--494 (1999)
  341. \bibitem[6]{kite}
  342. T. D. Kite,
  343. \textit{Design and Quality Assessment of Forward and Inverse Error-Diffusion
  344. Halftoning Algorithms}.
  345. PhD thesis, Dept. of ECE, The University of Texas at Austin, Austin, TX, Aug.
  346. 1998
  347. \bibitem[7]{halftoning}
  348. R. Ulichney,
  349. \textit{Digital Halftoning}.
  350. MIT Press, 1987
  351. \bibitem[8]{spacefilling}
  352. L. Velho and J. Gomes,
  353. \textit{Digital halftoning with space-filling curves}.
  354. Computer Graphics (Proceedings of SIGGRAPH 91), 25(4):81--90, 1991
  355. \bibitem[9]{peano}
  356. I.~H. Witten and R.~M. Neal,
  357. \textit{Using peano curves for bilevel display of continuous-tone images}.
  358. IEEE Computer Graphics \& Appl., 2:47--52, 1982
  359. \bibitem[10]{nasanen}
  360. R. Nasanen,
  361. \textit{Visibility of halftone dot textures}.
  362. IEEE Trans. Syst. Man. Cyb., vol. 14, no. 6, pp. 920--924, 1984
  363. \bibitem[11]{allebach}
  364. M. Analoui and J.~P. Allebach,
  365. \textit{Model-based halftoning using direct binary search}.
  366. Proc. of SPIE/IS\&T Symp. on Electronic Imaging Science and Tech.,
  367. February 1992, San Jose, CA, pp. 96--108
  368. \bibitem[12]{mcnamara}
  369. Ann McNamara,
  370. \textit{Visual Perception in Realistic Image Synthesis}.
  371. Computer Graphics Forum, vol. 20, no. 4, pp. 211--224, 2001
  372. \bibitem[13]{bhatt}
  373. Bhatt \textit{et al.},
  374. \textit{Direct Binary Search with Adaptive Search and Swap}.
  375. \url{http://www.ima.umn.edu/2004-2005/MM8.1-10.05/activities/Wu-Chai/halftone.pdf}
  376. \bibitem[14]{4chan}
  377. moot,
  378. \url{http://www.4chan.org/}
  379. \bibitem[15]{wong}
  380. P.~W. Wong and J.~P. Allebach,
  381. \textit{Optimum error-diffusion kernel design}.
  382. Proc. SPIE Vol. 3018, p. 236--242, 1997
  383. \bibitem[16]{ostromoukhov}
  384. Victor Ostromoukhov,
  385. \textit{A Simple and Efficient Error-Diffusion Algorithm}.
  386. in Proceedings of SIGGRAPH 2001, in ACM Computer Graphics, Annual Conference
  387. Series, pp. 567--572, 2001
  388. \bibitem[17]{lsmb}
  389. T.~N. Pappas and D.~L. Neuhoff,
  390. \textit{Least-squares model-based halftoning}.
  391. in Proc. SPIE, Human Vision, Visual Proc., and Digital Display III, San Jose,
  392. CA, Feb. 1992, vol. 1666, pp. 165--176
  393. \bibitem[18]{stability}
  394. R. Eschbach, Z. Fan, K.~T. Knox and G. Marcu,
  395. \textit{Threshold Modulation and Stability in Error Diffusion}.
  396. in Signal Processing Magazine, IEEE, July 2003, vol. 20, issue 4, pp. 39--50
  397. \bibitem[19]{sullivan}
  398. J. Sullivan, R. Miller and G. Pios,
  399. \textit{Image halftoning using a visual model in error diffusion}.
  400. J. Opt. Soc. Am. A, vol. 10, pp. 1714--1724, Aug. 1993
  401. \end{thebibliography}
  402. \end{document}