Coder Social home page Coder Social logo

mnhrdt / iio Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 10.0 9.88 MB

a simple C interface for reading and writing small images in any format

License: Other

CMake 7.18% Python 7.28% C 76.02% Lua 4.88% C++ 4.15% Makefile 0.27% MATLAB 0.21% Shell 0.02%
c image-io images single-file

iio's Issues

piio should convert array to order C

I had a weird bug with some images badly written.
I discovered what I had saved was in Fortran order,
and piio doesn't care and write as if it was C order.

Thus piio.write should convert the input arrays to C order if necessary.
I used data = np.array(data, order='C')
but it involves a copy, which is not necessary when already in C order.
I think it should work with np.asarray(data, order='C') which should convert only if needed.

If iio requires the data is continuous, numpy.ascontiguousarray converts if needed to C continuous order.

Compiling without dependencies

I only need the pgm/ppm io function that's native.

I edited iio.h file so it has no dependencies, at the end:

//#define I_CAN_HAS_LIBPNG
//#define I_CAN_HAS_LIBJPEG
//#define I_CAN_HAS_LIBTIFF
//#define I_CAN_HAS_LIBEXR

I had "Wimplicit-function-declaration" warning when compiling and undefined reference error when linking with this two functions: iio_save_image_as_tiff_smarter and iio_save_image_as_png.

I made a workaround defining and empty function with and #else statement:

#else
static void iio_save_image_as_png(const char *filename, struct iio_image *x) 
{
    //error
}
#endif//I_CAN_HAS_LIBPNG

And the same with the tiff one

#else
static void iio_save_image_as_tiff_smarter(const char *filename,
        struct iio_image *x)
{
    //error
}
#endif//I_CAN_HAS_LIBTIFF

Now it works but I dont think this is clean fix. For instance if I compile with Werror the empty definition gives:

error: unused parameter ‘filename’ [-Werror=unused-parameter]
error: unused parameter ‘x’ [-Werror=unused-parameter]

I'm aware the save_image_default function has a "not well designed warning" but maybe a smarter solution is posible.

PS.: with the Werror flag I also get compiling error on 3 functions: unpack_to_bytes_here, iio_fmemopen and swap_two_bytes.

defined but not used [-Werror=unused-function]

iio reads 4 bands on a 3-band png file

I have a color PNG file that seems normal, but when opened with the iio_read_image_uint8_vec function, it is read as a 4-band file, which it is not.

Here is the code snippet used showing that iio reads 4 bands:

int ww, hh, pd;
iio_read_image_uint8_vec("img.png", &ww, &hh, &pd);
printf("%d\n", pd);
/* prints "4" */

and here is the image:

ref

Is something wrong with iio or with the way it is being used, or is the PNG file weird?

octave module crashes

a = iio_read('mytiff.tiff')
octave-gui: iio.c :3705 : read_image_f: l'assertion « nbuf > 0 » a échoué.

the tiff was writen with piio.

make test also fails in the octave dir.

python binding fails to compile

Here is the error

piio/libraw_interface.cpp:42:17: error: « IIO_MAX_DIMENSION » n'a pas été déclaré dans cette portée
int sizes[IIO_MAX_DIMENSION];
^~~~~~~~~~~~~~~~~
piio/libraw_interface.cpp:42:17: note: alternatives suggérées: « IP_MAX_MEMBERSHIPS »
int sizes[IIO_MAX_DIMENSION];
^~~~~~~~~~~~~~~~~
IP_MAX_MEMBERSHIPS
piio/libraw_interface.cpp: Dans la fonction « int try_reading_file_with_libraw(const char*, iio_image*) »:
piio/libraw_interface.cpp:120:7: error: « struct iio_image » n'a pas de membre nommé « sizes »
x->sizes[0] = S.raw_width;
^~~~~
piio/libraw_interface.cpp:121:7: error: « struct iio_image » n'a pas de membre nommé « sizes »
x->sizes[1] = S.raw_height;
^~~~~
piio/libraw_interface.cpp: Dans la fonction « int try_reading_file_with_libraw_4channels(const char*, iio_image*) »:
piio/libraw_interface.cpp:196:7: error: « struct iio_image » n'a pas de membre nommé « sizes »
x->sizes[0] = S.iwidth/2;
^~~~~
piio/libraw_interface.cpp:197:7: error: « struct iio_image » n'a pas de membre nommé « sizes »
x->sizes[1] = S.iheight/2;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.