hello!
can you please help me with fast numpy transform.
i have qimage (argb32) converted to numpy, so it's now an array of shape (128,128,4).
and i want the fastest way to convert it to grayscale -
the formula is (pseudocode):

lerp(PIX, dot(PIX, (0.299, 0.587, 0.114)), alpha)

where PIX - is current pixel (image[[i][j][:-1]]) rgb,
alpha is for blending between gray and color.
i am new for numpy, as i see the examples maybe there is a one-stroke-solution for it, very fast..
thank you!

Best algorithm for this is normally:

Select set of test cases
While test cases do not pass
     Do next part of solution 
     Solve test cases
     Debug
While too slow
      See if you can use c-coded functions to produce same solutions for test cases.
     Profile
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.