Post

Replies

Boosts

Views

Activity

Reply to Problem with vImagePiecewiseGamma_Planar8
In case it helps: Stepping my app and the swift sample under the debugger I noticed something: for an 800x600 RGB image the function vImageBuffer_InitWithCGImage returns a vImage_Buffer with rowBytes=2400 in my obj-c app, instead of the expected 2432 that I get with the swift version. Inquiring about the imageAlignment I get the correct value of 64 in both apps.
Apr ’24
Reply to 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.
May ’24