Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Aris_Basic
New Contributor I
43 Views

16s to 16u conversion

Jump to solution
is there a simple way to convert a 16s image to 16u , without going creating temporary 32s
image and adding 32768 to each pixel ?
0 Kudos

Accepted Solutions
Ivan_Z_Intel
Employee
43 Views
Hi!
Forrange shift (16s => 16u) you can use function ippiXorC_16u_C1IR:
ippiXorC_16u_C1IR(0x8000, (Ipp16u *)pSrcDst, srcDstStep, roiSize).
Data are converted:
-32768 -> 0,
-32767 -> 1,
...
-1 -> 32767,
0 -> 32768,
1 -> 32769,
...
32767 -> 65536.
For processing of images with 3, 4 channels use similar functions with suffixesC3, C4.
I hope you are finding it.

View solution in original post

3 Replies
Vladimir_Dudnik
Employee
43 Views
Hello,

IPP v7.0 contain appropriate convertion functions in image processing domain

IPPAPI ( IppStatus, ippiConvert_16s16u_C1Rs,
(const Ipp16s* pSrc, int srcStep, Ipp16u* pDst, int dstStep,
IppiSize roi))

Although, it is implemented asdst = (src>0)?(Ipp16u)src:0; that might be not what you are looking for

Regards,
Vladimir
Aris_Basic
New Contributor I
43 Views
yeah witht aht conversion i would lose all the pixels with negative value , definetly not what i want :)
Ivan_Z_Intel
Employee
44 Views
Hi!
Forrange shift (16s => 16u) you can use function ippiXorC_16u_C1IR:
ippiXorC_16u_C1IR(0x8000, (Ipp16u *)pSrcDst, srcDstStep, roiSize).
Data are converted:
-32768 -> 0,
-32767 -> 1,
...
-1 -> 32767,
0 -> 32768,
1 -> 32769,
...
32767 -> 65536.
For processing of images with 3, 4 channels use similar functions with suffixesC3, C4.
I hope you are finding it.

View solution in original post