CN108961333B - Efficient calculation method for pixel area of image area - Google Patents

Efficient calculation method for pixel area of image area Download PDF

Info

Publication number
CN108961333B
CN108961333B CN201810641311.4A CN201810641311A CN108961333B CN 108961333 B CN108961333 B CN 108961333B CN 201810641311 A CN201810641311 A CN 201810641311A CN 108961333 B CN108961333 B CN 108961333B
Authority
CN
China
Prior art keywords
equal
pixels
linked list
image
pixel area
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
CN201810641311.4A
Other languages
Chinese (zh)
Other versions
CN108961333A (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.)
Zhejiang Ruitest Technology Co ltd
Original Assignee
Hangzhou Jingyi Intelligent Science and Technology Co Ltd
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 Hangzhou Jingyi Intelligent Science and Technology Co Ltd filed Critical Hangzhou Jingyi Intelligent Science and Technology Co Ltd
Priority to CN201810641311.4A priority Critical patent/CN108961333B/en
Publication of CN108961333A publication Critical patent/CN108961333A/en
Application granted granted Critical
Publication of CN108961333B publication Critical patent/CN108961333B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Geometry (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

Discloses an efficient calculation method for the pixel area of an image region, namely, the center point C (x) of the image region in a known binary image Ic,yc) The method is realized by the following steps: 1. setting linked list L = { a =i(p, q) } and a table-tail pointer ep; 2. the center point C (x)c,yc) Storing surrounding pixel points into a linked list L; 3. judging the quadrant position of the elements in the linked list L relative to the central point C, entering the corresponding step, if the table tail pointer ep is 0, obtaining the pixel area value s of the image area, and ending the process; 4. searching outwards from the center in the first quadrant, and accumulating the number of pixels; 5. searching outwards from the center in the second quadrant, and accumulating the number of pixels; 6. searching outwards from the center in the third quadrant, and accumulating the number of pixels; 7. searching from the center outwards in the fourth quadrant, the number of pixels is accumulated.

Description

Efficient calculation method for pixel area of image area
Technical Field
The invention relates to a method for efficiently calculating the pixel area of an image area, and belongs to the field of image processing.
Background
Computer vision has become more and more widely used, and has been developed from simple video recording to image recognition and analysis, such as license plate recognition, face recognition, human body tracking, binocular stereo vision, and the like. Therefore, the importance of the image processing algorithm is highlighted, and the rapid development of the algorithms such as image denoising, image transformation, image segmentation, image compression, image enhancement, image blurring processing and the like is promoted.
Disclosure of Invention
The invention provides a high-efficiency calculation method for the pixel area of an image region, which adopts a method for searching pixel points in the region from a central point spirally outwards.
The technical scheme adopted by the invention for solving the technical problems is as follows:
an efficient calculation method for pixel area of an image area is known as a binary image I (x, y), wherein x = 1-M, y = 1-N, M is the maximum number of pixels in the x-axis direction, N is the maximum number of pixels in the y-axis direction, the image area I (x, y) is equal to 1, x = 1-M, y = 1-N, M is the maximum number of pixels in the x-axis direction, N is the maximum number of pixels in the y-axis direction, and a central point is C (x, y)c,yc) The method is realized by the following steps:
(1) setting linked list L = { a =iIn which a isi= (p, q), i =1,2,3.. the pointer ep is set to point to the position of the latest data in the linked list L, the initial value is 0, the pixel area s of the interest region is set, and the initial value is 1;
(2) initialize the linked list L if I (x)c+1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc+1,yc),I(xc+1,yc) = 0; if I (x)c,yc+1) is equal to 1, then s = s +1, ep = ep +1, aep=(xc,yc+1),I(xc,yc+1) = 0; if I (x)c-1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc-1,yc),I(xc-1,yc) = 0; if I (x)c,yc-1) equals 1, then s = s +1, ep = ep +1, aep=(xc,yc-1),I(xc,yc-1)=0;
(3) For the linked list L, if ep is equal to 0, the calculation is completed, a pixel area value s of the image area is obtained, and the process is ended; if a isep.p-xc>0, and aep.q-ycIf the value is more than or equal to 0, executing the step 4; if a isep.p-xcIs ≦ 0, and aep.q-yc>0, executing the step 5; if a isep.p-xc<0, and aep.q-ycIf not more than 0, executing the step 6; if a isep.p-xcIs not less than 0, and aep.q-yc<0, executing the step 7;
(4) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(5) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(6) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n-1), I (m, n-1) = 0; returning to the step 3;
(7) establishing temporary variables (m, n) with m = aep.x,n=aep.y, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n-1), I (m, n-1) = 0; and returning to the step 3.
The invention has the following beneficial effects: 1. the method is simple and high in efficiency, so that the operation speed is high; 2. the calculation result is accurate, and the error is small.
Drawings
Fig. 1 is a schematic diagram of an efficient calculation method of pixel area of an image area.
Detailed Description
The invention is further described below with reference to the accompanying drawings:
referring to fig. 1, a method for efficiently calculating a pixel area of an image region is known as a binary image I (x, y), where x =1 to M, y =1 to N, M is a maximum number of pixels in an x-axis direction, N is a maximum number of pixels in a y-axis direction, the image region I (x, y) is equal to 1, other regions I (x, y) are equal to 0, and a central point is C (x, y)c,yc). The efficient calculation method is realized by the following steps:
(1) setting linked list L = { a =iIn which a isi= (x, y), i =1,2,3.. the pointer ep is set to point to the position of the latest data in the linked list L, the initial value is 0, the pixel area s of the interest region is set, and the initial value is 1;
step 1 provides for subsequent calculations. The linked list L is used to store the outermost pixels that are radially searched from the center to the periphery.
(2) Initialize the linked list L if I (x)c+1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc+1,yc),I(xc+1,yc) = 0; if I (x)c,yc+1) is equal to 1, then s = s +1, ep = ep +1, aep=(xc,yc+1),I(xc,yc+1) = 0; if I (x)c-1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc-1,yc),I(xc-1,yc) = 0; if it is notI(xc,yc-1) equals 1, then s = s +1, ep = ep +1, aep=(xc,yc-1),I(xc,yc-1)=0;
In step 2, the center point C (x) is usedc,yc) As core, an initial search path is established as the center point C (x)c,yc) Adjacent points up, down, left, and right.
(3) For the linked list L, if ep is equal to 0, the calculation is completed, a pixel area value s of the image area is obtained, and the process is ended; if a isep.p-xc>0, and aep.q-ycIf the value is more than or equal to 0, executing the step 4; if a isep.p-xcIs ≦ 0, and aep.q-yc>0, executing the step 5; if a isep.p-xc<0, and aep.q-ycIf not more than 0, executing the step 6; if a isep.p-xcIs not less than 0, and aep.q-yc<0, executing the step 7;
step 3 is an entry of the cyclic search, so that the judgment of the ending condition is firstly carried out, if ep is equal to 0, the calculation of the pixel area s of the image area is completed, and the process is ended; otherwise, the position of the latest data in the link list L is judged according to the position of the latest data relative to the central point C (x)c,yc) The quadrant positions of (a) are processed in different steps.
(4) Establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(5) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(6) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to1, then s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n-1), I (m, n-1) = 0; returning to the step 3;
(7) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n-1), I (m, n-1) = 0; and returning to the step 3.
Step 4, a searching method of the first quadrant, wherein the searching method is performed right first and then upward; step 5, a search method of a second quadrant, wherein the search method is performed leftwards and upwards; step 6, a search method of a third quadrant, namely, firstly, leftwards and then downwards; step 7 is a search method of the fourth quadrant, first right and then down. When all the paths reach the outermost periphery of the image area, the data in the linked list L are deleted one by one, no new data is added, finally ep is equal to 0, and the calculation process is ended.

Claims (1)

1. An efficient calculation method for pixel area of an image area is known as a binary image I (x, y), wherein x = 1-M, y = 1-N, M is the maximum number of pixels in the x-axis direction, N is the maximum number of pixels in the y-axis direction, the image area I (x, y) is equal to 1, x = 1-M, y = 1-N, M is the maximum number of pixels in the x-axis direction, N is the maximum number of pixels in the y-axis direction, and a central point is C (x, y)c,yc) The method is characterized in that: the method is realized by the following steps:
(1) setting linked list L = { a =iIn which a isi= (p, q), i =1,2,3.. the pointer ep is set to point to the position of the latest data in the linked list L, the initial value is 0, the pixel area s of the interest region is set, and the initial value is 1;
(2) initialize the linked list L if I (x)c+1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc+1,yc),I(xc+1,yc) = 0; if I (x)c,yc+1) is equal to 1, then s = s +1, ep = ep +1, aep=(xc,yc+1),I(xc,yc+1) = 0; if I (x)c-1,yc) Equal to 1, s = s +1, ep = ep +1, aep=(xc-1,yc),I(xc-1,yc) = 0; if I (x)c,yc-1) equals 1, then s = s +1, ep = ep +1, aep=(xc,yc-1),I(xc,yc-1)=0;
(3) For the linked list L, if ep is equal to 0, the calculation is completed, a pixel area value s of the image area is obtained, and the process is ended; if a isep.p-xc>0, and aep.q-ycIf the value is more than or equal to 0, executing the step 4; if a isep.p-xcIs ≦ 0, and aep.q-yc>0, executing the step 5; if a isep.p-xc<0, and aep.q-ycIf not more than 0, executing the step 6; if a isep.p-xcIs not less than 0, and aep.q-yc<0, executing the step 7;
(4) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(5) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n +1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n +1), I (m, n +1) = 0; returning to the step 3;
(6) establishing temporary variables (m, n) with m = aep.p,n=aep.q, then ep = ep-1; if I (m-1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m-1, n), I (m-1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep= (m, n-1), I (m, n-1) = 0; returning to the step 3;
(7) establishing temporary variables (m, n) with m = aep.x,n=aep.y, then ep = ep-1; if I (m +1, n) is equal to 1, s = s +1, ep = ep +1, aep= (m +1, n), I (m +1, n) = 0; if I (m, n-1) is equal to 1, s = s +1, ep = ep +1, aep=(m,n-1),I(m,n-1) = 0; and returning to the step 3.
CN201810641311.4A 2018-06-21 2018-06-21 Efficient calculation method for pixel area of image area Active CN108961333B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810641311.4A CN108961333B (en) 2018-06-21 2018-06-21 Efficient calculation method for pixel area of image area

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810641311.4A CN108961333B (en) 2018-06-21 2018-06-21 Efficient calculation method for pixel area of image area

Publications (2)

Publication Number Publication Date
CN108961333A CN108961333A (en) 2018-12-07
CN108961333B true CN108961333B (en) 2021-05-14

Family

ID=64491545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810641311.4A Active CN108961333B (en) 2018-06-21 2018-06-21 Efficient calculation method for pixel area of image area

Country Status (1)

Country Link
CN (1) CN108961333B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100552698C (en) * 2007-12-11 2009-10-21 中国科学院长春光学精密机械与物理研究所 Real-time detection method to airfield runway in the image of taking photo by plane
CN101950420A (en) * 2010-08-26 2011-01-19 广东宝莱特医用科技股份有限公司 Image area calculation method for single region encircled by random communicated boundaries
CN102521600A (en) * 2011-11-03 2012-06-27 北京农业信息技术研究中心 Method and system for identifying white-leg shrimp disease on basis of machine vision
US20130265287A1 (en) * 2012-04-04 2013-10-10 Samsung Electronics Co., Ltd. Apparatus and method to detect coordinates in a penbased display device
CN104123431A (en) * 2013-04-24 2014-10-29 国民技术股份有限公司 Element modular inversion calculation method and device
CN106152978A (en) * 2016-06-20 2016-11-23 陕西师范大学 A kind of untouchable area measurement method based on graphical analysis

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100552698C (en) * 2007-12-11 2009-10-21 中国科学院长春光学精密机械与物理研究所 Real-time detection method to airfield runway in the image of taking photo by plane
CN101950420A (en) * 2010-08-26 2011-01-19 广东宝莱特医用科技股份有限公司 Image area calculation method for single region encircled by random communicated boundaries
CN102521600A (en) * 2011-11-03 2012-06-27 北京农业信息技术研究中心 Method and system for identifying white-leg shrimp disease on basis of machine vision
US20130265287A1 (en) * 2012-04-04 2013-10-10 Samsung Electronics Co., Ltd. Apparatus and method to detect coordinates in a penbased display device
CN104123431A (en) * 2013-04-24 2014-10-29 国民技术股份有限公司 Element modular inversion calculation method and device
CN106152978A (en) * 2016-06-20 2016-11-23 陕西师范大学 A kind of untouchable area measurement method based on graphical analysis

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于链表的二值图像像素标记改进算法;李伟 等;《科技风》;20081231;第55-56页 *

Also Published As

Publication number Publication date
CN108961333A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
Liu et al. Adaptive nms: Refining pedestrian detection in a crowd
CN110532897B (en) Method and device for recognizing image of part
US9852511B2 (en) Systems and methods for tracking and detecting a target object
US10474921B2 (en) Tracker assisted image capture
CN113284168A (en) Target tracking method and device, electronic equipment and storage medium
CN111681256B (en) Image edge detection method, image edge detection device, computer equipment and readable storage medium
CN110909663A (en) Human body key point identification method and device and electronic equipment
CN110502962B (en) Method, device, equipment and medium for detecting target in video stream
CN106251348B (en) Self-adaptive multi-cue fusion background subtraction method for depth camera
CN112052702B (en) Method and device for identifying two-dimensional code
CN110782385A (en) Image watermark removing method based on deep learning
CN111104855B (en) Workflow identification method based on time sequence behavior detection
CN116229112A (en) Twin network target tracking method based on multiple attentives
CN115293986A (en) Multi-temporal remote sensing image cloud region reconstruction method
CN114431005A (en) Intelligent agricultural fruit picking, identifying and positioning method, system and device
KR100439697B1 (en) Color image processing method and apparatus thereof
CN108961333B (en) Efficient calculation method for pixel area of image area
CN115775214B (en) Point cloud completion method and system based on multi-stage fractal combination
CN111860287A (en) Target detection method and device and storage medium
CN110211150B (en) Real-time visual target identification method with scale coordination mechanism
CN112508065B (en) Robot and positioning method and device thereof
CN111046727B (en) Video feature extraction method and device, electronic equipment and storage medium
CN114429488A (en) Target tracking method and target tracking device
EP2951781A1 (en) Systems and methods for processing an image
CN111986111B (en) Image segmentation method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220512

Address after: 322000 floor 2, administrative building 1, No. 648, Qijiguang Road, Houjiang street, Yiwu City, Jinhua City, Zhejiang Province (self declaration)

Patentee after: Zhejiang ruitest Technology Co.,Ltd.

Address before: 310013 no.256, 6th floor, building 2, Huahong building, 248 Tianmushan Road, Xihu District, Hangzhou City, Zhejiang Province

Patentee before: HANGZHOU JINGYI INTELLIGENT SCIENCE & TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right