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))))
Hello,
Selon Thibault Langlois tl@di.fc.ul.pt:
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
On 6/14/07, matthieu.villeneuve@free.fr matthieu.villeneuve@free.fr wrote:
Hello,
Selon Thibault Langlois tl@di.fc.ul.pt:
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
Quoting Thibault Langlois tl@di.fc.ul.pt:
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
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
Selon Thibault Langlois tl@di.fc.ul.pt:
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