- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following code written to have IPP resize my matrix:
#include "ipp_mx.h" #include "ipp.h" #include "stdafx.h" #define IPPCALL(name) name int main() { IppiSize srcSize = { 3,3 }; float srcImage[9] = { 20, 40, 30, 35, 55, 70, 100, 30, 20 }; float* src = new float[srcSize.width*srcSize.height]; for (int i = 0; i < srcSize.width*srcSize.height; i++) { src = srcImage; } double xFactor = 10; double yFactor = 10; int numChannels = 1; int bytesPerPixel = 4; int srcStep = srcSize.width*bytesPerPixel*numChannels; IppiRect srcRoi = { 0, 0, srcSize.width, srcSize.width }; float* dest = new float[srcSize.width*srcSize.height*xFactor*yFactor]; IppiSize destSize = { srcSize.width*xFactor, srcSize.height*yFactor }; int destStep = destSize.width*bytesPerPixel*numChannels; IppiRect destRoi = { 0, 0, destSize.width, destSize.width }; double xShift = 0; double yShift = 0; int interpolation = 1; //nearest neighbour int bufSize; IPPCALL(ippiResizeGetBufSize)(srcRoi, destRoi, 1, interpolation, &bufSize); unsigned char* buffer = new unsigned char[bufSize]; IPPCALL(ippiResizeSqrPixel_32f_C1R)(src, srcSize, srcStep, srcRoi, dest, destStep, destRoi, xFactor, yFactor, xShift, yShift, interpolation, buffer); return 0; }
Is there an IPP function I can use that now converts this float matrix dest to an RGB24 format, given a colour map?
I know I can do it by hand in a for loop, but the raw matrices I want to work with are much larger and for loops may not cut it.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you suggest how do you want to perform the conversion? Intel IPP provides one mapping function here:
https://software.intel.com/en-us/node/504062
Can this function be used there?
If the code just want to convert some data types, it can use the ippiConvert functions:
https://software.intel.com/en-us/node/503746
regards,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
How I wanted to perform the conversion was, given a float value and an array that maps value ranges to RGB colours, convert the float value to an RGB colour.
What I ended up doing was:
- ippiConvert_32f8u_C1R - convert the float image to char by truncating as in my case I don't need the decimal precision as the colour steps are integer.
- ippiGrayToRGB_8u_C1C3R - convert the float to RGB.
- ippiLUTPallete_8uC3R - given a palette, transform the gray values into colour.
Say a pixel value is 20.5.
- ippiConvert_328u_C1R converts it to 20.
- ippiGrayToRGB_8u_C1C3R converts the pixel to 3 channels of 20 red, 20 green, 20 blue.
- Construct a palette that maps 20 red, 20 green, 20 blue to, say, 0 red, 0 green, 255 blue.
- Pass the RGB converted pixel and the pallet to ippiLUTPallete_8uC3R which makes the proper transformation to 0, 0, 255.
Thank you

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page