Archive for August, 2006

Saving JP2 images

August 11, 2006

After four days of dealing with continous errors in save routine for jp2 files, I finally got something fruitful. Initially I was getting errors from glibc which was giving me trouble using malloc(). Turns out I had not freed some memory and doing that fixed that error. Then came a run-time seg fault which was annoying. It took me a while to notice that in a for loop I had for(k =0;i< comps;i++) whereas it should have been for(k=0;k<comps;k++). i was uninitialized so the program basically skipped the step and a opj_create_image routine did not get the proper values.

After finding these stupid errors came the errors from the openjpeg library. Finding this error made me understand how the library is written, so it may have been a blessing in disguise! The problem was in writing header data into a stream. After a lot of debugging, I noticed the actual problem was initializing the data buffer in the stream. This led me to realize that I was actually not setting the width and height in the openjpeg image data structure. I assumed this done during initializing because I provided this data for each individual component. After doing this the program ran smoothly and saved the image. But now the problem was that the saved image was all black. The reason was some uinitialized values in the compression parameters. After figuring out the right values the image was finally saved correctly.

There are still some improvement that are needed though. First I need an interactive way of changing paramters for compression. Secondly, I need to test it with some standard images provided on the openjpeg discussion forum. That should complete this plugin. I would need to work a little harder to complete all this within two days as I have until August 21 to do this work.

I also need to make changes in the inverse halftoning plugin to put a graphical interface so that halftoned images of various frequencies can be reversed. The denoising plugin I believe is complete and works well.

After all this I need to make sure I have proper copyrights in the files and also write a final report.  Hopefully things will be done in time.

Advertisements