imread

John W. Eaton jwe at bevo.che.wisc.edu
Mon Jul 14 15:14:40 CDT 2008


On 12-Jul-2008, Thomas L. Scofield wrote:

| I hope this is what is needed.  I'm sending two changesets (or  
| whatever is produced by "export tip"), lamely giving them the  
| extension .changeset.  (I'm not sure what the usual extension is.  I  
| think I sometimes see .ksh files in the archives.)

I don't care what you call the file, but it is slightly easier for me
if you send text/plain attachments instead of binary attachments.

I applied your patches and then made some additional changes.

I moved imread.m to scripts/image and also added it to the list of
files in scripts/image/Makefile.in.

Please take a look at the changeset below to see the additional
changes I made, including:

  check for graphics magick config script in Octave's configure script

  use graphics magick configure script to set 

  note in octave_config_info

  add __magick_read__.cc to list of files in src/Makefile.in

  add rules in src/Makefile.in so proper flags are used to compile and
  link __magick_read__.cc

  eliminate "using namespace ..." directives

  include config.h, not octave/oct.h

  other style fixes

| There is more to  
| do, I know.  I'm starting to learn the Magick++ API for the purpose  
| of removing all system calls (assuming that is possible), so that  
| imread() works without having either ImageMagick or GraphicsMagick  
| installed on one's local machine.  That is why I see no point in  
| changing the current system calls to "identify" and  
| "convert" (ImageMagick routines) to "gm identify", etc.

I don't understand why any of that is present in imread.  Shouldn't it
just be a simple wrapper around __magick_read__?  And if that is all
it is, then I think we could just rename __magick_read__ to be imread,
and eliminate imread.m.

If you update your sources and run

  ./autogen.sh
  configure ...
  make ...

then __magick_read__ should be built now.  When I use it, it fails to
read jpg files correctly.  When I do

  x = __magick_read__ ("foo.jpg");
  imshow (x);

(for any jpg file) the displayed image appears washed out (too
bright).  If I change 

  unsigned int
  scale_quantum_to_depth (const Magick::Quantum& quantum, unsigned int depth)
  {
    return (static_cast<unsigned int> (static_cast<double> (quantum)
				       / MaxRGB * ((1 << depth) - 1)));
  }

to

  unsigned int
  scale_quantum_to_depth (const Magick::Quantum& quantum, unsigned int depth)
  {
    return (static_cast<unsigned int> (static_cast<double> (quantum)
				       / 1024 * ((1 << depth) - 1)));
  }

my test image looks OK, but I don't think this is a proper fix.  What
is the purpose of this function?

Thanks,

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080714/5f56053b/attachment.ksh 


More information about the Octave-maintainers mailing list