Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
Problem with vImagePiecewiseGamma_Planar8
Thanks Quinn, it finally works.
Copying the logic from the swiftinterface for macOS I replaced
viErr = vImagePiecewiseGamma_Planar8( &sourceVImageBuffer, &destinationVImageBuffer, expoCoeffs, gamma, linearCoeffs, boundary, kvImageNoFlags );
if (viErr == kvImageNoError)
{
CGImageRef newImgRef = vImageCreateCGImageFromBuffer( &destinationVImageBuffer, &invIFormat, nil, nil, kvImageNoFlags, &viErr );
with
vImage_Buffer bufSrc;
vImage_Buffer bufDest;
bufSrc.data = sourceVImageBuffer.data;
bufSrc.width = sourceVImageBuffer.width * img_bPP / img_bPC;
bufSrc.height = sourceVImageBuffer.height;
bufSrc.rowBytes = sourceVImageBuffer.rowBytes;
bufDest.data = destinationVImageBuffer.data;
bufDest.width = destinationVImageBuffer.width * img_bPP / img_bPC;
bufDest.height = destinationVImageBuffer.height;
bufDest.rowBytes = destinationVImageBuffer.rowBytes;
viErr = vImagePiecewiseGamma_Planar8( &bufSrc, &bufDest, expoCoeffs, gamma, linearCoeffs, boundary, kvImageNoFlags );
if (viErr == kvImageNoError)
{
CGImageRef newImgRef = vImageCreateCGImageFromBuffer( &destinationVImageBuffer, &invIFormat, nil, nil, kvImageNoFlags, &viErr );
and it works for both monochrome and RGB images.
Interesting trick to know.
Many thanks again.