From mvilleneuve at common-lisp.net Thu Jun 14 13:11:06 2007 From: mvilleneuve at common-lisp.net (mvilleneuve) Date: Thu, 14 Jun 2007 09:11:06 -0400 (EDT) Subject: [imago-cvs] CVS imago/src Message-ID: <20070614131106.A24E250B5@common-lisp.net> Update of /project/imago/cvsroot/imago/src In directory clnet:/tmp/cvs-serv3701 Modified Files: convolve.lisp Log Message: Fix bug in CONVOLVE for grayscale images --- /project/imago/cvsroot/imago/src/convolve.lisp 2005/01/03 20:56:02 1.2 +++ /project/imago/cvsroot/imago/src/convolve.lisp 2007/06/14 13:11:05 1.3 @@ -61,7 +61,8 @@ as x2 = (+ x dx) when (<= 0 x2 (1- width)) do (let ((factor (aref matrix (+ dy 2) (+ dx 2)))) - (incf sum (* (image-pixel image x2 y2) + (incf sum (* (gray-intensity + (image-pixel image x2 y2)) factor))))) (let ((color (+ (floor sum divisor) offset))) (setf pixel2 (make-gray (limit-value color 0 255)))))) From mvilleneuve at common-lisp.net Fri Jun 15 12:16:42 2007 From: mvilleneuve at common-lisp.net (mvilleneuve) Date: Fri, 15 Jun 2007 08:16:42 -0400 (EDT) Subject: [imago-cvs] CVS imago/src Message-ID: <20070615121642.9671F4D04B@common-lisp.net> Update of /project/imago/cvsroot/imago/src In directory clnet:/tmp/cvs-serv28550 Modified Files: convert.lisp Log Message: Fix gray pixel usage in several conversion fonctions --- /project/imago/cvsroot/imago/src/convert.lisp 2006/06/03 06:59:55 1.3 +++ /project/imago/cvsroot/imago/src/convert.lisp 2007/06/15 12:16:42 1.4 @@ -1,4 +1,4 @@ -;;; IMAGO library +g;;; IMAGO library ;;; Image format conversions ;;; ;;; Copyright (C) 2004-2005 Matthieu Villeneuve (matthieu.villeneuve at free.fr) @@ -44,7 +44,7 @@ :width width :height height)) (result-pixels (image-pixels result))) (dotimes (i (* width height)) - (let ((gray (row-major-aref pixels i))) + (let ((gray (gray-intensity (row-major-aref pixels i)))) (setf (row-major-aref result-pixels i) (make-color gray gray gray)))) result)) @@ -57,8 +57,8 @@ :width width :height height)) (result-pixels (image-pixels result))) (dotimes (i (* width height)) - (let ((gray (color-intensity (row-major-aref pixels i)))) - (setf (row-major-aref result-pixels i) gray))) + (let ((intensity (color-intensity (row-major-aref pixels i)))) + (setf (row-major-aref result-pixels i) (make-gray intensity)))) result)) (defmethod convert-to-grayscale ((image indexed-image)) @@ -72,7 +72,7 @@ (dotimes (i (* width height)) (let ((color-index (row-major-aref pixels i))) (setf (row-major-aref result-pixels i) - (color-intensity (aref colormap color-index))))) + (make-gray (color-intensity (aref colormap color-index)))))) result)) (defmethod convert-to-indexed ((image rgb-image)) @@ -83,14 +83,14 @@ (let* ((width (image-width image)) (height (image-height image)) (pixels (image-pixels image)) - (result (make-instance 'grayscale-image - :width width :height height)) - (result-pixels (image-pixels result)) - (colormap (make-simple-gray-colormap))) + (colormap (make-simple-gray-colormap)) + (result (make-instance 'indexed-image + :width width :height height + :colormap colormap)) + (result-pixels (image-pixels result))) (dotimes (i (* width height)) (setf (row-major-aref result-pixels i) - (row-major-aref pixels i))) - (setf (slot-value result 'colormap) colormap) + (gray-intensity (row-major-aref pixels i)))) result)) From mvilleneuve at common-lisp.net Mon Jun 18 15:46:08 2007 From: mvilleneuve at common-lisp.net (mvilleneuve) Date: Mon, 18 Jun 2007 11:46:08 -0400 (EDT) Subject: [imago-cvs] CVS imago/src Message-ID: <20070618154608.A8C8B6F23F@common-lisp.net> Update of /project/imago/cvsroot/imago/src In directory clnet:/tmp/cvs-serv24968 Modified Files: convert.lisp Log Message: Fixed typo --- /project/imago/cvsroot/imago/src/convert.lisp 2007/06/15 12:16:42 1.4 +++ /project/imago/cvsroot/imago/src/convert.lisp 2007/06/18 15:46:08 1.5 @@ -1,4 +1,4 @@ -g;;; IMAGO library +;;; IMAGO library ;;; Image format conversions ;;; ;;; Copyright (C) 2004-2005 Matthieu Villeneuve (matthieu.villeneuve at free.fr)