- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
const Ipp32s *p_lutval = lutval;
int grnvals [256];
int bluvals [256];
int *p_reds = redvals;
int *p_grns = grnvals;
int *p_blus = bluvals;
lutval[1]= *p_grns;
lutval[2]= *p_blus;
int i;
for ( i = 0; i <= 255; i++ )
{
redvals=i;
grnvals=i;
bluvals=i;
}
numblevel[0] = 256;
numblevel[1] = 256 ;
numblevel[2] = 256 ;
rslt = ippiLUT_8u_C3R( p_mem, p_stepbyte,
(Ipp8u*) thisimg->DataPtr(), thisimg->Step(), imgsz ,
&p_lutval, &p_lutval, numblevel);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
int redvals [256];
int grnvals [256];
int bluvals [256];
int i;
for ( i = 0; i <= 255; i++ )
{
redvals = i;
grnvals = i;
bluvals = i;
}
const Ipp32s
* lutval[3];lutval[0] = redvals;
lutval[1] = grnvals;
lutval[2] =
int numblevel[3];
numblevel[0] = 256;
numblevel[1] = 256;
rslt = ippiLUT_8u_C3R(p_mem, p_stepbyte, (Ipp8u*) thisimg->DataPtr(), thisimg->Step(), imgsz ,
lutval, lutval, numblevel); Regards,- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm wondering if the LUT function prototype (& usage) have changed since you posted this solution. From the 5.1 IPPI reference manual:
This function performs intensity transformation of the source image pSrc using the lookup table (LUT) specified by the arrays pLevels and pValues. Every source pixel pSrc(x,y) from the range [pLevels
Length of the pLevels and pValues arrays is defined by the nLevels parameter. Number of level and intensity values is less than nLevels by one. Pixels in the pSrc image that are not in the range [pLevels[0], pLevels[nLevels-1]) are copied to the pDst image without any transformation.
Note that the pLevel ranges are inclusive [ at the bottom end and exclusive ) at the top end; of particular note is the statement that Pixels in the pSrc image that are not in the range [pLevels[0], Levels[nLevels-1]) are copied to the pDst image without any transformation. In the case of the code fragment, pLevels[nLevels-1] = 255, and thus the transformation will only take place for pixels in the range of [0, 255), which excludes the value of 255 from being transformed (in this case, it isnt a problem since the transformation is the identity function, but it would be a problem in some non-linear problems, such as classification which just happens to be my problem ;)
Also, I dont understand why the documentation states that both the number of levels and values should be nLevels-1. According to this statement in the manual: Every source pixel pSrc(x,y) from the range [pLevels
Thanks for any clarification that you can provide,
-todd
Todd Kelman, Engineering Consultant
Volcano Corporation
2870 Kilgore Rd.
Rancho Cordova, CA 95670
tkelman@volcanocorp.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Todd,
there is answer from our expert:
The manual states - "number of levels and values should be nLevels-1". But actually pLevels are boundaries so number of elements of pLevel must be nLevel.
May be short example will explain more clearly.
Ipp32s val
ues[4], boundaries[5];const Ipp32s* pVal[3], pLev[3];
int numblevel[3];
val
ues[0] = 11; values[1] = 44; values[2] = 88; values[3] = 222; boundaries[0] = 0; boundaries[1] = 30; boundaries[2] = 60; boundaries[3] = 120; boundaries[4] = 256; pVal[0] = pVal[1< FONT face="Arial CYR" color=#0000ff size=2>] = pVal[2] = values;pLev[0] = pLev[1] = pLev[2] = boundaries;
numblevel[0] = numblevel[1] = numblevel[2] = 5;
rslt = ippiLUT_8u_C3R( p_mem, p_stepbyte, (Ipp8u*) thisimg->DataPtr(), thisimg->Step(), imgsz ,
pVal, pLev, numblevel);In this example
if src value lies in [0; 30) than correspondend dst will have value 11;
if src value lies in [30; 60) than correspondend dst will have value 44;
if src value lies in [60; 120) than correspondend dst will have value 88;
if src value lies in [120; 256) than correspondend dst will have value 222;
We have 4 levels, 4 values but 5 boundaries
11 44 88 222
|------|------|------|------|
03060120256
Regards,
Vladimir
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page