Open CV Coding TYWu Ipl Image http docs














![cv. Canny • Finds edges in an image using the [Canny 86] algorithm • cv. Canny • Finds edges in an image using the [Canny 86] algorithm •](https://slidetodoc.com/presentation_image_h2/7f16840a59fff680ba6910d7ccf13690/image-15.jpg)


- Slides: 17
Open. CV Coding TYWu
Ipl. Image • http: //docs. opencv. org/modules/core/doc/old_ba sic_structures. html#iplimage • struct Ipl. Image (IPL image) – This structure was originally defined as part of Intel's Image Processing Library (IPL). – int n. Size • sizeof(Ipl. Image) – int ID • Version, always equals 0 – int n. Channels • Number of channels. Most Open. CV functions support 1 -4 channels.
Ipl. Image • struct Ipl. Image – int depth • Channel depth in bits + the optional sign bit ( IPL_DEPTH_SIGN ). The supported depths are: » IPL_DEPTH_8 U - unsigned 8 -bit integer. Equivalent to CV_8 U in matrix types. » IPL_DEPTH_8 S - signed 8 -bit integer. Equivalent to CV_8 S in matrix types. » IPL_DEPTH_16 U - unsigned 16 -bit integer. Equivalent to CV_16 U in matrix types. » IPL_DEPTH_16 S - signed 8 -bit integer. Equivalent to CV_16 S in matrix types. » IPL_DEPTH_32 S - signed 32 -bit integer. Equivalent to CV_32 S in matrix types. » IPL_DEPTH_32 F - single-precision floating-point number. Equivalent to CV_32 F in matrix types. » IPL_DEPTH_64 F - double-precision floating-point number. Equivalent to CV_64 F in matrix types.
Ipl. Image • struct Ipl. Image – int width • Image width in pixels – int height • Image height in pixels – int n. Channels • Number of channels. Most Open. CV functions support 1 -4 channels.
Ipl. Image • Example : Ipl. Image *Image 3; Image 3 = cv. Load. Image(“A. jpg", 0); int height=Image 3 ->height; int width=Image 3 ->width; :
cv. Load. Image • Loads an image from a file • Ipl. Image* cv. Load. Image( const char* filename, int iscolor=CV_LOAD_IMAGE_COLOR )
cv. Load. Image – CV_LOAD_IMAGE_COLOR - If set, always convert image to the color one – >0 Return a 3 -channel color image. • Note: In the current implementation the alpha channel, if any, is stripped from the output image. Use negative value if you need the alpha channel. – =0 Return a grayscale image. – <0 Return the loaded image as is (with alpha channel).
cv. Named. Window • Creates a window. • int cv. Named. Window(const char* name, int flags=CV_WINDOW_AUTOSIZE ) – name – Name of the window in the window caption that may be used as a window identifier. – flags – Flags of the window. The supported flags are: » CV_WINDOW_NORMAL If this is set, the user can resize the window (no constraint). » CV_WINDOW_AUTOSIZE If this is set, the window size is automatically adjusted to fit the displayed image, and you cannot change the window size manually. » CV_WINDOW_OPENGL If this is set, the window will be created with Open. GL support.
cv. Show. Image • Display an image in the specified window • void cv. Show. Image(const char* name, const Cv. Arr* image) – Parameters: – name – Name of the window. – image – Image to be shown.
cv. Create. Image • cv. Create. Image – Ipl. Image* cv. Create. Image(Cv. Size size, int depth, int channels) • Parameters: » size – Image width and height » depth – Bit depth of image elements. See Ipl. Image for valid depths. » channels – Number of channels per pixel. See Ipl. Image for details. This function only creates images with interleaved channels.
cv. Create. Image • int depth – Channel depth in bits + the optional sign bit ( IPL_DEPTH_SIGN ). The supported depths are: – IPL_DEPTH_8 U - unsigned 8 -bit integer. Equivalent to CV_8 U in matrix types. – IPL_DEPTH_8 S - signed 8 -bit integer. Equivalent to CV_8 S in matrix types. – IPL_DEPTH_16 U - unsigned 16 -bit integer. Equivalent to CV_16 U in matrix types. – IPL_DEPTH_16 S - signed 8 -bit integer. Equivalent to CV_16 S in matrix types. – IPL_DEPTH_32 S - signed 32 -bit integer. Equivalent to CV_32 S in matrix types. – IPL_DEPTH_32 F - single-precision floating-point number. Equivalent to CV_32 F in matrix types. – IPL_DEPTH_64 F - double-precision floating-point number. Equivalent to CV_64 F in matrix types.
cv. Create. Image • Int Channels – Number of channels. Most Open. CV functions support 1 -4 channels.
cv. Get. Size • Return size of matrix or image • Cv. Size cv. Get. Size(const Cv. Arr* arr)
cv. Cvt. Color • Convert an image from one color space to another. • void cv. Cvt. Color(const Cv. Arr* src, Cv. Arr* dst, int code) • src – input image: 8 -bit unsigned, 16 -bit unsigned ( CV_16 UC. . . ), or single-precision floating-point. • dst – output image of the same size and depth as src. • code – color space conversion code (see the description below). • dst. Cn – number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.
cv. Canny • Finds edges in an image using the [Canny 86] algorithm • void cv. Canny(const Cv. Arr* image, Cv. Arr* edges, double threshold 1, double threshold 2, int aperture_size=3 )
cv. Canny • Parameters: – image – single-channel 8 -bit input image. – edges – output edge map; it has the same size and type as image. – threshold 1 – first threshold for the hysteresis procedure. – threshold 2 – second threshold for the hysteresis procedure. – aperture. Size – aperture size for the Sobel() operator.
cv. Canny • The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. – The smallest value between threshold 1 and threshold 2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http: //en. wikipedia. org/wiki/Canny_edge_d etector