Ashwinning / libmv

Automatically exported from code.google.com/p/libmv
MIT License
0 stars 0 forks source link

bug colored image read #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I want to read a RGB image and write it in another file, the output image 
isn't the same.

The code that doesn't work on my ubuntu 10.4 :
Array3Du imageArrayBytes1;
ReadImage ("in.png", &imageArrayBytes1);
WriteImage(imageArrayBytes1,"out.png");

I expected to see the same image, but it's not.
I think there is a bug in the offset function ?
since even a :
      for (size_t y=0; y<imageArrayBytes1.Height(); ++y) {
        for (size_t x=0; x<imageArrayBytes1.Width(); ++x)
          imageArrayBytes2(y,x) = imageArrayBytes1(y,x); 

doesn't fill in the good way (the imageArrayBytes1(y,x) is wrong).
I see some pieces of 1/3 filling. maybe it's a wrong index due to the depth.

Original issue reported on code.google.com by julien.michot.fr@gmail.com on 25 Jun 2010 at 6:00

Attachments:

GoogleCodeExporter commented 9 years ago
...humm my firefox is weird.
here are the (good) files.

Original comment by julien.michot.fr@gmail.com on 26 Jun 2010 at 9:49

Attachments:

GoogleCodeExporter commented 9 years ago
I will try to look to it in the week and give my ideas on it...

Original comment by pmou...@gmail.com on 26 Jun 2010 at 10:35

GoogleCodeExporter commented 9 years ago
Fix this issue with this commit :
http://code.google.com/p/libmv/source/detail?r=899

Well spotted Julien. This issue allow me to fix also a bug in colored PNG image 
saving. I have also optimize the memory allocation. Use directly the image 
memory instead of temp memory for the PNG things ! (Code speedUp and memory 
saving).

Test code :
  Array3Du imageArrayBytes1;
  ReadImage (".in.png", &imageArrayBytes1);

  WriteImage(imageArrayBytes1,".out.png");

  Array3Du test;
  Rgb2Gray( imageArrayBytes1, &test);
  WriteImage(test,"./outGray.png");

Original comment by pmou...@gmail.com on 3 Jul 2010 at 10:00