Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

Colors problem after decoding jpeg lossless image by UIC applications

Leonid_Kryvelyov
Beginner
460 Views
Hello,

I'm using w_ipp_7.0.2.154_ia32 and w_ipp-samples_p_7.0.2.048. I've found that after converting jpeg lossless image by picnic and uic_transcoder_con to .bmp colors in output are different (yellow or blue ruler on the right side of image). I thinkpicnic's outputis correct. My code mostly copied/pasted from uic_transcoder produces wrong resultcorrespondingly. Could you please point me what should be fixed in in uic_transcoder_con to get correct results?

Attachments:
jplossless.jpeg - original file
jplossless_picnic.bmp - picnic's output
jplossless_con.bmp - uic_transcoder_con's output

Regards,
Leonid
0 Kudos
4 Replies
Chao_Y_Intel
Moderator
460 Views

Leonid,

could you have a check on the first attachment, jplossless.jpeg? We can not download this file here.

Thanks,
Chao
0 Kudos
Sergey_Ryadno
New Contributor I
460 Views
Hi Leonid,
when we decoding this lossless jpeg file the color type of image is seted to IC_UNKNOWN - this means that decoder can`t determine correct color of compressed data and gives image after decoding "as is" without any color transformation. Later in Picnic application we are trying to suggest wich color is used. This suggestion is based on number of image channels and looks like:
[bash]  if(IC_UNKNOWN == image.Color())
  {
    switch(image.NChannels())
    {
    case 1: image.Color(IC_GRAY); break;
    case 3: image.Color(IC_RGB);  break;
    case 4: image.Color(IC_RGBA); break;
    default:
      break;
    }
  }[/bash]
This suggestion is needed to determine output params for displaying. And seems we are make a correct guess in this case - original image color is RGB.
But in transcoder no such suggestion (but i think must be and i`m going to add it). And image saved in RGB chanel order, but need to be converted to BGR before saving. The simplest way to resolve this issue is add such suggestion in SaveImageBMP() function just after strings:
[bash]  switch(image.NChannels())
  {
    case 1: imageCn.ColorSpec().SetEnumColorSpace(Grayscale); break;
    case 3: imageCn.ColorSpec().SetEnumColorSpace(BGR);       break;
    case 4: imageCn.ColorSpec().SetEnumColorSpace(BGRA);      break;
    default:
      break;
  }

// put this suggestion here[/bash]
0 Kudos
Thomas_Jensen1
Beginner
460 Views
As far as I know, lossy JPEG is normally YCBCR, and lossless JPEG is normally RGB (not BGR).
The format of lossless JPEG does not have a standard, but most codecs use RGB.
0 Kudos
Leonid_Kryvelyov
Beginner
460 Views
Thanks to all for your help. The lossless image I experimented with,sure has IC_UNKNOWN color type, I've uploaded it in .zip. It seems method MainWindow::createFrame(CIppImage& image, CIppImage& frame) in picnic performs color conversions.

Regards,
Leonid
0 Kudos
Reply