Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

16s to 16u conversion

Aris_Basic
New Contributor I
344 Views
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
1 Solution
Ivan_Z_Intel
Employee
344 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

0 Kudos
3 Replies
Vladimir_Dudnik
Employee
344 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
0 Kudos
Aris_Basic
New Contributor I
344 Views
yeah witht aht conversion i would lose all the pixels with negative value , definetly not what i want :)
0 Kudos
Ivan_Z_Intel
Employee
345 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.
0 Kudos
Reply