c - Confusing errors with opencv cvLoadImage and netbeans -


I found that opencv library and tried to program a simple imadamdfire with it with the help of c. When I started compiling my code, some errors were found, which are a bit annoying because they do not seem to understand. This is my first time when programming with Netbeing and for the first time I tried to do something else with those basic calculator programs I am here. Below are codes and errors, which the compiler gives:

  int iscolor = -1; / * Is used to load the image because * / IplImage * image = 0; / * Load Image * / image = cvLoadImage (Const char * 'test.jpg', iscolor); / * Line 34 * / / * Modify image * / ... / * Save image * / int cvSaveImage (Const Charl * 'Modified.jpg', const CvArr * image); / * Line 43 * / / * * end * /  

compiler errors

main.c: function 'main':

Main.c: 34: Error: Expected expression before 'const'

main.c: 34: 37: Warning: Characters for its type are too long

main. C: 34: Error: Very little logic to perform the 'cvLoadImage' function:

main.c: 43: 33: Warning: characters for this type are too long continuously

main. C: 43: Error: '' X, '', 'or') before '\ X2e6a7067' These errors made me a little confused Because

  1. refers to opencv C reference cvLoadImage only takes two arguments.
  2. How is the character continuously too long?
  3. Expected expression before 'const'? Hummm ... I do not get it at all
  4. '' ',', 'or') '' First '\ x2e6a7067' ... well I do not get it either

    So can someone tell me what I am doing wrong? Any help would be good :)

In C, single quotes are single (Literal) is used to denote the character constant, and the resultant type of such constant is int therefore, 'a' is OK, 'a1 ' is not, because these are two letters that define some escape sequences, for example ' \ n ', which is a newline, or ' xff ' / Character Is considered, which is the character with hexadecimal value 0xff . Since 'test.jpg' contains more than one character, the compiler is telling you that your literal character is too long, you need a string in which double quotation is required.

You should place parentheses around the coast: (const char *) x OK, const char * x is not okay (if If you're announcing x as const char * then it's okay). I think you have added that artist because the compiler was warning you about "converting an indicator without any artist". Generally, casting unless you really do not know what you are doing, the casting of the compiler is a very bad idea.

Based on the above, line should be 34:

  image = cvLoadImage ("test.jpg", isolar);  

If you really want to enter "test.jpg" as const char * , then:

  image = cvLoadImage ((const char *) "test.jpg", iscolor);  

In addition, now you know how to fix this line:

  int cvSaveImage (const char * 'modified.jpg', const CvArr * Image);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -