- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using version 5.1 of IPP with C# andI am having some difficultycalling the FloodFill function...
Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I've gotten this exception before with other ipp functions, usually I didn't set up borders incorrectly, or the roi was the wrong size. But FloodFill is pretty straight forward in that regard, the IppiConnectedComp structure being the difference. BTW, the roi I'm using is the size of the image. Anyway here goes my questions...
1) What is the structure for the IppiConnectedComp structure in version 5.1. The ippmain.pdf manual has this...
typedef struct {
Ipp32s area;
Ipp32f value;
IppiRect rect;
} IppiConnectedComp;
The ippcv.h file has this...
typedef struct _IppiConnectedComp {
Ipp64f area;
Ipp64f value[3];
IppiRect rect;
} IppiConnectedComp;
Which one is correct?
2) If the ippcv.h header file has the correct format, does this managed structure look correct?
[StructLayout(LayoutKind.Sequential,Pack=4)]
public struct IppiConnectedComp
{
public int area;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
public float[] value;
public IppiRect rect;
public IppiConnectedComp(int area, float[] value, IppiRect rect)
{
this.area = area;
this.value = value;
this.rect = rect;
}
}
3)Does this interop code for ippiFloodFill_4Con_8u_C1IR look correct?
[SuppressUnmanagedCodeSecurityAttribute()]
[DllImport(ipp.cv.libname)]
public static extern
IppStatus ippiFloodFill_4Con_8u_C1IR(byte* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, byte newVal, ref IppiConnectedComp pRegion, byte* pBuffer);
An aside..
Does an ippcv.cs file exist? (I couldn't find it ver 5.2 samples either.)It seems strange that it's not included with the others.
Thanks in advance for any help, and let me if you need any other info!
Troy
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've got it working! Here's the interop code in case anyone needs it...
[
StructLayout(LayoutKind.Sequential,Pack=4)]public struct IppiConnectedComp{
public double area;[
MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]public double[] value;public IppiRect rectangle;public IppiConnectedComp(double area, double[] value, IppiRect rectangle)
{
this.area = area;this.value = value;this.rectangle = new IppiRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);}
}
[
SuppressUnmanagedCodeSecurityAttribute()][
DllImport(ipp.cv.libname)]public static externIppStatus ippiFloodFillGetSize(IppiSize roiSize, int* pBufSize);[
SuppressUnmanagedCodeSecurityAttribute()][
DllImport(ipp.cv.libname)]public static externIppStatus ippiFloodFill_4Con_8u_C1IR(byte* pImage, int imageStep, Ipp iSize roiSize, IppiPoint seed, byte newVal, ref IppiConnectedComp pRegion, byte* pBuffer);[
SuppressUnmanagedCodeSecurityAttribute()][
DllImport(ipp.cv.libname)]public static externIppStatus ippiFloodFill_8Con_8u_C1IR(byte* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, byte newVal, ref IppiConnectedComp pRegion, byte* pBuffer);Thanks,
Troy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for sharing your solution here.
Vladimir
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page