Giter VIP home page Giter VIP logo

Comments (6)

aous72 avatar aous72 commented on June 19, 2024

Why do you want to decompress to raw?

JPEG2000 usually converts RGB to YUV, and stores the Y, U, and V components. Most implementations, including OpenJPH, do that,

The difficulty I face is when we save to raw or yuv, do we save RGB or the internal YUV? Note that U and V can be signed components -- I need to check about signedness.
This can be supported with command line options, but I do not currently give these options.

For your case, I would recommend saving to ppm. It is a very simple format.
There is a short header followed by interleaved image data. so you have
RGB for first pixel, RGB for second pixel and so on.
Data can be 8-bit or big-endian 16-bit.

Hope this helps.

from openjph.

madhub avatar madhub commented on June 19, 2024

Why do you want to decompress to raw?

JPEG2000 usually converts RGB to YUV, and stores the Y, U, and V components. Most implementations, including OpenJPH, do that,

The difficulty I face is when we save to raw or yuv, do we save RGB or the internal YUV? Note that U and V can be signed components -- I need to check about signedness. This can be supported with command line options, but I do not currently give these options.

For your case, I would recommend saving to ppm. It is a very simple format. There is a short header followed by interleaved image data. so you have RGB for first pixel, RGB for second pixel and so on. Data can be 8-bit or big-endian 16-bit.

Hope this helps.

Ok, couple of questions.

  1. While decompressing into to PPM format , Is their any way to know whether pixel data is in RGB or YUV format or PPM only stores in RGB.

  2. Is their anyway to know , how pixel is organized, interleaved or planner while decompression into PPM format?

from openjph.

aous72 avatar aous72 commented on June 19, 2024

It is always RGB.
It is always interleaved, as in
R first pixel, G first pixel, B first pixel, R second pixel, G second pixel, B second pixel.
See https://netpbm.sourceforge.net/doc/ppm.html
The code of class ojph::ppm_in in ojph_img_io.h, ojph_img_io.cpp can read pgm/ppm, where pgm is a single color file.
I noticed there is the variable plannar in ppm_in, but it is never used and should be removed.

Forgot to say nobody uses ASCII format, AFAIK, because it is not efficient. So don't worry about it.

from openjph.

madhub avatar madhub commented on June 19, 2024

It is always RGB. It is always interleaved, as in R first pixel, G first pixel, B first pixel, R second pixel, G second pixel, B second pixel. See https://netpbm.sourceforge.net/doc/ppm.html The code of class ojph::ppm_in in ojph_img_io.h, ojph_img_io.cpp can read pgm/ppm, where pgm is a single color file. I noticed there is the variable plannar in ppm_in, but it is never used and should be removed.

Forgot to say nobody uses ASCII format, AFAIK, because it is not efficient. So don't worry about it.

ok, I wrote simple bufferwriter to receive decompressed pixel data in memory buffer based on the raw_out implementation for grayscale , class BufferWriter : public ojph::image_out_base
For color I am planning implement based on the ppm_out .

Here is the use case where I need to pixel data to be updated in the DICOM file
image

from openjph.

aous72 avatar aous72 commented on June 19, 2024

Excellent!
I think this should work.
For your output, you need to buffer the 3 color components in memory before writing them out, or perhaps sending them out to next stage.
It should be simpler than ppm_out because you have no headers, and you do not need to interleave the color components.

from openjph.

aous72 avatar aous72 commented on June 19, 2024

I am closing this due to no activity.

from openjph.

Related Issues (20)

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.