Hi, iam implementig a program to load an image to picture box using open
FileDialog1
control and mark some points on that image. I was able to load the image to the pictureBox.I have declared a class called CvCreatePoints to mark points uisng CvPoint() function. But i dont know how to pass that pictureBox image to
CvCreatePoints
class.
Below is my code
In Form1.h Inside Button click event
openFileDialog1->Filter = "Jpeg |*.Jpg";
openFileDialog1->FilterIndex = 1;
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK )
{
pictureBox1->Image = Image::FromFile(openFileDialog1->FileName);
}
Then i have mouse_down event and there i tried to get the points when user clicks and pass them to the CvCreatePoints class. There i have a method called DrawPoints
CvCreatePoints cp;
Point xy;
xy = Control::MousePosition::get();
int xVal = xy.X;
int yVal = xy.Y;
cp.DrawPoints(pictureBox1->Image,xVal,yVal);
In my CvCreatePoints.h i have DrawPoints method
CvCreatePoints(void);
void DrawPoints(IplImage *img, int x,int y);
in CvCreatePoints.cpp class
void CvCreatePoints::DrawPoints(IplImage *image, int x,int y)
{
}
When compiled,
cannot convert parameter 1 from 'System::Drawing::Image ^' to 'IplImage *'
error is given. So how do i cast
System::Drawing::Image to 'IplImage
Also
1>E:\Softwarez\OPENCV_DIR\Opencv243\build\include\opencv2/core/types_c.h(305): error C3862: 'cvRound': cannot compile an unmanaged function with /clr:pure or /clr:safe
1> Inline native assembly not supported in managed code
1>E:\Softwarez\OPENCV_DIR\Opencv243\build\include\opencv2/core/types_c.h(305): error C3645: 'cvRound' : __clrcall cannot be used on functions compiled to native code
1> MatlabToOpenCv.cpp
1>E:\Softwarez\OPENCV_DIR\Opencv243\build\include\opencv2/core/types_c.h(305): error C3862: 'cvRound': cannot compile an unmanaged function with /clr:pure or /clr:safe
1> Inline native assembly not supported in managed code
1>E:\Softwarez\OPENCV_DIR\Opencv243\build\include\opencv2/core/types_c.h(305): error C3645: 'cvRound' : __clrcall cannot be used on functions compiled to native code
I don't understand this error :(
Thank you