F
fpgabuilder
Guest
Hi,
In trying to create an image processing modeling environment, I
decided to leverage the DPI-C and OpenCV. One of the key aspects of
OpenCV is to be able to pass around a pointer (IplImage*) to a data-
structure that holds and describes an image. I am wondering if there
is a way for me to directly call the routines that create and
reference this structure over DPI-C. And if so how? So far I have been
unsuccessful with Modelsim.
In the code snippet below, cvLoadImage() creates the data-structure
and returns a pointer to it (IplImage*). In SV, I use chandle to
receive that pointer and pass it around to other routines. But I see
in Modelsim that the value of chandle is never updated. What do I have
wrong? My experience with DPI is pretty low.
import "DPI-C" function int cvNamedWindow (string name, int flags);
import "DPI-C" function chandle cvLoadImage (string name, int
iscolor);
import "DPI-C" function void cvShowImage (string name, chandle image);
chandle ldImg;
int ret;
initial
begin
ret = cvNamedWindow ("Test Win", 1);
ldImg = cvLoadImage("img_0.tif", 6); //4 = ANY_COLOR, 2 =
ANY_DEPTH
$display("Error loading Image %p", ldImg);
cvShowImage ("Test Win", ldImg);
end
The function prototype of cvLoadImage() in C is -
CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor
CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
I appreciate any insights.
In trying to create an image processing modeling environment, I
decided to leverage the DPI-C and OpenCV. One of the key aspects of
OpenCV is to be able to pass around a pointer (IplImage*) to a data-
structure that holds and describes an image. I am wondering if there
is a way for me to directly call the routines that create and
reference this structure over DPI-C. And if so how? So far I have been
unsuccessful with Modelsim.
In the code snippet below, cvLoadImage() creates the data-structure
and returns a pointer to it (IplImage*). In SV, I use chandle to
receive that pointer and pass it around to other routines. But I see
in Modelsim that the value of chandle is never updated. What do I have
wrong? My experience with DPI is pretty low.
import "DPI-C" function int cvNamedWindow (string name, int flags);
import "DPI-C" function chandle cvLoadImage (string name, int
iscolor);
import "DPI-C" function void cvShowImage (string name, chandle image);
chandle ldImg;
int ret;
initial
begin
ret = cvNamedWindow ("Test Win", 1);
ldImg = cvLoadImage("img_0.tif", 6); //4 = ANY_COLOR, 2 =
ANY_DEPTH
$display("Error loading Image %p", ldImg);
cvShowImage ("Test Win", ldImg);
end
The function prototype of cvLoadImage() in C is -
CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor
CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
I appreciate any insights.