CN111353952B - Method for eliminating black boundary after image distortion correction - Google Patents

Method for eliminating black boundary after image distortion correction Download PDF

Info

Publication number
CN111353952B
CN111353952B CN202010069833.9A CN202010069833A CN111353952B CN 111353952 B CN111353952 B CN 111353952B CN 202010069833 A CN202010069833 A CN 202010069833A CN 111353952 B CN111353952 B CN 111353952B
Authority
CN
China
Prior art keywords
image
target object
black
geometric distortion
acquisition system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010069833.9A
Other languages
Chinese (zh)
Other versions
CN111353952A (en
Inventor
严光源
张云志
卢清华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Foshan University
Original Assignee
Foshan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Foshan University filed Critical Foshan University
Priority to CN202010069833.9A priority Critical patent/CN111353952B/en
Publication of CN111353952A publication Critical patent/CN111353952A/en
Application granted granted Critical
Publication of CN111353952B publication Critical patent/CN111353952B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • G06T5/80
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker

Abstract

The invention provides a method for eliminating black boundary after image distortion correction, which comprises the steps of calibrating an acquisition system to obtain calibration parameters; acquiring a background image without a target object or an image of the target object through an acquisition system, and correcting geometric distortion of the background image without the target object or the image of the target object by using calibration parameters; preprocessing the background image without the target object or the image of the target object after geometric distortion correction to generate an image template; acquiring an image of a target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters; the image of the target object after geometric distortion correction is preprocessed and edge detection is sequentially carried out, so that an edge binary image is obtained; and finally, carrying out matrix multiplication on the image template and the edge binary image to obtain the target object profile image with black boundaries eliminated. The invention eliminates the black boundary in the image without losing the image target object, thereby bringing convenience to the subsequent image processing.

Description

Method for eliminating black boundary after image distortion correction
Technical Field
The invention relates to the technical field of image recognition, in particular to a method for eliminating black boundaries after image distortion correction.
Background
In machine vision, a camera lens is often used to capture an object, thereby acquiring an image for subsequent image processing. Since the image acquired through the camera lens contains severe geometric distortion, the necessary geometric distortion correction must be performed to eliminate the distortion introduced by the camera lens, and finally an undistorted image is obtained. However, the image corrected by distortion produces black borders around the image because the geometric distortion of the image is corrected back to its original position.
Since the corrected image has black borders, it is not attractive and causes unnecessary trouble for subsequent image processing. It is common practice to cut out an image according to the size ratio of the original image, but in the case that the image is full of the target object and the geometric distortion is large, the target object to be processed is cut out by directly cutting out the image. If the image with the black border is directly used for processing, many false detections are generated, for example, the contour extraction is directly performed on the image, the computer can identify the black border as a contour, and a false contour extraction result is obtained.
Disclosure of Invention
The invention aims to overcome the defects and shortcomings in the prior art and provide a method for eliminating black boundaries after image distortion correction.
In order to achieve the above purpose, the invention is realized by the following technical scheme: a method for eliminating black boundaries after image distortion correction, characterized by:
firstly, an image acquisition system is built, and the acquisition system is calibrated to obtain calibration parameters;
secondly, acquiring a background image without a target object or an image of the target object through an acquisition system, and correcting geometric distortion of the background image without the target object or the image of the target object by using calibration parameters; preprocessing the background image without the target object or the image of the target object after geometric distortion correction to generate an image template;
then, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary; the image of the target object after geometric distortion correction is preprocessed and edge detection is sequentially carried out, so that an edge binary image is obtained;
and finally, carrying out matrix multiplication on the image template and the edge binary image to obtain the target object profile image with black boundaries eliminated.
In the above scheme, the purpose of the method is to accurately eliminate the black boundaries after distortion correction, so that the acquired non-target background image is utilized to acquire the point sets forming the black boundaries, then the idea of filtering operation is utilized, and the mask is utilized to multiply the points to remove the black boundaries. When the geometric distortion of the image is large (namely, the black boundary is wide and continuous), the template can be generated without collecting background images without targets, and the image of the target object can be directly used for manufacturing the template.
Wherein the first scheme comprises the following steps:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring a background image without a target object through an acquisition system, and correcting geometric distortion of the background image without the target object by using calibration parameters, wherein the background image without the target object after geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary; then importing the gray level image in a gray level image form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level image, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 80; then, performing image morphology-corrosion operation treatment, and finally converting pixel points to generate an image template;
thirdly, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary; sequentially carrying out filtering, graying and threshold segmentation pretreatment on the image of the target object after geometric distortion correction, and carrying out edge detection on the image by using a Canny operator to obtain an edge binary image;
and fourthly, performing matrix multiplication on the image template generated in the second step and the edge binary image to obtain a target object profile image with black boundaries eliminated.
The second scheme (for the case where the black border is wider after distortion correction) includes the following steps:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring an image of a target object through an acquisition system, correcting geometric distortion of the image of the target object by using calibration parameters, importing the image into a gray level diagram form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level diagram, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 2; then, performing image morphology-corrosion operation treatment, and finally converting pixel points to generate an image template;
thirdly, correcting geometric distortion of the target object image obtained in the second step by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is wider and continuous; sequentially carrying out filtering, graying and threshold segmentation pretreatment on a second image of the target object after geometric distortion correction, and carrying out edge detection on the image by using a Canny operator to obtain an edge binary image;
and fourthly, performing matrix multiplication on the image template generated in the second step and the edge binary image to obtain a target object profile image with black boundaries eliminated.
The gray value of the black boundary in the image template is 0, and the gray value of the non-black boundary is 1.
Compared with the prior art, the invention has the following advantages and beneficial effects: the method for eliminating the black boundary after the image distortion correction eliminates the black boundary in the image under the condition of not losing an image target object, thereby bringing convenience to subsequent image processing.
Drawings
FIG. 1 is a flow chart of a method for eliminating black borders after image distortion correction in the first embodiment;
fig. 2 (a) is a background image without an object in the first embodiment;
FIG. 2 (b) is a schematic diagram of an image template in accordance with the first embodiment;
FIG. 3 (a) is a schematic image of a target object in the first embodiment;
FIG. 3 (b) is a schematic diagram of the first embodiment after the geometric distortion of the image of the object is corrected;
FIG. 3 (c) is a schematic illustration of the pre-treatment of FIG. 3 (b);
FIG. 3 (d) is a schematic diagram of the edge detection of FIG. 3 (c);
fig. 3 (e) is an effect diagram after black border elimination.
Detailed Description
The invention is described in further detail below with reference to the drawings and the detailed description.
Example 1
As shown in fig. 1, the method for eliminating black boundaries after image distortion correction according to the present invention is as follows:
firstly, an image acquisition system is built, and the acquisition system is calibrated to obtain calibration parameters;
secondly, acquiring a background image without a target object through an acquisition system, and correcting geometric distortion of the background image without the target object by using calibration parameters; preprocessing the background image without the target object after geometric distortion correction to generate an image template;
then, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary; the image of the target object after geometric distortion correction is preprocessed and edge detection is sequentially carried out, so that an edge binary image is obtained;
and finally, carrying out matrix multiplication on the image template and the edge binary image to obtain the target object profile image with black boundaries eliminated.
The specific steps are as follows:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring a background image without an object through an acquisition system, and correcting geometric distortion of the background image without the object by using calibration parameters, wherein the background image without the object after geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary, as shown in fig. 2 (a); then importing the gray level image in a gray level image form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level image, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 80; then, through image morphology-corrosion operation processing, finally converting pixel points to generate an image template, wherein the gray value of a black boundary in the image template is 0, and the gray value of a non-black boundary in the image template is 1 as shown in fig. 2 (b);
thirdly, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary; sequentially performing filtering, graying and threshold segmentation preprocessing (shown in fig. 3 (c)) on the image (shown in fig. 3 (b)) of the target object after geometric distortion correction, and performing edge detection on the image by using a Canny operator to obtain an edge binary image (shown in fig. 3 (d);
fourth, the image template generated in the second step is multiplied by the edge binary image to obtain a target contour map with black boundaries eliminated, as shown in fig. 3 (e).
The method aims to accurately eliminate black boundaries after distortion correction, so that the acquired non-target background image is utilized to acquire a point set forming the black boundaries, then the idea of filtering operation is utilized, and a mask is utilized to multiply the points to remove the black boundaries, thereby bringing convenience to subsequent image processing.
Example two
When the geometric distortion of the image is large (namely, the black boundary is wide and continuous), the template can be generated without collecting background images without targets, and the image of the target object can be directly used for manufacturing the template.
The method comprises the following specific steps:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring an image of a target object through an acquisition system, correcting geometric distortion of the image of the target object by using calibration parameters, importing the image into a gray level diagram form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level diagram, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 2; then, performing image morphology-corrosion operation treatment, and finally converting pixel points to generate an image template; the gray value of the black boundary in the image template is 0, and the gray value of the non-black boundary is 1;
thirdly, correcting geometric distortion of the image of the target object obtained in the second step by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is wider and continuous; sequentially carrying out filtering, graying and threshold segmentation pretreatment on the image of the target object after geometric distortion correction, and carrying out edge detection on the image by using a Canny operator to obtain an edge binary image;
and fourthly, performing matrix multiplication on the image template generated in the second step and the edge binary image to obtain a target object profile image with black boundaries eliminated.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.

Claims (2)

1. A method for eliminating black boundaries after image distortion correction, characterized by:
firstly, an image acquisition system is built, and the acquisition system is calibrated to obtain calibration parameters;
secondly, acquiring a background image without a target object or an image of the target object through an acquisition system, and correcting geometric distortion of the background image without the target object or the image of the target object by using calibration parameters; preprocessing the background image without the target object or the image of the target object after geometric distortion correction to generate an image template;
then, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary; the image of the target object after geometric distortion correction is preprocessed and edge detection is sequentially carried out, so that an edge binary image is obtained;
finally, carrying out matrix multiplication on the image template and the edge binary image to obtain a target object profile image with black boundaries eliminated;
the method comprises the following steps:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring a background image without a target object through an acquisition system, and correcting geometric distortion of the background image without the target object by using calibration parameters, wherein the background image without the target object after geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary; then importing the gray level image in a gray level image form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level image, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 80; then, performing image morphology-corrosion operation treatment, and finally converting pixel points to generate an image template;
thirdly, acquiring an image of the target object through an acquisition system, and correcting geometric distortion of the image of the target object by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is a black region formed by a curve and an image boundary; sequentially carrying out filtering, graying and threshold segmentation pretreatment on the image of the target object after geometric distortion correction, and carrying out edge detection on the image by using a Canny operator to obtain an edge binary image;
fourthly, multiplying the image template generated in the second step by the edge binary image in a matrix manner to obtain a target object profile image with black boundaries eliminated;
alternatively, the method comprises the following steps:
firstly, an image acquisition system is built, a chessboard calibration plate is placed in a background area, 14 calibration plate photos with different angles are obtained, a Zhang Zhengyou calibration method is adopted to calibrate a camera of the acquisition system, and a calibration result is obtained to obtain calibration parameters;
secondly, acquiring an image of a target object through an acquisition system, correcting geometric distortion of the image of the target object by using calibration parameters, importing the image into a gray level diagram form, and sequentially carrying out preprocessing of filtering and threshold segmentation on the gray level diagram, wherein the threshold segmentation is an image binarization threshold segmentation method, and the threshold is set to be 2; then, performing image morphology-corrosion operation treatment, and finally converting pixel points to generate an image template;
thirdly, correcting geometric distortion of the image of the target object obtained in the second step by using calibration parameters, wherein the image of the target object subjected to geometric distortion correction is provided with a black boundary, and the black boundary is wider and continuous; sequentially carrying out filtering, graying and threshold segmentation pretreatment on the image of the target object after geometric distortion correction, and carrying out edge detection on the image by using a Canny operator to obtain an edge binary image;
and fourthly, performing matrix multiplication on the image template generated in the second step and the edge binary image to obtain a target object profile image with black boundaries eliminated.
2. The method for eliminating black boundaries after image distortion correction according to claim 1, wherein: the gray value of the black boundary in the image template is 0, and the gray value of the non-black boundary is 1.
CN202010069833.9A 2020-01-21 2020-01-21 Method for eliminating black boundary after image distortion correction Active CN111353952B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010069833.9A CN111353952B (en) 2020-01-21 2020-01-21 Method for eliminating black boundary after image distortion correction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010069833.9A CN111353952B (en) 2020-01-21 2020-01-21 Method for eliminating black boundary after image distortion correction

Publications (2)

Publication Number Publication Date
CN111353952A CN111353952A (en) 2020-06-30
CN111353952B true CN111353952B (en) 2023-05-05

Family

ID=71196954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010069833.9A Active CN111353952B (en) 2020-01-21 2020-01-21 Method for eliminating black boundary after image distortion correction

Country Status (1)

Country Link
CN (1) CN111353952B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177439A (en) * 2012-11-26 2013-06-26 惠州华阳通用电子有限公司 Automatically calibration method based on black and white grid corner matching
CN105787894A (en) * 2016-02-25 2016-07-20 上海海事大学 Barrel distortion container number correction method
CN107154050A (en) * 2017-05-03 2017-09-12 魏玉震 A kind of automatic obtaining method of the stone material geometric parameter based on machine vision
CN110400278A (en) * 2019-07-30 2019-11-01 广东工业大学 A kind of full-automatic bearing calibration, device and the equipment of color of image and geometric distortion

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177439A (en) * 2012-11-26 2013-06-26 惠州华阳通用电子有限公司 Automatically calibration method based on black and white grid corner matching
CN105787894A (en) * 2016-02-25 2016-07-20 上海海事大学 Barrel distortion container number correction method
CN107154050A (en) * 2017-05-03 2017-09-12 魏玉震 A kind of automatic obtaining method of the stone material geometric parameter based on machine vision
CN110400278A (en) * 2019-07-30 2019-11-01 广东工业大学 A kind of full-automatic bearing calibration, device and the equipment of color of image and geometric distortion

Also Published As

Publication number Publication date
CN111353952A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
CN109242853B (en) PCB defect intelligent detection method based on image processing
CN107330433B (en) Image processing method and device
CN116433666B (en) Board card line defect online identification method, system, electronic equipment and storage medium
CN104580937B (en) A kind of infrared imaging system fringes noise minimizing technology
CN108037142B (en) Mask optical defect detection method based on image gray value
CN108898132B (en) Terahertz image dangerous article identification method based on shape context description
CN106296608B (en) Mapping table-based fisheye image processing method and system
CN101315664A (en) Text image preprocessing method for character recognition
CN114170165A (en) Chip surface defect detection method and device
CN115294149A (en) Astronomical image background extraction method and system
CN111353952B (en) Method for eliminating black boundary after image distortion correction
CN113971681A (en) Edge detection method for belt conveyor in complex environment
CN110930358B (en) Solar panel image processing method based on self-adaptive algorithm
CN117635565A (en) Semiconductor surface defect detection system based on image recognition
CN110610163B (en) Table extraction method and system based on ellipse fitting in natural scene
CN104408430B (en) License plate positioning method and device
CN117058182A (en) Target detection frame optimization method for visual ranging
CN107862670B (en) Image restoration method for infrared imaging electric crosstalk
CN110688999B (en) Mach-band effect simulated point light source metal steel seal character detection method
CN114359414A (en) Lens smudge identification method and device, computer equipment and storage medium
CN108596993B (en) System and method for correcting unsaturated artifacts of images
CN111951323B (en) Method for sorting grids and calculating number of cracks and corresponding area of cracks
CN115035529B (en) VIN equal proportion reduction and character recognition method based on image
CN112862708B (en) Adaptive recognition method of image noise, sensor chip and electronic equipment
CN112465731B (en) Steel seal character image preprocessing method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Yan Guangyuan

Inventor after: Zhang Yunzhi

Inventor after: Lu Qinghua

Inventor before: Yan Guangyuan

Inventor before: Zhang Zhiyun

Inventor before: Lu Qinghua

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant