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.
 
 
 
 

487 lines
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 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 in terms of quality is a far more complex issue, as it
  63. highly 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. 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:
  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.
  85. Model-based halftoning is the third important algorithm category. It relies
  86. on a model of the human visual system (HVS) and attempts to minimise an error
  87. value based on that model. One such algorithm is direct binary seach (DBS)
  88. \cite{allebach}, also referred to as least-squares model-based halftoning
  89. (LSMB) \cite{lsmb}.
  90. HVS models are usually low-pass filters. Nasanen \cite{nasanen}, Analoui
  91. and Allebach \cite{allebach} found that using gaussian models gave visually
  92. pleasing results, an observation confirmed by independent visual perception
  93. studies \cite{mcnamara}.
  94. DBS yields halftones of impressive quality. However, despite efforts to make
  95. it more efficient \cite{bhatt}, it suffers from its large computational
  96. requirements and error diffusion remains a widely used technique.
  97. \section{Error diffusion displacement}
  98. Most error diffusion implementations parse the image in raster scan order.
  99. Boustrophedonic (serpentine) scan has been shown to cause fewer visual
  100. artifacts \cite{halftoning}, but other, more complex processing paths such as
  101. Hilbert curves \cite{spacefilling}, \cite{peano} are seldom used as they do not
  102. improve the image quality significantly.
  103. Intuitively, as the error is always propagated to the bottom-left or
  104. bottom-right of each pixel (Fig. \ref{fig:direction}), one may expect the
  105. resulting image to be slightly translated. This expectation is confirmed
  106. when alternatively viewing an error diffused image and the corresponding DBS
  107. halftone.
  108. \begin{figure}
  109. \begin{center}
  110. \input{direction}
  111. \caption{Floyd-Steinberg error diffusion direction in raster scan (left)
  112. and serpentine scan (right).}\label{fig:direction}
  113. \end{center}
  114. \end{figure}
  115. This small translation is visually innocuous but we found that it means a lot
  116. in terms of error computation. A common way to compute the error between an
  117. image $h_{i,j}$ and the corresponding halftone $b_{i,j}$ is to compute the
  118. mean square error between modified versions of the images, in the form:
  119. \begin{equation}
  120. E(h,b) = \frac{(||v * h_{i,j} - v * b_{i,j}||_2)^2}{wh}
  121. \end{equation}
  122. where $w$ and $h$ are the image dimensions, $*$ denotes the convolution and $v$
  123. is a model for the human visual system.
  124. To compensate for the slight translation experienced in the halftone, we
  125. use the following error metric instead:
  126. \begin{equation}
  127. E_{dx,dy}(h,b) = \frac{(||v * h_{i,j} - v * t_{dx,dy} * b_{i,j}||_2)^2}{wh}
  128. \end{equation}
  129. where $t_{dx,dy}$ is an operator which translates the image along the $(dx,dy)$
  130. vector.
  131. A simple example can be given using a gaussian HVS model:
  132. \begin{equation}
  133. v(x,y) = e^{\frac{x^2+y^2}{2\sigma^2}}
  134. \end{equation}
  135. Finding the second filter is then straightforward:
  136. \begin{equation}
  137. (v * t_{dx,dy})(x,y) = e^{\frac{(x-dx)^2+(y-dy)^2}{2\sigma^2}}
  138. \end{equation}
  139. Experiment shows that for a given image and a given corresponding halftone,
  140. $E_{dx,dy}$ has a local minimum almost always away from $(dx,dy) = (0,0)$ (Fig.
  141. \ref{fig:lena-min}). Let $E$ be an error metric where this remains true. We
  142. call the local minimum $E_{min}$:
  143. \begin{equation}
  144. E_{min}(h,b) = \min_{dx,dy}E_{dx,dy}(h,b)
  145. \end{equation}
  146. \begin{figure}
  147. \begin{center}
  148. \input{lena-min}
  149. \caption{Mean square error for the \textit{Lena} image. $v$ is a simple
  150. $11\times11$ gaussian convolution kernel with $\sigma = 1.2$ and
  151. $(dx,dy)$ vary in $[-1,1]\times[-1,1]$.}
  152. \label{fig:lena-min}
  153. \end{center}
  154. \end{figure}
  155. For instance, a Floyd-Steinberg dither of \textit{Lena}, with $\sigma = 1.2$
  156. yields a per-pixel mean square error of $8.51\times10^{-4}$. However, when
  157. taking the displacement into account, the error becomes $7.77\times10^{-4}$
  158. for $(dx,dy) = (0.167709,0.299347)$. The new, corrected error is significantly
  159. smaller, with the exact same input and output images.
  160. Experiment shows that the corrected error is always noticeably smaller except
  161. in the case of images that are already mostly pure black and white. The
  162. experiment was performed on a database of 10,000 images from common computer
  163. vision sets and from the image board \textit{4chan}, providing a representative
  164. sampling of the photographs, digital art and business graphics widely exchanged
  165. on the Internet.
  166. In addition to the classical Floyd-Steinberg and Jarvis, Judice and Ninke
  167. kernels, we tested two serpentine error diffusion algorithms: Ostromoukhov's
  168. simple error diffusion \cite{ostromoukhov}, which uses a variable coefficient
  169. kernel, and Wong and Allebach's optimum error diffusion kernel \cite{wong}.
  170. \begin{center}
  171. \begin{tabular}{|l|l|l|}
  172. \hline
  173. & $E$ & $E_{min}$ \\ \hline
  174. raster Floyd-Steinberg & 0.00089705 & 0.000346514 \\ \hline
  175. raster Ja-Ju-Ni & 0.0020309 & 0.000692003 \\ \hline
  176. Ostromoukhov & 0.00189721 & 0.00186343 \\ \hline
  177. % raster optimum kernel & 0.00442951 & 0.00135092 \\ \hline
  178. optimum kernel & 0.00146338 & 0.00136522 \\
  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 energy 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|l|l|l|l|}
  231. \hline
  232. & $E$ & $dx$ & $dy$ & $E_{fast}$ \\ \hline
  233. raster Floyd-Steinberg & 0.00089705 & 0.16 & 0.28 & 0.00083502 \\ \hline
  234. raster Ja-Ju-Ni & 0.0020309 & 0.26 & 0.76 & 0.00192991 \\ \hline
  235. Ostromoukhov & 0.00189721 & 0.00 & 0.19 & 0.00186839 \\ \hline
  236. optimum kernel & 0.00146338 & 0.00 & 0.34 & 0.00138165 \\
  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 proposal.
  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 is 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 is
  252. known to cause important error in shadow and highlight areas of the image.
  253. First we studied all possible coefficients on a pool of 250 images with an
  254. error metric $E$ based on a standard gaussian HVS model. Since we are studying
  255. algorithms on different images but error values are only meaningful for a given
  256. image, we chose a Condorcet voting scheme to determine winners. $E_{min}$ is
  257. only given here as an indication and had no role in the computation:
  258. \begin{center}
  259. \begin{tabular}{|c|c|c|c|}
  260. \hline
  261. rank & coefficients & $E$ & $E_{min}$ \\ \hline
  262. 1 & 8 3 5 0 & 0.00129563 & 0.000309993 \\ \hline
  263. 2 & 7 3 6 0 & 0.00131781 & 0.000313941 \\ \hline
  264. 3 & 9 3 4 0 & 0.00131115 & 0.000310815 \\ \hline
  265. 4 & 9 2 5 0 & 0.00132785 & 0.000322754 \\ \hline
  266. 5 & 8 4 4 0 & 0.0013117 & 0.00031749 \\ \hline
  267. \dots & \dots & \dots & \dots \\
  268. \hline
  269. \end{tabular}
  270. \end{center}
  271. The exact same operation using $E_{min}$ as the decision variable yields very
  272. different results. Again, $E$ is only given here as an indication:
  273. \begin{center}
  274. \begin{tabular}{|c|c|c|c|}
  275. \hline
  276. rank & coefficients & $E_{min}$ & $E$ \\ \hline
  277. 1 & 7 3 5 1 & 0.000306251 & 0.00141414 \\ \hline
  278. 2 & 6 3 6 1 & 0.000325488 & 0.00145197 \\ \hline
  279. 3 & 8 3 4 1 & 0.000313537 & 0.00141632 \\ \hline
  280. 4 & 7 3 4 2 & 0.000336239 & 0.00156376 \\ \hline
  281. 5 & 6 4 5 1 & 0.000333702 & 0.00147671 \\ \hline
  282. \dots & \dots & \dots & \dots \\
  283. \hline
  284. \end{tabular}
  285. \end{center}
  286. Our improved metric was able to confirm that the original Floyd-Steinberg
  287. coefficients were indeed the best possible for raster scan.
  288. For serpentine scan, however, our experiment suggests that
  289. $\frac{1}{16}\{7,4,5,0\}$ is a better choice than the Floyd-Steinberg
  290. coefficients that have nonetheless been widely in use so far (Fig.
  291. \ref{fig:lena7450}).
  292. \begin{figure}
  293. \begin{center}
  294. \includegraphics[width=0.8\textwidth]{lena.eps}
  295. \caption{halftone of \textit{Lena} using serpentine error diffusion and
  296. the optimum coefficients $\frac{1}{16}\{7,4,5,0\}$ that improve
  297. on the standard Floyd-Steinberg coefficients in terms of visual
  298. quality for a given HVS model}
  299. \label{fig:lena7450}
  300. \end{center}
  301. \end{figure}
  302. \section{Conclusion}
  303. We have disclosed an interesting property of error diffusion algorithms
  304. allowing to more precisely measure the quality of such halftoning methods.
  305. Having showed that such quality is often underestimated by usual metrics,
  306. we hope to see even more development in simple error diffusion methods.
  307. Confirming Floyd and Steinberg's 30-year old "trial-and-error" result with our
  308. work is only the beginning: future work may cover more complex HVS models,
  309. for instance by taking into account the angular dependance of the human eye
  310. \cite{sullivan}. And now that we have a proper metric, we plan to improve all
  311. error diffusion methods that may require fine-tuning of their propagation
  312. coefficients.
  313. %
  314. % ---- Bibliography ----
  315. %
  316. \begin{thebibliography}{}
  317. %
  318. \bibitem[1]{bayer}
  319. B. Bayer,
  320. \textit{Color imaging array}.
  321. U.S. patent 3,971,065 (1976)
  322. \bibitem[2]{void1}
  323. R.A. Ulichney (Digital Equipment Corporation),
  324. \textit{Void and cluster apparatus and method for generating dither templates}.
  325. U.S. patent 5,535,020 (1992)
  326. \bibitem[3]{void2}
  327. H. Ancin, A. Bhattacharjya and J. Shu (Seiko Epson Corporation),
  328. \textit{Void-and-cluster dither-matrix generation for better half-tone
  329. uniformity}.
  330. U.S. patent 6,088,512 (1997)
  331. \bibitem[4]{fstein}
  332. R.W. Floyd, L. Steinberg,
  333. \textit{An adaptive algorithm for spatial grey scale}.
  334. Proceedings of the Society of Information Display 17, (1976) 75--77
  335. \bibitem[5]{parfstein}
  336. P. Metaxas,
  337. \textit{Optimal Parallel Error-Diffusion Dithering}.
  338. Color Imaging: Device-Indep. Color, Color Hardcopy, and Graphic Arts IV, Proc.
  339. SPIE 3648, 485--494 (1999)
  340. \bibitem[6]{quality}
  341. T. D. Kite,
  342. \textit{Design and Quality Assessment of Forward and Inverse Error-Diffusion
  343. Halftoning Algorithms}.
  344. PhD thesis, Dept. of ECE, The University of Texas at Austin, Austin, TX, Aug.
  345. 1998
  346. \bibitem[7]{halftoning}
  347. R. Ulichney,
  348. \textit{Digital Halftoning}
  349. MIT Press, 1987
  350. \bibitem[8]{spacefilling}
  351. L. Velho and J. Gomes,
  352. \textit{Digital halftoning with space-filling curves}
  353. Computer Graphics (Proceedings of SIGGRAPH 91), 25(4):81--90, 1991
  354. \bibitem[9]{peano}
  355. I.~H. Witten and R.~M. Neal,
  356. \textit{Using peano curves for bilevel display of continuous-tone images}
  357. IEEE Computer Graphics \& Appl., 2:47--52, 1982
  358. \bibitem[10]{nasanen}
  359. R. Nasanen,
  360. \textit{Visibility of halftone dot textures}
  361. IEEE Trans. Syst. Man. Cyb., vol. 14, no. 6, pp. 920--924, 1984
  362. \bibitem[11]{allebach}
  363. M. Analoui and J.~P. Allebach,
  364. \textit{Model-based halftoning using direct binary search}
  365. Proc. of SPIE/IS\&T Symp. on Electronic Imaging Science and Tech.,
  366. February 1992, San Jose, CA, pp. 96--108
  367. \bibitem[12]{mcnamara}
  368. Ann McNamara,
  369. \textit{Visual Perception in Realistic Image Synthesis}
  370. Computer Graphics Forum, vol. 20, no. 4, pp. 211--224, 2001
  371. \bibitem[13]{bhatt}
  372. Bhatt \textit{et al.},
  373. \textit{Direct Binary Search with Adaptive Search and Swap}
  374. \url{http://www.ima.umn.edu/2004-2005/MM8.1-10.05/activities/Wu-Chai/halftone.pdf}
  375. \bibitem[14]{4chan}
  376. moot,
  377. \url{http://www.4chan.org/}
  378. \bibitem[15]{wong}
  379. P.~W. Wong and J.~P. Allebach,
  380. \textit{Optimum error-diffusion kernel design}
  381. Proc. SPIE Vol. 3018, p. 236--242, 1997
  382. \bibitem[16]{ostromoukhov}
  383. Victor Ostromoukhov,
  384. \textit{A Simple and Efficient Error-Diffusion Algorithm}
  385. in Proceedings of SIGGRAPH 2001, in ACM Computer Graphics, Annual Conference
  386. Series, pp. 567--572, 2001
  387. \bibitem[17]{lsmb}
  388. T.~N. Pappas and D.~L. Neuhoff,
  389. \textit{Least-squares model-baed halftoning}
  390. in Proc. SPIE, Human Vision, Visual Proc., and Digital Display III, San Jose,
  391. CA, Feb. 1992, vol. 1666, pp. 165--176
  392. \bibitem[18]{stability}
  393. R. Eschbach, Z. Fan, K.~T. Knox and G. Marcu,
  394. \textit{Threshold Modulation and Stability in Error Diffusion}
  395. in Signal Processing Magazine, IEEE, July 2003, vol. 20, issue 4, pp. 39--50
  396. \bibitem[19]{kite}
  397. T.~D. Kite,
  398. \textit{Design and quality assessment of forward and inverse error diffusion
  399. halftoning algorithms}
  400. Ph.~D. in Electrical Engineering (Image Processing), August 1998
  401. \bibitem[20]{sullivan}
  402. J. Sullivan, R. Miller and G. Pios,
  403. \textit{Image halftoning using a visual model in error diffusion}
  404. J. Opt. Soc. Am. A, vol. 10, pp. 1714--1724, Aug. 1993
  405. \end{thebibliography}
  406. \end{document}