Chapter 6-image transformation-convolution boundary (cvcopymakeborder)

Source: Internet
Author: User

The cvcopymakeborder () function can copy an image and create a boundary to slightly increase the image size. Then, the image boundary is automatically filled in various ways. When bordertype = ipl_border_replicate, rows and columns of the original image edge are copied to the edge of the large image. When bordertype = ipl_border_constant, there is a black border with pixel width.

Bytes --------------------------------------------------------------------------------------------------


Copy the image and create the border.

void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) );
Enter the image.
Output image.
Input the coordinates of the upper left corner of the rectangle (or the lower left corner if the lower left corner is the origin) of the output image to be copied ). The rectangle size must match the ROI of the original image size.
The border type of the original image rectangle that has been copied:
Ipl_border_constant-the filling boundary is a fixed value, which is specified by the last parameter of the function. Ipl_border_replicate-use the downlink or left and right columns to copy and fill the boundary. (Ipl_border_reflect and ipl_border_wrap are currently not supported ).
If the boundary type is ipl_border_constant, This is the boundary pixel value.

The cvcopymakeborder function copies the input two-dimensional array to the output array and creates a boundary of the specified type around the copy area. A function can be used to simulate different types of boundaries embedded in a specified algorithm implementation. For example, like most other filtering functions in opencv, some morphological functions use the copy boundary type, but users may need to have zero boundary or fill in the boundary of 1 or 255.

Bytes --------------------------------------------------------------------------------------------------

/* Code */


Bytes --------------------------------------------------------------------------------------------------

/* Result */

Source image

Filtering for one pixel boder

Flitering for no boder

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: 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.