Ask Your Question
0

How to create Gui Application using opencv in vc++

asked 2013-03-14 07:14:32 -0600

karuna gravatar image

hi frnds, i am creating one gui application, using opencv2.4.4 built in functions in VC++ 2010 Express, already i created gui form, and loading images to picture box. i am getting the problem to convert rgb to grey mode, plz help me to resolve the problem thanks karuna

edit retag flag offensive close merge delete

Comments

what problems, what code ? noone can help you without more info from your side

berak gravatar imageberak ( 2013-03-14 07:23:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-14 07:26:56 -0600

Basically what you do is add a button to your form, doubleclick the button to create a button handler, then in that function you do the following steps:

cv::Mat img = pictureBox.image() //Check the exact function to retrieve the image
cv::Mat outputImg;
cv::cvCvtColor( img, outputImg, CV_RGB2GRAY );
pixtureBox.setImage = outputImg; //Again check the correct setter for this

Then if an error returns, it is that the pictureBox cannot take a Mat element. I am not sure of that. Get back to me if it errors out and ill look for a solution. Probably you will need a type conversion.

edit flag offensive delete link more

Comments

hai i done as u said i got the errors >C:\opencv244\opencv\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>C:\opencv244\opencv\build\include\opencv2/core/types_c.h(305): error C3645: 'cvRound' : __clrcall cannot be used on functions compiled to native code

karuna gravatar imagekaruna ( 2013-03-15 05:55:23 -0600 )edit

It means you are trying to create openCV on pure clr code, which is not possible. Go in visual studio to project properties

  • general options

    • common languare runtime support

    • choose option "no clr" or "/clr" ... notthe pure version.

This can't be applied together with managed code of winforms :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 06:35:14 -0600 )edit

hai i changed the property settings and i debug the program and i am getting the bellow errors

1>------ Build started: Project: ImageModify, Configuration: Debug Win32 ------ 1> ImageModify.cpp 1>d:\karuna projects\imagemodify\Form1.h(267): error C2064: term does not evaluate to a function taking 0 arguments 1>d:\karuna projects\imagemodify\Form1.h(268): error C2143: syntax error : missing ';' before 'cv::Mat' 1>d:\karuna projects\imagemodify\Form1.h(268): error C2146: syntax error : missing ';' before identifier 'outputImg' 1>d:\karuna projects\imagemodify\Form1.h(268): error C2275: 'cv::Mat' : illegal use of this type as an expression 1>d:\karuna projects\imagemodify\Form1.h(268): error C2065: 'outputImg' : undeclared identifier 1>d:\karuna projects\imagemodify\Form1.h(269): error C20

karuna gravatar imagekaruna ( 2013-03-16 04:54:50 -0600 )edit

hai

now my project compiled and debuged, and .exe created but it is displaying error

'ImageModify.exe': Loaded 'D:\ImageModify\Debug\ImageModify.exe', Symbols loaded. 'ImageModify.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file 'ImageModify.exe': Loaded 'C:\Windows\System32\mscoree.dll', Cannot find or open the PDB file 'ImageModify.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file 'ImageModify.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file 'ImageModify.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded. 'ImageModify.exe': Loaded 'C:\Windows\System32\opencv_core244d.dll', Cannot find or open the PDB file 'ImageModify.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Sym

karuna gravatar imagekaruna ( 2013-03-16 09:57:19 -0600 )edit

These are not actually errors but warnings, which is a huge difference. Since the exe is produced, the build actually works. For the error, this basically means that you are using precompiled libraries and they come not with the accompagnied debug files. This means when crashing at runtime, you cannot go into a debug process and look which line of inner code actually produces the error. If you want to have this functionality, you have to build the openCV libraries yourself.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-17 13:29:51 -0600 )edit

Question Tools

Stats

Asked: 2013-03-14 07:14:32 -0600

Seen: 2,830 times

Last updated: Mar 14 '13