TWI824550B - Method for generating distorted image, electronic device and storage medium - Google Patents
Method for generating distorted image, electronic device and storage medium Download PDFInfo
- Publication number
- TWI824550B TWI824550B TW111121120A TW111121120A TWI824550B TW I824550 B TWI824550 B TW I824550B TW 111121120 A TW111121120 A TW 111121120A TW 111121120 A TW111121120 A TW 111121120A TW I824550 B TWI824550 B TW I824550B
- Authority
- TW
- Taiwan
- Prior art keywords
- pixel
- distortion
- coordinate
- coordinates
- pixel coordinates
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 238000013136 deep learning model Methods 0.000 claims description 25
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 8
- 230000011218 segmentation Effects 0.000 description 6
- 238000012549 training Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000012937 correction Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Image Processing (AREA)
- Holo Graphy (AREA)
- Color Television Image Signal Generators (AREA)
Abstract
Description
本申請涉及圖像處理領域,尤其涉及一種畸變圖像生成方法、電子設備及計算機可讀存儲媒體。 The present application relates to the field of image processing, and in particular to a distortion image generation method, electronic equipment and computer-readable storage media.
日常生活中,人們常常使用訓練完成的深度學習模型實現對圖像的識別、分割等功能。然而,經過攝像頭拍攝的圖像,存在著畸變,並且畸變的程度各不相同,從而導致訓練完成的深度學習模型無法對獲取的到的畸變圖像進行準確的識別或者分割,造成深度學習模型的識別或分割的準確度下降。 In daily life, people often use trained deep learning models to realize functions such as image recognition and segmentation. However, the images captured by the camera are distorted, and the degree of distortion varies. As a result, the trained deep learning model cannot accurately identify or segment the obtained distorted images, resulting in the failure of the deep learning model. Reduction in recognition or segmentation accuracy.
鑒於以上內容,有必要提供一種畸變圖像生成方法、電子設備及計算機可讀存儲媒體,以解決由畸變圖像造成的深度學習模型精度下降的問題。 In view of the above, it is necessary to provide a distortion image generation method, electronic device and computer-readable storage medium to solve the problem of reduced accuracy of deep learning models caused by distorted images.
本申請實施例提供一種畸變圖像生成方法,所述畸變圖像生成方法包括:獲取未畸變圖像;獲取所述未畸變圖像的多個第一像素座標及每個第一像素座標對應的第一像素值;及從所述多個第一像素座標中選取一個第一像素座標作為畸變中心座標;根據所述畸變中心座標及所述多個第一像素座標,計算得到所述畸變中心座標與每個第一像素座標的距離;獲取至少一個畸變係數,根據所述至少一個畸變係數、所述多個第一像素座標及所述畸變中心座標與每個第一像素座標的距離,計算得到每個第一像素座標對應的第二像素座標; 將所述每個第一像素座標對應的第一像素值作為每個第二像素座標對應的第二像素值;基於所述多個第二像素座標和所述每個第二像素座標對應的第二像素值生成所述未畸變圖像的畸變圖像。 Embodiments of the present application provide a method for generating a distorted image. The method for generating a distorted image includes: acquiring an undistorted image; acquiring a plurality of first pixel coordinates of the undistorted image and corresponding to each first pixel coordinate. a first pixel value; and selecting a first pixel coordinate from the plurality of first pixel coordinates as the distortion center coordinate; calculating the distortion center coordinate according to the distortion center coordinate and the plurality of first pixel coordinates. The distance from each first pixel coordinate; obtaining at least one distortion coefficient, calculated based on the at least one distortion coefficient, the plurality of first pixel coordinates, and the distance between the distortion center coordinate and each first pixel coordinate. the second pixel coordinate corresponding to each first pixel coordinate; The first pixel value corresponding to each first pixel coordinate is used as the second pixel value corresponding to each second pixel coordinate; based on the plurality of second pixel coordinates and the third pixel value corresponding to each second pixel coordinate Two pixel values generate a distorted image of the undistorted image.
在一種可選的實施方式中,所述方法還包括:利用所述未畸變圖像及所述畸變圖像訓練深度學習模型。 In an optional implementation, the method further includes: training a deep learning model using the undistorted image and the distorted image.
在一種可選的實施方式中,所述方法還包括:根據所述多個第二像素座標確定畸變類型;基於所述畸變類型、所述第二像素座標和所述第二像素座標對應的第二像素值生成與所述畸變類型對應的畸變圖像。 In an optional implementation, the method further includes: determining a distortion type based on the plurality of second pixel coordinates; and based on the distortion type, the second pixel coordinates, and a third value corresponding to the second pixel coordinates The two-pixel value generates a distortion image corresponding to the distortion type.
在一種可選的實施方式中,所述畸變類型包括徑向畸變類型及切向畸變類型。 In an optional implementation, the distortion type includes a radial distortion type and a tangential distortion type.
在一種可選的實施方式中,所述根據所述畸變中心座標及所述多個第一像素座標,計算得到所述畸變中心座標與每一所述第一像素座標的距離包括:根據公式計算所述畸變中心座標與每一所述第一像素座標的距離;其中,r d 表示所述畸變中心座標與每個第一像素座標的距離,(x d ,y d )表示每個第一像素座標,(x 0 ,y 0)表示所述畸變中心座標。 In an optional implementation, calculating the distance between the distortion center coordinate and each of the first pixel coordinates based on the distortion center coordinate and the plurality of first pixel coordinates includes: according to the formula Calculate the distance between the distortion center coordinate and each first pixel coordinate; where, r d represents the distance between the distortion center coordinate and each first pixel coordinate, and ( x d , y d ) represents each first pixel coordinate. Pixel coordinates, ( x 0 , y 0 ) represent the distortion center coordinates.
在一種可選的實施方式中,所述獲取至少一個畸變係數,根據所述至少一個畸變係數、多個所述第一像素座標及所述畸變中心座標與每一所述第一像素座標的距離,計算得到多個第二像素座標包括:根據公式,計算得到所述多個第二像素座標;其中,(x u ,y u )表示第二像素座標,(x d ,y d )表示第一像素座標,r d 表示所述畸變中心座標與每個第一像素座標的距離,k為正整數,λ 1,λ 2...λ k 為所述畸變係數。 In an optional implementation, the obtaining of at least one distortion coefficient is based on the at least one distortion coefficient, a plurality of first pixel coordinates, and the distance between the distortion center coordinate and each first pixel coordinate. , the calculated multiple second pixel coordinates include: according to the formula , calculate the plurality of second pixel coordinates; where ( x u , y u ) represents the second pixel coordinates, ( x d , y d ) represents the first pixel coordinates, r d represents the distortion center coordinate and each The distance between the first pixel coordinates, k is a positive integer, λ 1 , λ 2 ... λ k is the distortion coefficient.
在一種可選的實施方式中,所述方法還包括:根據公式 ,計算得到所述多個第二像素座標;其中,(x u ,y u )表示第二像素座標,(x d ,y d )表示第一像素座標,r d 表示畸變中心座標與每個第一像素座標的距離,μ 1,μ 2為畸變係數。 In an optional implementation, the method further includes: according to the formula , calculate the plurality of second pixel coordinates; among them, ( x u , y u ) represents the second pixel coordinates, ( x d , y d ) represents the first pixel coordinates, r d represents the distortion center coordinate and each th The distance of one pixel coordinate, μ 1 and μ 2 are the distortion coefficients.
在一種可選的實施方式中,所述方法還包括:藉由對所述未畸變圖像進行數據增強處理,擴增所述未畸變圖像,其中所述數據增強處理包括對所述未畸變圖像進行翻轉、旋轉、縮放比例、移位處理中的一種或多種。 In an optional implementation, the method further includes: amplifying the undistorted image by performing data enhancement processing on the undistorted image, wherein the data enhancement processing includes performing data enhancement on the undistorted image. The image is subjected to one or more of flipping, rotating, scaling, and shifting processing.
本申請實施例還提供一種電子設備,所述電子設備包括處理器和記憶體,所述處理器用於執行記憶體中存儲的計算機程式以實現所述的畸變圖像生成方法。 An embodiment of the present application also provides an electronic device. The electronic device includes a processor and a memory. The processor is configured to execute a computer program stored in the memory to implement the distortion image generation method.
本申請實施例還提供一種計算機可讀存儲媒體,所述計算機可讀存儲媒體存儲有至少一個指令,所述至少一個指令被處理器執行時實現所述的畸變圖像生成方法。 Embodiments of the present application also provide a computer-readable storage medium that stores at least one instruction. When the at least one instruction is executed by a processor, the method for generating a distorted image is implemented.
本申請實施例中所述的畸變圖像生成方法、電子設備及計算機可讀存儲媒體,能夠生成不同畸變程度的畸變圖像及不同類型的畸變圖像,利用不同畸變程度的畸變圖像及不同類型的畸變圖像訓練深度學習模型,使深度學習模型能夠認識各種各樣的畸變圖像,從而提升深度學習模型的精度及魯棒性。 The distortion image generation methods, electronic devices and computer-readable storage media described in the embodiments of the present application can generate distorted images with different degrees of distortion and different types of distorted images, and utilize distorted images with different degrees of distortion and different types of distortion images. Types of distorted images train the deep learning model so that the deep learning model can recognize a variety of distorted images, thereby improving the accuracy and robustness of the deep learning model.
2:電子設備 2: Electronic equipment
201:記憶體 201:Memory
202:處理器 202: Processor
203:計算機程式 203: Computer programs
204:通訊匯流排 204: Communication bus
101-106:步驟 101-106: Steps
圖1為本申請實施例提供的一種畸變圖像生成方法的流程圖。 Figure 1 is a flow chart of a distortion image generation method provided by an embodiment of the present application.
圖2為本申請實施例提供的一種電子設備的結構示意圖。 FIG. 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
為了能夠更清楚地理解本申請的上述目的、特徵和優點,下面結合附圖和具體實施例對本申請進行詳細描述。需要說明的是,此處所描述的具體實施例僅用以解釋本申請,並不用於限定本申請。 In order to more clearly understand the above objects, features and advantages of the present application, the present application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
在下面的描述中闡述了很多具體細節以便於充分理解本申請,所描述的實施例僅僅是本申請一部分實施例,而不是全部的實施例。基於本申請 中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬本申請保護的範圍。 Many specific details are set forth in the following description to facilitate a full understanding of the present application. The described embodiments are only some, rather than all, of the embodiments of the present application. Based on this application All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
以下,術語“第一”、“第二”僅用於描述目的,而不能理解為指示或暗示相對重要性或者隱含指明所指示的技術特徵的數量。由此,限定有“第一”、“第二”的特徵可以明示或者隱含地包括一個或者更多個該特徵。在本申請的一些實施例的描述中,“示例性的”或者“例如”等詞用於表示作例子、例證或說明。本申請的一些實施例中被描述為“示例性的”或者“例如”的任何實施例或設計方案不應被解釋為比其它實施例或設計方案更優選或更具優勢。確切而言,使用“示例性的”或者“例如”等詞旨在以具體方式呈現相關概念。 Hereinafter, the terms “first” and “second” are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of some embodiments of the present application, words such as "exemplary" or "such as" are used to represent examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "such as" in some embodiments of the application is not intended to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words "exemplary" or "such as" is intended to present the concept in a concrete manner.
除非另有定義,本文所使用的所有的技術和科學術語與屬本申請的技術領域的技術人員通常理解的含義相同。本文中在本申請的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本申請。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the application is for the purpose of describing specific embodiments only and is not intended to limit the application.
參閱圖1所示,圖1為本申請實施例提供的一種畸變圖像生成方法的流程圖。所述方法應用於電子設備(例如,圖2所示的電子設備2)中,所述電子設備可以是任何一種可與用戶進行人機交互的電子產品,例如,個人計算機、平板電腦、智能手機、個人數位助理(Personal Digital Assistant,PDA)、遊戲機、交互式網路電視(Internet Protocol Television,IPTV)、智能穿戴式裝置等。 Refer to Figure 1, which is a flow chart of a distortion image generation method provided by an embodiment of the present application. The method is applied to an electronic device (for example, the electronic device 2 shown in Figure 2). The electronic device can be any electronic product that can interact with the user, such as a personal computer, a tablet computer, a smart phone. , Personal Digital Assistant (PDA), game consoles, interactive Internet Protocol Television (IPTV), smart wearable devices, etc.
所述電子設備是一種能夠按照事先設定或存儲的指令,自動進行數值計算和/或信息處理的設備,其硬體包括,但不限於:微處理器、專用集成電路(Application Specific Integrated Circuit,ASIC)、可編程門陣列(Field-Programmable Gate Array,FPGA)、數位訊號處理器(Digital Signal Processor,DSP)、嵌入式設備等。 The electronic device is a device that can automatically perform numerical calculations and/or information processing according to preset or stored instructions. Its hardware includes, but is not limited to: microprocessors, Application Specific Integrated Circuits (ASICs) ), Field-Programmable Gate Array (FPGA), Digital Signal Processor (DSP), embedded devices, etc.
所述電子設備還可以包括網路設備和/或用戶設備。其中,所述網路設備包括,但不限於單個網路伺服器、多個網路伺服器組成的伺服器組或基於雲計算(Cloud Computing)的由大量主機或網路伺服器構成的雲。 The electronic equipment may also include network equipment and/or user equipment. The network equipment includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing.
所述方法具體包括如下步驟。 The method specifically includes the following steps.
101,電子設備獲取未畸變的圖像。 101. Electronic equipment acquires undistorted images.
在本申請的至少一個實施例中,所述未畸變的圖像包括,未畸變的圖像或者經過畸變校正後的圖像。所述圖像包括,但不限於道路場景圖像,工業產品圖像。例如,未畸變圖像可以包括車輛前方視野的未畸變圖像、塑膠產品的未畸變圖像。 In at least one embodiment of the present application, the undistorted image includes an undistorted image or a distortion-corrected image. The images include, but are not limited to, road scene images and industrial product images. For example, the undistorted image may include an undistorted image of the front view of the vehicle and an undistorted image of a plastic product.
在本申請的至少一個實施例中,所述獲取未畸變圖像包括:藉由畸變校正後的相機拍攝道路場景或者工業產品的圖像作為未畸變圖像。在本實施例中,還可以對畸變圖像進行去畸變以獲取未畸變圖像。 In at least one embodiment of the present application, obtaining an undistorted image includes: using a distortion-corrected camera to capture an image of a road scene or an industrial product as an undistorted image. In this embodiment, the distorted image can also be dedistorted to obtain an undistorted image.
在本申請的至少一個實施例中,所述方法還包括:藉由對所述未畸變圖像進行數據增強操作,獲取更多不相同的未畸變圖像,所述數據增強操作包括,但不限於如下處理方式的一種或多種:翻轉圖像、旋轉圖像、縮放圖像、裁剪圖像。藉由所述數據增強操作可以有效擴充未畸變圖像,從而擴充訓練樣本數量。 In at least one embodiment of the present application, the method further includes: obtaining more different undistorted images by performing a data enhancement operation on the undistorted image. The data enhancement operation includes, but does not Limited to one or more of the following processing methods: flipping the image, rotating the image, scaling the image, and cropping the image. Through the data enhancement operation, the undistorted image can be effectively expanded, thereby expanding the number of training samples.
102,獲取所述未畸變圖像的多個第一像素座標及每個第一像素座標對應的第一像素值,並從所述多個第一像素座標中選取一個第一像素座標作為畸變中心座標。 102. Obtain multiple first pixel coordinates of the undistorted image and the first pixel value corresponding to each first pixel coordinate, and select one first pixel coordinate from the multiple first pixel coordinates as the distortion center. coordinates.
在本申請的至少一個實施例中,所述獲取所述未畸變圖像的多個第一像素座標包括:基於OpenCV方法獲取所述未畸變圖像的多個第一像素座標。也即獲取所述未畸變圖像中的所有像素座標。 In at least one embodiment of the present application, obtaining a plurality of first pixel coordinates of the undistorted image includes: obtaining a plurality of first pixel coordinates of the undistorted image based on an OpenCV method. That is, all pixel coordinates in the undistorted image are obtained.
在本申請的至少一個實施例中,所述獲取每個第一像素座標對應的第一像素值包括:基於OpenCV方法獲取所述未畸變圖像的每個第一像素座標對應的第一像素值。在本實施例中,所述第一像素值採用RGB的方式表示。例如,第一像素座標為(1750,160),對應的第一像素值為(113,65,79),即R:113,G:65,B:79。 In at least one embodiment of the present application, obtaining the first pixel value corresponding to each first pixel coordinate includes: obtaining the first pixel value corresponding to each first pixel coordinate of the undistorted image based on the OpenCV method . In this embodiment, the first pixel value is represented by RGB. For example, the first pixel coordinate is (1750,160), and the corresponding first pixel value is (113,65,79), that is, R: 113, G: 65, and B: 79.
在本申請的至少一個實施例中,所述從多個所述第一像素座標中選取一個第一像素座標作為畸變中心座標包括:從所有第一像素座標中選取任意一個像素座標作為畸變中心座標。所述畸變中心為不同視場處的畸變量大小的參考中心,距離畸變中心越遠的視場處,所對應的畸變量就越大。也即越遠離畸變中心的第一像素座標,第一像素座標處畸變量就越大。 In at least one embodiment of the present application, selecting a first pixel coordinate from a plurality of first pixel coordinates as the distortion center coordinate includes: selecting any one pixel coordinate from all first pixel coordinates as the distortion center coordinate. . The distortion center is a reference center for distortion amounts at different fields of view. The farther the field of view is from the distortion center, the greater the corresponding distortion amount. That is, the farther away the first pixel coordinate is from the distortion center, the greater the distortion amount at the first pixel coordinate.
可以理解的是,所有的第一像素座標都有可能作為畸變中心,所有的第一像素座標都會被選取一次作為畸變中心,以生成更多的畸變圖像。 It can be understood that all first pixel coordinates may be used as distortion centers, and all first pixel coordinates will be selected once as distortion centers to generate more distorted images.
103,根據所述畸變中心座標及所述多個第一像素座標,計算得到所述畸變中心座標與每個第一像素座標的距離。 103. Calculate the distance between the distortion center coordinate and each first pixel coordinate based on the distortion center coordinate and the plurality of first pixel coordinates.
在本申請的至少一個實施例中,所述根據所述畸變中心座標及多個所述第一像素座標計算得到所述畸變中心座標與每一所述第一像素座標的距離包括:根據公式:
計算所述畸變中心座標與每一所述第一像素座標的距離;其中,r d 表示畸變中心座標與每個第一像素座標的距離,(x d ,y d )表示第一像素座標,(x 0 ,y 0)表示畸變中心座標。 Calculate the distance between the distortion center coordinate and each first pixel coordinate; where, r d represents the distance between the distortion center coordinate and each first pixel coordinate, ( x d , y d ) represents the first pixel coordinate, ( x 0 , y 0 ) represents the distortion center coordinates.
具體地,可以將每個第一像素座標與畸變中心座標代入上述公式,藉由上述公式即可計算畸變中心到每一個第一像素座標的距離。 Specifically, each first pixel coordinate and the distortion center coordinate can be substituted into the above formula , by the above formula The distance from the distortion center to each first pixel coordinate can be calculated.
104,獲取至少一個畸變係數,根據所述至少一個畸變係數、所述多個第一像素座標及所述畸變中心座標與每個第一像素座標的距離,計算得到每個第一像素座標對應的第二像素座標。 104. Obtain at least one distortion coefficient, and calculate the value corresponding to each first pixel coordinate based on the at least one distortion coefficient, the plurality of first pixel coordinates, and the distance between the distortion center coordinate and each first pixel coordinate. The second pixel coordinate.
在本申請的至少一個實施例中,所述畸變係數用於改變畸變圖像的畸變程度,所述畸變係數可以從對應的相機中獲取。 In at least one embodiment of the present application, the distortion coefficient is used to change the degree of distortion of a distorted image, and the distortion coefficient can be obtained from a corresponding camera.
在本申請的至少一個實施例中,所述根據所述至少一個畸變係數、多個所述第一像素座標及所述畸變中心座標與每一所述第一像素座標的距離計算得到多個第二像素座標包括:根據公式:
計算得到所述多個第二像素座標;其中,(x u ,y u )表示第二像素座標,(x d ,y d )表示第一像素座標,r d 表示畸變中心座標與每個第一像素座標的距離,k為正整數,λ 1,λ 2…λ k 為畸變係數。在本實施例中,k值越大,畸變程度就越大。 The plurality of second pixel coordinates are calculated; where ( x u , yu ) represents the second pixel coordinate, ( x d , y d ) represents the first pixel coordinate, r d represents the distortion center coordinate and each first pixel coordinate. The distance of pixel coordinates, k is a positive integer, λ 1 , λ 2 ... λ k is the distortion coefficient. In this embodiment, the larger the k value, the greater the degree of distortion.
具體地,每個第一像素座標、畸變中心到第一像素座標的距離、畸變係數及k值代入上述公式,藉由上述公式即可計算得到第二像素座標。 Specifically, each first pixel coordinate, the distance from the distortion center to the first pixel coordinate, the distortion coefficient and the k value are substituted into the above formula , by the above formula The second pixel coordinates can be calculated.
在本申請的至少一個實施例中,所述計算得到多個第二像素座標方法還包括:根據公式:
計算得到所述多個第二像素座標;其中,(x u ,y u )表示第二像素座標,(x d ,y d )表示第一像素座標,r d 表示畸變中心座標與每個第一像素座標的距離,μ 1,μ 2為畸變係數。 The plurality of second pixel coordinates are calculated; where ( x u , yu ) represents the second pixel coordinate, ( x d , y d ) represents the first pixel coordinate, r d represents the distortion center coordinate and each first pixel coordinate. The distance of pixel coordinates, μ 1 and μ 2 are distortion coefficients.
具體地,每個第一像素座標、畸變中心到第一像素座標的距離及畸變係數代入上述公式,藉由上述公式即可計算得到第二像素座標。 Specifically, each first pixel coordinate, the distance from the distortion center to the first pixel coordinate, and the distortion coefficient are substituted into the above formula , by the above formula The second pixel coordinates can be calculated.
105,將所述每個第一像素座標對應的第一像素值作為每個第二像素座標對應的第二像素值。 105. Use the first pixel value corresponding to each first pixel coordinate as the second pixel value corresponding to each second pixel coordinate.
在本申請的至少一個實施例中,將所述每個第一像素座標對應的第一像素值作為每個第二像素座標對應的第二像素值。例如,一個第一像素座標為(1750,160),對應的第一像素值為(113,65,79),經過上述公式或公式計算得到的第二像素座標為(1230,132),確定第二像素座標的第二像素值為(113,65,79)。 In at least one embodiment of the present application, the first pixel value corresponding to each first pixel coordinate is used as the second pixel value corresponding to each second pixel coordinate. For example, a first pixel coordinate is (1750,160), and the corresponding first pixel value is (113,65,79). After the above formula or formula The calculated second pixel coordinate is (1230,132), and the second pixel value determined as the second pixel coordinate is (113,65,79).
106,基於所述多個第二像素座標和所述每個第二像素座標對應的第二像素值生成所述未畸變圖像的畸變圖像。 106. Generate a distorted image of the undistorted image based on the plurality of second pixel coordinates and the second pixel value corresponding to each second pixel coordinate.
在本申請的至少一個實施例中,基於多個所述第二像素座標和每個第二像素座標對應的第二像素值生成所述未畸變圖像的畸變圖像。 In at least one embodiment of the present application, a distorted image of the undistorted image is generated based on a plurality of the second pixel coordinates and a second pixel value corresponding to each second pixel coordinate.
在本申請的至少一個實施例中,所述方法還包括:根據多個所述第二像素座標確定畸變類型;基於所述畸變類型、第二像素座標和多個所述第二像素值生成與所述畸變類型對應的畸變圖像。 In at least one embodiment of the present application, the method further includes: determining a distortion type based on a plurality of second pixel coordinates; and generating a The distortion image corresponding to the distortion type.
具體地,所述畸變類型包括:徑向畸變類型和切向畸變類型。 Specifically, the distortion types include: radial distortion type and tangential distortion type.
在本實施例中,所述根據多個所述第二像素座標確定畸變類型包括: 利用上述公式計算得到第二座標,根據公式計算得到第二座標,確定所述畸變類型為徑向畸變類型;利用上述公式計算得到第二座標,根據公式計算得到第二座標,確定所述畸變類型為切向畸變類型。 In this embodiment, determining the distortion type according to the plurality of second pixel coordinates includes: using the above formula The second coordinate is calculated according to the formula Calculate the second coordinates and determine that the distortion type is a radial distortion type; use the above formula The second coordinate is calculated according to the formula The second coordinates are calculated and the distortion type is determined to be a tangential distortion type.
在本申請的至少一個實施例中,所述方法還包括:利用所述未畸變圖像及所述畸變圖像訓練深度學習模型。 In at least one embodiment of the present application, the method further includes: training a deep learning model using the undistorted image and the distorted image.
具體地,所述畸變圖像包括利用上述方法生成的不同畸變程度的畸變圖像及不同畸變類型的畸變圖像。所述深度學習模型還可以是AlexNet、VGGNet、GoogLeNet、ResNet、DenseNet、SSDNet、RCNN、YOLO系列、FCN、SegNet等模型中的任意一種。本申請並不對深度學習模型的類型做具體限定。 Specifically, the distorted images include distorted images with different degrees of distortion and distorted images with different types of distortion generated using the above method. The deep learning model can also be any one of AlexNet, VGGNet, GoogLeNet, ResNet, DenseNet, SSDNet, RCNN, YOLO series, FCN, SegNet and other models. This application does not specifically limit the types of deep learning models.
進一步地,例如,深度學習模型採用ResNet模型,用於對圖像中的物體進行分類,將所述畸變圖像輸入至ResNet模型進行訓練,可以提升ResNet模型的魯棒性,提高物體分類的準確性。示例性的,深度學習模型採用RCNN模型,用於檢測圖像中是否含有目標物體,將所述畸變圖像輸入至RCNN模型進行訓練,可以提升RCNN模型的魯棒性,提高分辨物體的準確性。又示例性的,深度學習模型採用FCN模型,用於分割出圖像中的目標物體,將所述畸變圖像輸入至FCN模型進行訓練,可以提升FCN模型的魯棒性,提高分割的精準度。 Further, for example, the deep learning model uses the ResNet model to classify objects in images. Inputting the distorted images into the ResNet model for training can improve the robustness of the ResNet model and improve the accuracy of object classification. sex. For example, the deep learning model uses the RCNN model to detect whether the image contains a target object. Inputting the distorted image into the RCNN model for training can improve the robustness of the RCNN model and improve the accuracy of distinguishing objects. . As another example, the deep learning model uses the FCN model to segment the target object in the image. Inputting the distorted image into the FCN model for training can improve the robustness of the FCN model and improve the accuracy of segmentation. .
由以上技術方案可以看出,本申請藉由生成不同畸變程度的圖像及不同畸變類型的畸變圖像,並將不同類型畸變圖像、不同畸變程度圖像及所述未畸變圖像訓練深度學習模型,從而使深度學習模型能夠識別到不同的畸變圖像,從而提高了深度學習模型的精度及魯棒性。 It can be seen from the above technical solutions that this application generates images with different distortion degrees and distortion images of different distortion types, and trains depth with different types of distortion images, images with different distortion degrees and the undistorted images. learning model, so that the deep learning model can recognize different distorted images, thereby improving the accuracy and robustness of the deep learning model.
可以理解的是,電子設備藉由相機獲取圖像,並將圖像輸入訓練完成的深度學習模型,從而實現對圖像的識別、分割等操作,但是,獲取的圖像可能因為相機的校正不足而存在不同的畸變,導致深度學習模型無法對圖像 進行準確地識別、分割等操作,從而導致訓練完成的深度學習模型準確度下降。本申請藉由生成不同畸變程度的圖像及不同畸變類型的畸變圖像,並結合未畸變圖像訓練深度學習模型,得到訓練完成的深度學習模型,從而使訓練完成的深度學習模型能夠識別到不同的畸變圖像,無需考慮相機對圖像的校正是否充足。簡而言之,無論相機拍攝的圖像是否產生畸變,訓練完成的深度學習模型都可以對圖像進行識別、分割等操作,從而減少了對相機校正的依賴度且提高了深度學習模型的精度及魯棒性。 It is understandable that the electronic device acquires images through the camera and inputs the images into the trained deep learning model to realize image recognition, segmentation and other operations. However, the acquired images may be due to insufficient correction of the camera. The existence of different distortions causes the deep learning model to be unable to accurately interpret images. Perform operations such as accurate identification and segmentation, resulting in a decrease in the accuracy of the trained deep learning model. This application generates images with different degrees of distortion and distorted images of different types of distortion, and trains a deep learning model with undistorted images to obtain a trained deep learning model, so that the trained deep learning model can recognize For different distorted images, there is no need to consider whether the camera's correction of the image is sufficient. In short, regardless of whether the image captured by the camera is distorted, the trained deep learning model can perform operations such as image recognition and segmentation, thereby reducing the dependence on camera correction and improving the accuracy of the deep learning model. and robustness.
以上所述,僅是本申請的具體實施方式,但本申請的保護範圍並不局限於此,對於本領域的普通技術人員來說,在不脫離本申請創造構思的前提下,還可以做出改進,但這些均屬本申請的保護範圍。 The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. For those of ordinary skill in the art, without departing from the creative concept of the present application, they can also make Improvements, but these all fall within the protection scope of this application.
如圖2所示,圖2為本申請實施例提供的一種電子設備的結構示意圖。所述電子設備2包括記憶體201、至少一個處理器202、存儲在所述記憶體201中並可在所述至少一個處理器202上運行的計算機程式203及至少一條通訊匯流排204。
As shown in Figure 2, Figure 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device 2 includes a
本領域技術人員可以理解,圖2所示的示意圖僅僅是所述電子設備2的示例,並不構成對所述電子設備2的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電子設備2還可以包括輸入輸出設備、網路接入設備等。 Those skilled in the art can understand that the schematic diagram shown in FIG. 2 is only an example of the electronic device 2 and does not constitute a limitation of the electronic device 2. It may include more or less components than those shown in the figure, or a combination thereof. Certain components, or different components, for example, the electronic device 2 may also include input and output devices, network access devices, etc.
所述至少一個處理器202可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用集成電路(Application Specific Integrated Circuit,ASIC)、現場可編程門陣列(Field-Programmable Gate Array,FPGA)或者其他可編程邏輯器件、分立門或者晶體管邏輯器件、分立硬體組件等。該至少一個處理器202可以是微處理器或者該至少一個處理器202也可以是任何常規的處理器等,所述至少
一個處理器202是所述電子設備2的控制中心,利用各種介面和線路連接整個電子設備2的各個部分。
The at least one
所述記憶體201可用於存儲所述計算機程式203,所述至少一個處理器202藉由運行或執行存儲在所述記憶體201內的計算機程式203,以及調用存儲在記憶體201內的數據,實現所述電子設備2的各種功能。所述記憶體201可主要包括存儲程式區和存儲數據區,其中,存儲程式區可存儲操作系統、至少一個功能所需的應用程式(比如聲音播放功能、圖像播放功能等)等;存儲數據區可存儲根據電子設備2的使用所創建的數據(比如音頻數據)等。此外,記憶體201可以包括非易失性記憶體,例如硬盤、內存、插接式硬盤,智能存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,閃存卡(Flash Card)、至少一個磁盤記憶體件、閃存器件、或其他非易失性固態記憶體件。
The
所述電子設備2集成的模塊/單元如果以軟件功能單元的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個計算機可讀取存儲媒體中。基於這樣的理解,本申請實現上述實施例方法中的全部或部分流程,也可以藉由計算機程式來指令相關的硬體來完成,所述的計算機程式可存儲於一計算機可讀存儲媒體中,該計算機程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述計算機程式包括計算機程式代碼,所述計算機程式代碼可以為源代碼形式、對象代碼形式、可執行文件或某些中間形式等。所述計算機可讀媒體可以包括:能夠攜帶所述計算機程式代碼的任何實體或裝置、記錄媒體、隨身碟、移動硬盤、磁碟、光盤、計算機記憶體以及唯讀記憶體(ROM,Read-Only Memory)。 If the integrated modules/units of the electronic device 2 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present application can implement all or part of the processes in the above embodiment methods by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed by the processor, the computer program can implement the steps of each of the above method embodiments. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable media may include: any entity or device capable of carrying the computer program code, a recording medium, a flash drive, a mobile hard disk, a magnetic disk, an optical disk, computer memory, and read-only memory (ROM, Read-Only Memory). Memory).
對於本領域技術人員而言,顯然本申請不限於上述示範性實施例的細節,而且在不背離本申請的精神或基本特徵的情況下,能夠以其他的具體 形式實現本申請。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本申請的範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本申請內。不應將請求項中的任何附關聯圖標記視為限制所涉及的請求項。 It is obvious to those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, and can be embodied in other specific forms without departing from the spirit or essential characteristics of the present application. Form implementation of this application. Therefore, the embodiments should be regarded as illustrative and non-restrictive from any point of view, and the scope of the present application is defined by the appended claims rather than the above description, and it is therefore intended that those falling within the claims All changes within the meaning and scope of the equivalent elements are included in this application. Any associated association markup in a request item should not be considered to limit the request item in question.
最後應說明的是,以上實施例僅用以說明本申請的技術方案而非限制,儘管參照較佳實施例對本申請進行了詳細說明,本領域的普通技術人員應當理解,可以對本申請的技術方案進行修改或等同替換,而不脫離本申請技術方案的精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be modified. Modifications or equivalent substitutions may be made without departing from the spirit and scope of the technical solution of the present application.
101-106:步驟 101-106: Steps
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW111121120A TWI824550B (en) | 2022-06-07 | 2022-06-07 | Method for generating distorted image, electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW111121120A TWI824550B (en) | 2022-06-07 | 2022-06-07 | Method for generating distorted image, electronic device and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TWI824550B true TWI824550B (en) | 2023-12-01 |
| TW202349176A TW202349176A (en) | 2023-12-16 |
Family
ID=90039141
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW111121120A TWI824550B (en) | 2022-06-07 | 2022-06-07 | Method for generating distorted image, electronic device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI824550B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI888127B (en) * | 2024-05-07 | 2025-06-21 | 緯創資通股份有限公司 | Data augmentation method and computing device thereof |
| CN121095131A (en) * | 2024-06-06 | 2025-12-09 | 宁波环球广电科技有限公司 | Label detection method using image segmentation and identification |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110751602A (en) * | 2019-09-20 | 2020-02-04 | 北京迈格威科技有限公司 | Method and Device for Conformal Distortion Correction Based on Face Detection |
| US20200387285A1 (en) * | 2019-06-07 | 2020-12-10 | Samsung Electronics Co., Ltd. | Electronic device including display and method for correcting image displayed by electronic device |
| CN113643414A (en) * | 2020-05-11 | 2021-11-12 | 北京达佳互联信息技术有限公司 | Three-dimensional image generation method and device, electronic equipment and storage medium |
| TWI755950B (en) * | 2020-11-30 | 2022-02-21 | 艾陽科技股份有限公司 | Action recognition method and system thereof |
| US20220138985A1 (en) * | 2020-10-29 | 2022-05-05 | Black Sesame Technologies Inc. | Method, apparatus, electronic device and storage medium for image distortion calibrating |
-
2022
- 2022-06-07 TW TW111121120A patent/TWI824550B/en active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200387285A1 (en) * | 2019-06-07 | 2020-12-10 | Samsung Electronics Co., Ltd. | Electronic device including display and method for correcting image displayed by electronic device |
| CN110751602A (en) * | 2019-09-20 | 2020-02-04 | 北京迈格威科技有限公司 | Method and Device for Conformal Distortion Correction Based on Face Detection |
| CN113643414A (en) * | 2020-05-11 | 2021-11-12 | 北京达佳互联信息技术有限公司 | Three-dimensional image generation method and device, electronic equipment and storage medium |
| US20220138985A1 (en) * | 2020-10-29 | 2022-05-05 | Black Sesame Technologies Inc. | Method, apparatus, electronic device and storage medium for image distortion calibrating |
| TWI755950B (en) * | 2020-11-30 | 2022-02-21 | 艾陽科技股份有限公司 | Action recognition method and system thereof |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202349176A (en) | 2023-12-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108875731B (en) | Target recognition method, device, system and storage medium | |
| WO2020207190A1 (en) | Three-dimensional information determination method, three-dimensional information determination device, and terminal apparatus | |
| CN109166156B (en) | Camera calibration image generation method, mobile terminal and storage medium | |
| WO2021082922A1 (en) | Method and device for detecting screen display disconnection | |
| WO2020244075A1 (en) | Sign language recognition method and apparatus, and computer device and storage medium | |
| WO2020082731A1 (en) | Electronic device, credential recognition method and storage medium | |
| TWI824550B (en) | Method for generating distorted image, electronic device and storage medium | |
| CN111985469B (en) | A method, device and electronic equipment for recognizing characters in images | |
| CN114494751A (en) | License information identification method, device, equipment and medium | |
| TWI807299B (en) | Image depth expanding method, image depth expanding device and electronic device | |
| CN111290684A (en) | Image display method, image display device and terminal equipment | |
| CN110119733A (en) | Page identification method and device, terminal equipment and computer readable storage medium | |
| CN111105440A (en) | Tracking method, device, device and storage medium for target object in video | |
| CN114764814A (en) | Plant height determination method and device, electronic equipment and medium | |
| CN111353325A (en) | Key point detection model training method and device | |
| CN117094986B (en) | Adaptive defect detection method and terminal equipment based on small samples | |
| CN113869320A (en) | A template-based key-value pair extraction method and system | |
| WO2021139169A1 (en) | Method and apparatus for card recognition, device, and storage medium | |
| TW202416155A (en) | Fish identification device and fish identification method | |
| CN111222446B (en) | Face recognition method, face recognition device and mobile terminal | |
| CN111784607B (en) | Image tone mapping method, device, terminal equipment and storage medium | |
| CN117252764A (en) | Distorted image generation method, electronic device and storage medium | |
| WO2022027191A1 (en) | Method and device for plane correction, computer-readable medium, and electronic device | |
| WO2020244076A1 (en) | Face recognition method and apparatus, and electronic device and storage medium | |
| CN110610178A (en) | Image recognition method, device, terminal and computer-readable storage medium |