One macro definition-one of opencv source code reading)

Source: Internet
Author: User

cvapi (iplimage *) cvloadimage (const char * filename, int iscolor cv_default (cv_load_image_color);

you can see this line, we found that int iscolor cv_default (cv_load_image_color)

does not know much about it, so I read the definition of cv_default: // highgui. h.

# ifndef cv_extern_c
# ifdef _ cplusplus
# define cv_extern_c extern "C"
# define cv_default (VAL) = Val
# else
# define cv_extern_c
# define cv_default (VAL)
# endif

here we do two things. The first thing is to define

extern "C ": this definition method only exists in C ++, so there is a # ifdef _ cplusplus. In C, there is no extern "C" definition method, therefore, cv_extern_c is defined as null.

A function in C ++ can be a default parameter. For example,

cvapi (iplimage *) cvloadimage (const char * filename, int iscolor = cv_load_image_color );

but this definition method is not available in C, so it can only be written in C

cvapi (iplimage *) cvloadimage (const char * filename, int iscolor);

the definition of cv_default should be clear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.