Results 1 to 4 of 4

Thread: Ho to interpret this?

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Ho to interpret this?

    Hi,

    I'm tryin to use a OpenCV example that uses this code line:
    Qt Code:
    1. const CvScalar colors[] = \cvdefCpp{0,0,255}},{{0,255,0}},
    2. {{0,255,255}},{{255,255,0}
    3. ;
    To copy to clipboard, switch view to plain text mode 
    What I don't understand is the "cvdefCpp" text. What is and what it does?

    Another problem is that the compiler shows this error: "C2017: Escape sequence not valid". Erasing the "\" character I get a "syntax error: '}'"

    Thanks,
    Last edited by ^NyAw^; 4th February 2010 at 11:15.
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Ho to interpret this?

    First of all, I don't understand what it means.
    That is what documentation is for:
    http://opencv.willowgarage.com/docum...tructures.html
    There you can see what CvScalar is.

    I don't know how "{" characters are interpreted.
    Google for "initializing structs C".

    the code you posted should not compile beacuse of the '\' escape.
    Since the documentation of CvScalar says its a struct that holds doubles, the code is again, at best strange.

    This will probably will compile, but I didn't test it (probably it would be beter to change the ints to doubles by adding a decimal point '.0':
    Qt Code:
    1. const CvScalar colors[] = {{0.0,0.0,255.0,0.0},{0.0,255.0,0.0,0.0},
    2. {0.0,255.0,255.0,0.0},{255.0,255.0,0.0,0.0}} ;
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Ho to interpret this?

    Hi,

    The problem is that I don't understand the "cvdefCpp" text befor "=". Maybe it's a simple error because removing it the program compiles and works.

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Ho to interpret this?

    It's a typo. It seems to be a LaTex command as it can be seen often in this file.

  5. The following user says thank you to spud for this useful post:

    ^NyAw^ (4th February 2010)

Similar Threads

  1. making the printer correctly interpret pcl files
    By momesana in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2008, 16:41
  2. Replies: 3
    Last Post: 26th July 2006, 13:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.