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

ippiHistogramRange in VB code

zimanyi
Beginner
730 Views
Hi

Did anybody use ippiHistogramRange_8u_C3R() functions in VB code with VB ipp wrapper?
I have a VB wrapper on IPP but I have a problem with correct creating of pointer to set of pointers in VB in histogramRange function

I have hisdtogram values only in first channel, not in next 2 channels ... no error code as return value...

My code looks like:
>>>>
Dim destSize As IppiSize = New IppiSize(bmp.Width, bmp.Height)

Dim levels((3 * 256)-1) As Int32
Dim plevels As IntPtr =
Marshal.UnsafeAddrOfPinnedArrayElement(levels, 0)

Dim hist((3 * 256)-1) As Int32
Dim phist As IntPtr =
Marshal.UnsafeAddrOfPinnedArrayElement(hist, 0)

Dim nLevels(2) As Int32
Dim pnLevels As IntPtr =
Marshal.UnsafeAddrOfPinnedArrayElement(nLevels, 0)

'Creating levels values ...
For j = 0 To 2
Dim diff As Integer = 256
nLevels(j) = 256
For i = 0 To 256 - 1
levels(j * (256) + i) = i
Next i
Next j

'Call histogram ipp method
Ippi.ippiHistogramRange_8u_C3R
(pSrc, srcdata.Stride, destSize, phist, plevels, pnLevels)

>>>after this I have in hist array only values from 0-255 ..
I tried it with (2, 255) array too but same result ..


>>>> I tried this pointers too but without any correct result (inspered by thread "IPP with C# : RGB Image histogram : HELP!" )
Dim L(2) As IntPtr
L(0) = Marshal.UnsafeAddrOfPinnedArrayElement(levels, 0)
L(1) = Marshal.UnsafeAddrOfPinnedArrayElement(levels, 256)
L(2) = Marshal.UnsafeAddrOfPinnedArrayElement(levels, 256 * 2)
Dim pL As IntPtr = Marshal.UnsafeAddrOfPinnedArrayElement(L, 0)

Dim Hi(2) As IntPtr
Hi(0) = Marshal.UnsafeAddrOfPinnedArrayElement(hist, 0)
Hi(1) = Marshal.UnsafeAddrOfPinnedArrayElement(hist, 256)
Hi(2) = Marshal.UnsafeAddrOfPinnedArrayElement(hist, 256 * 2)
Dim pHi As IntPtr = Marshal.UnsafeAddrOfPinnedArrayElement(Hi, 0)

Ippi.ippiHistogramRange_8u_C3R
(pSrc, srcdata.Stride, destSize, pHi, pL, pnLevels)
>>>>

If any body have an idea if it is problem VB or my falut, it will be great.
Thanks.

Now it looks like taht I'M starting to rewrite it to c#

Marek

Message Edited by zimanyi on 03-26-200605:49 AM

0 Kudos
2 Replies
Vladimir_Dudnik
Employee
730 Views

Hi Marek,

thanks for informing us about that issue, we will fix it in the next release, IPP v5.1, which is coming soon.

For your reference, I've attached corrected version of file in this post.

Regards,
Vladimir

0 Kudos
zimanyi
Beginner
730 Views
Excelent, Thanks Vladimir for replay.
Best regards
Marek
0 Kudos
Reply