locked
ColorMatrix

    Question

  • Hi

    Am in some sort of Direct2D programming with Store Apps,

    How can I create a ColorMatrix of 5x5 size?

    Regards

    _Sujith

    Thursday, February 07, 2013 10:06 AM

Answers

All replies

  • Hi,

    Did you want to create Color matrix effect?
    There is only 5*4 in built in effect
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh706319(v=vs.85).aspx

    And D2D_MATRIX_5X4_F structure
    http://msdn.microsoft.com/en-us/library/windows/desktop/jj244058(v=vs.85).aspx

    In .NET there is 5*5 matrix for Color matrix, but an ARGB vector is represented as red, green, blue, alpha and w, where w is always 1.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Tuesday, February 12, 2013 9:49 AM
    • Marked as answer by Jesse Jiang Wednesday, February 13, 2013 11:04 AM
    Friday, February 08, 2013 7:07 AM
  • Hi Jesse,

    I wanna do a contrast adjustment in an image.

    In Direct2D there is an option for Brightness available but none for Contrast.

    We can adjust the contrast by using a color matrix, D2D1::Matrix.

    I have a color matrix of order 5x5, but the Direct2D has support only for 5x4.

    I would like to know 

    1. Why Microsoft does not provide 5x5 color matrix? Any specific reason?

    2. Is the current matrices sufficient to provide all the functionality(including contrast, then how can I do that)?

    3. Is there any other methods, that I can use for adjusting contrast?

    Thanks in advance Jesse,

    _Sujith


    Friday, February 08, 2013 8:07 AM
  • Yes, I think the color vector in 5*5 is ARGB1, the last position always 1. In 5*4 matrix, the 1 is discard.

     

    As far as I know there is no built in adjusting contrast function in D2D, we need to finish it by ourselves. Here is an algorithm for contrast

    http://stackoverflow.com/questions/8990926/faster-contrast-algorithm-for-a-bitmap

     

    Best regards,


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 11, 2013 4:40 AM
  • Thanks  Jesse,

    Solved by using a 5x4 matrix.

    Used 5x4 for RGBA row wise and used a WHITE_POINT as an effect.

    mixed these two effects and used as a composite effect resulted in Contrast adjustment. Voila!

    _Sujith

    • Marked as answer by _Sujith Wednesday, February 13, 2013 11:11 AM
    Wednesday, February 13, 2013 11:11 AM
  • Thanks  Jesse,

    Solved by using a 5x4 matrix.

    Used 5x4 for RGBA row wise and used a WHITE_POINT as an effect.

    mixed these two effects and used as a composite effect resulted in Contrast adjustment. Voila!

    _Sujith

    Hi,

    cann you tell which effects you have used with which arguments you initialized the effects?

    Thank you!


    Friday, April 12, 2013 1:01 PM