Results 1 to 20 of 21

Thread: Problems working with 8bpp and 24bpp images

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Cesar Guest

    Default Re: Problems working with 8bpp and 24bpp images

    Oops, it seems I've forgotten to take alpha channel in account. I suppose you can do it youself.

  2. #2
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems working with 8bpp and 24bpp images

    Another time thanks a lot Cesar, your suggestions are very helpfully It's a great idea to calculate a similar color in the table using the distance between two points, I didn't remember that function . I will try it and I comment the results.

    PD: did you forget to calculate the distance using squares in the function 'obtenirIndexColor'?
    Qt Code:
    1. diff = dR * dR + dG * dG + dB * dB;
    To copy to clipboard, switch view to plain text mode 
    The results of calculating the distance multiplying each term with itself are the same that calculating it as I did with the absolute value, no?
    Last edited by SkripT; 15th February 2006 at 15:36.

  3. #3
    Cesar Guest

    Default Re: Problems working with 8bpp and 24bpp images

    Quote Originally Posted by SkripT
    Another time thanks a lot Cesar, your suggestions are very helpfully It's a great idea to calculate a similar color in the table using the distance between two points, I didn't remember that function . I will try it and I comment the results.
    You are always welcome
    Quote Originally Posted by SkripT
    The results of calculating the distance multiplying each term with itself are the same that calculating it as I did with the absolute value, no?
    No I didn't. Consider the example:
    The point to approximate: P(100, 100, 100).
    Two points to choose betwean: A1(75, 125, 100) and A2(100, 51, 100)
    Qt Code:
    1. diffSkript(P, A1) = |100 - 75| + |100 - 125| + |100 - 100| = 25 + 25 = 50
    2. diffSkript(P, A2) = |100 - 100| + |100 - 51| + |100 - 100| = 49
    3. diffCesar(P, A1) = (100 - 75)*(100 - 75) + (100 - 125)*(100 - 125) + (100 - 100)*(100 - 100) = 625 + 625 = 1250
    4. diffCesar(P, A2) = (100 - 100)*(100 - 100) + (100 - 51)*(100 - 51) + (100 - 100)*(100 - 100) = 49*49 = 2401
    To copy to clipboard, switch view to plain text mode 
    As you can see, the results differ. Which one is the best? You choose

  4. #4
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems working with 8bpp and 24bpp images

    You' re right Cesar, the results differ!! I will try some colors and see which one is more aproximated.

  5. #5
    Cesar Guest

    Talking Re: Problems working with 8bpp and 24bpp images

    Go ahead! And please, post the results, 'cos I'm too curious

  6. #6
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems working with 8bpp and 24bpp images

    Hi, Cesar I have tested a little both versions. In many colors they give me the same results. But, in other cases, your version give me results that looks similar to the original color. Here are two examples:

    Color to aproximate: r:85, g:0, b:255
    Cesar: r:31, g:82, b:138
    SkripT: r:79, g:110, b:140

    Color to aproximate: r:255, g:85, b:255
    Cesar: r:245, g:207, b:178
    SkripT: r:255, g:255, b:255

    In other cases where they gave me different results, was difficult to say which of one was closer to the original color because is a very subjective fact. Finally I maintain your version because looks more professional calculating the difference with the distance between points

    Cheers.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.