From tl at di.fc.ul.pt Thu Jun 14 12:33:02 2007 From: tl at di.fc.ul.pt (Thibault Langlois) Date: Thu, 14 Jun 2007 13:33:02 +0100 Subject: [imago-devel] convolve.lisp Message-ID: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> Hello, I think there is a small bug in the grayscale version of the convolve method. Here is the diff: $ diff convolve.lisp convolve-orig.lisp 64c64 < (incf sum (* (gray-intensity (image-pixel image x2 y2)) --- > (incf sum (* (image-pixel image x2 y2) another detail: SBCL complaints about a declaration in color.lisp: $ diff color.lisp color-orig.lisp 91,95c91 < (let ((colormap < #-sbcl(make-array 256 :element-type '(unsigned-byte 8)) < ;; make-color does not return an (unsigned-byte 8) sbcl does < ;; not like that. < #+sbcl(make-array 256))) --- > (let ((colormap (make-array 256 :element-type '(unsigned-byte 8)))) -- Thibault Langlois FCUL / DI From matthieu.villeneuve at free.fr Thu Jun 14 13:08:21 2007 From: matthieu.villeneuve at free.fr (matthieu.villeneuve at free.fr) Date: Thu, 14 Jun 2007 15:08:21 +0200 Subject: [imago-devel] convolve.lisp In-Reply-To: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> References: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> Message-ID: <1181826501.46713dc5e3380@imp.free.fr> Hello, Selon Thibault Langlois : > Hello, > > I think there is a small bug in the grayscale version of the convolve > method. Here is the diff: > > $ diff convolve.lisp convolve-orig.lisp > 64c64 > < (incf sum (* (gray-intensity > (image-pixel image x2 y2)) > --- > > (incf sum (* (image-pixel image x2 y2) That is correct, the faulty code probably remains from a version that didn't have alpha information in gray pixels. I'll fix that as soon as I can. > another detail: SBCL complaints about a declaration in color.lisp: > > $ diff color.lisp color-orig.lisp > 91,95c91 > < (let ((colormap > < #-sbcl(make-array 256 :element-type '(unsigned-byte 8)) > < ;; make-color does not return an (unsigned-byte 8) sbcl does > < ;; not like that. > < #+sbcl(make-array 256))) > --- > > (let ((colormap (make-array 256 :element-type '(unsigned-byte 8)))) Do you have any idea where exactly SBCL complains? It does not on my machine, but I may not use the library the same way you do... Thanks for your time, Cheers, -- Matthieu Villeneuve From tl at di.fc.ul.pt Thu Jun 14 20:23:36 2007 From: tl at di.fc.ul.pt (Thibault Langlois) Date: Thu, 14 Jun 2007 21:23:36 +0100 Subject: [imago-devel] convolve.lisp In-Reply-To: <1181826501.46713dc5e3380@imp.free.fr> References: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> <1181826501.46713dc5e3380@imp.free.fr> Message-ID: <45df8e510706141323m4b2c3edeqdf7f018639730d9e@mail.gmail.com> On 6/14/07, matthieu.villeneuve at free.fr wrote: > Hello, > > Selon Thibault Langlois : > > Hello, > > > > I think there is a small bug in the grayscale version of the convolve > > method. Here is the diff: > > > > $ diff convolve.lisp convolve-orig.lisp > > 64c64 > > < (incf sum (* (gray-intensity > > (image-pixel image x2 y2)) > > --- > > > (incf sum (* (image-pixel image x2 y2) > > That is correct, the faulty code probably remains from a version that > didn't have alpha information in gray pixels. I'll fix that as soon as > I can. > > > another detail: SBCL complaints about a declaration in color.lisp: > > > > $ diff color.lisp color-orig.lisp > > 91,95c91 > > < (let ((colormap > > < #-sbcl(make-array 256 :element-type '(unsigned-byte 8)) > > < ;; make-color does not return an (unsigned-byte 8) sbcl does > > < ;; not like that. > > < #+sbcl(make-array 256))) > > --- > > > (let ((colormap (make-array 256 :element-type '(unsigned-byte 8)))) > > Do you have any idea where exactly SBCL complains? It does not on my > machine, but I may not use the library the same way you do... > I get a warning: ; caught WARNING: ; Asserted type (UNSIGNED-BYTE 8) conflicts with derived type ; (VALUES (INTEGER 4278190080 4294967295) &OPTIONAL). ; See also: ; The SBCL Manual, Node "Handling of Types" This happens if I compile the MAKE-SIMPLE-GRAY-COLORMAP function. I noticed another missing gray-intensity in convert.lisp: wok:~/comp/lang/lisp/code/imago$ diff convert.lisp convert-orig.lisp 45c45 < (let ((gray (row-major-aref pixels i))) --- > (let ((gray (gray-intensity (row-major-aref pixels i)))) > Thanks for your time, You are welcome, IMAGO is usefull so thank you ! > > > -- > Matthieu Villeneuve > > -- Thibault Langlois FCUL / DI From matthieu.villeneuve at free.fr Fri Jun 15 13:19:55 2007 From: matthieu.villeneuve at free.fr (matthieu.villeneuve at free.fr) Date: Fri, 15 Jun 2007 15:19:55 +0200 Subject: [imago-devel] convolve.lisp In-Reply-To: <45df8e510706141323m4b2c3edeqdf7f018639730d9e@mail.gmail.com> References: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> <1181826501.46713dc5e3380@imp.free.fr> <45df8e510706141323m4b2c3edeqdf7f018639730d9e@mail.gmail.com> Message-ID: <1181913595.467291fbe76ea@imp.free.fr> Quoting Thibault Langlois : > > > another detail: SBCL complaints about a declaration in color.lisp: > > > > > > $ diff color.lisp color-orig.lisp > > > 91,95c91 > > > < (let ((colormap > > > < #-sbcl(make-array 256 :element-type '(unsigned-byte 8)) > > > < ;; make-color does not return an (unsigned-byte 8) sbcl does > > > < ;; not like that. > > > < #+sbcl(make-array 256))) > > > --- > > > > (let ((colormap (make-array 256 :element-type '(unsigned-byte 8)))) > > > > Do you have any idea where exactly SBCL complains? It does not on my > > machine, but I may not use the library the same way you do... > > > I get a warning: > > ; caught WARNING: > ; Asserted type (UNSIGNED-BYTE 8) conflicts with derived type > ; (VALUES (INTEGER 4278190080 4294967295) &OPTIONAL). > ; See also: > ; The SBCL Manual, Node "Handling of Types" > > This happens if I compile the MAKE-SIMPLE-GRAY-COLORMAP function. Are you sure this version of the source code is up to date? I have (let ((colormap (make-array 256 :element-type 'rgb-pixel))) instead... > I noticed another missing gray-intensity in convert.lisp: True, some other functions still considered gray pixels as 8-bit integers. This should be fixed now. Cheers, -- Matthieu Villeneuve From tl at di.fc.ul.pt Mon Jun 18 15:40:21 2007 From: tl at di.fc.ul.pt (Thibault Langlois) Date: Mon, 18 Jun 2007 16:40:21 +0100 Subject: [imago-devel] convolve.lisp In-Reply-To: <1181913595.467291fbe76ea@imp.free.fr> References: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> <1181826501.46713dc5e3380@imp.free.fr> <45df8e510706141323m4b2c3edeqdf7f018639730d9e@mail.gmail.com> <1181913595.467291fbe76ea@imp.free.fr> Message-ID: <45df8e510706180840g26a6f9c1r23054966801d94fa@mail.gmail.com> > Are you sure this version of the source code is up to date? I have > > (let ((colormap (make-array 256 :element-type 'rgb-pixel))) > > instead... > You are right I fetched the latest cvs and there is no problem. I noticed two minor issues. - there is a 'g' char at the begining of convert.lisp - regarding the convert methods, what should happen to the alpha channel ? Before loading the latest version I had modified some methods like this one: (defmethod convert-to-grayscale ((image rgb-image)) (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))) (dotimes (i (* width height)) (setf (row-major-aref result-pixels i) (make-gray (color-intensity (row-major-aref pixels i)) (color-alpha (row-major-aref pixels i))))) result)) what do you think ? should we have both kinds of convertion methods ? Thibault From matthieu.villeneuve at free.fr Mon Jun 18 15:55:47 2007 From: matthieu.villeneuve at free.fr (matthieu.villeneuve at free.fr) Date: Mon, 18 Jun 2007 17:55:47 +0200 Subject: [imago-devel] convolve.lisp In-Reply-To: <45df8e510706180840g26a6f9c1r23054966801d94fa@mail.gmail.com> References: <45df8e510706140533x575eabc8vbbbd4b1facbafeef@mail.gmail.com> <1181826501.46713dc5e3380@imp.free.fr> <45df8e510706141323m4b2c3edeqdf7f018639730d9e@mail.gmail.com> <1181913595.467291fbe76ea@imp.free.fr> <45df8e510706180840g26a6f9c1r23054966801d94fa@mail.gmail.com> Message-ID: <1182182147.4676ab0367a41@imp.free.fr> Selon Thibault Langlois : > > Are you sure this version of the source code is up to date? I have > > > > (let ((colormap (make-array 256 :element-type 'rgb-pixel))) > > > > instead... > > > > You are right I fetched the latest cvs and there is no problem. > > I noticed two minor issues. > - there is a 'g' char at the begining of convert.lisp Oops! Thanks, this is fixed now. > - regarding the convert methods, what should happen to the alpha > channel ? Before loading the latest version I had modified some > methods like this one: > > [...] > > what do you think ? should we have both kinds of convertion methods ? I think those methods should preserve alpha channel information (which means that they currently don't behave correctly), and that we could add new methods to manipulate alpha separately, if actual users need this. I'm not sure I'll have time to fix the convert methods in the next few days, but patches are welcome in the meantime... ;-) Cheers, -- Matthieu Villeneuve