1375787 九、發明說明: 【發明所屬之技術領域】 種測量物體尺 本發明涉及一種電子設備,尤其涉及一 寸的電子設備及方法。 【先前技術】 照相利用的係針孔成像原理,並使用感光介質而保存 影像。物體依據針孔成像原㈣過相機的鏡頭後投射到如 底片、感光耦合元件或互補性氧化金屬半導體等感光介質 上,從而能夠在拍攝後將物體的光線記錄下來,並可透過 光學或數位流程轉換為影像。 ^ 然而,現在攝像裝置並沒有辦法從照相機拍攝後所產 生的影像得知物體的實際尺寸。所以,若遇到需要標示尺 寸作為參考依據的物體,通常會在拍攝時在被測物體的附 近放置一個可以作為長度參考依據的參考物體,例如尺或 常用的硬幣等。這種方法無法直接得到被測物體的實際尺 鲁寸,由此造成了使用上的不便。 【發明内容】 有鑒於此’有必要提供一種可直接測量物體尺寸的電 子設備及方法。 一種電子設備,其包括鏡頭模組、第一測距裝置、第 二測距裝置、影像感測器、處理器及記憶體。所述第一測 距裝置用於測量被測物體的物距,第二測距裝置用於測量 所述被測物體的像距。所述影像感測器具有成像區,所述 記憶體用於存儲所述成像區複數個方向上的邊界間距。所 7 1375787 述處理器包括:方向選取模塊,用於選取特定方向 疋方向過料成㈣幾何巾^ ;雜餘模塊 ^ =物距及所述像距;像尺寸獲取模塊,用於當所 t疋;!向填滿所述影像感測器的成像㈣,根據所述料 曰距仔出所述像沿特定方向的像尺寸;視角計算模塊,用 於根據所述像距及所述像沿特定方㈣像尺寸計算 物體沿特定方向的視角;物體尺寸計算模塊,用於根據所1375787 IX. Description of the Invention: [Technical Field of the Invention] The present invention relates to an electronic device, and more particularly to an inch electronic device and method. [Prior Art] The principle of pinhole imaging for photographing is used, and the image is stored using a photosensitive medium. The object is imaged according to the pinhole imaging original (4) and then projected onto a photosensitive medium such as a negative film, a photosensitive coupling element or a complementary metal oxide semiconductor, so that the light of the object can be recorded after the shooting, and the optical or digital process can be performed. Convert to image. ^ However, there is currently no way for the camera to know the actual size of the object from the image produced after the camera was taken. Therefore, if you encounter an object that needs to be labeled as a reference, a reference object that can be used as a reference for length, such as a ruler or a commonly used coin, is usually placed near the object to be measured at the time of shooting. This method cannot directly obtain the actual size of the object to be measured, thereby causing inconvenience in use. SUMMARY OF THE INVENTION In view of the above, it is necessary to provide an electronic device and method that can directly measure the size of an object. An electronic device includes a lens module, a first ranging device, a second ranging device, an image sensor, a processor, and a memory. The first distance measuring device is for measuring an object distance of the measured object, and the second distance measuring device is for measuring an image distance of the measured object. The image sensor has an imaging area for storing a boundary spacing in a plurality of directions of the imaging area. 7 1375787 The processor includes: a direction selection module for selecting a specific direction 过 direction to pass through (4) a geometric towel ^; a redundant module ^ = object distance and the image distance; an image size acquisition module, used to be Imaging the image sensor (4), filling the image size of the image in a specific direction according to the material distance; a viewing angle calculation module for specifying the image distance and the image edge according to the image The square (four) image size calculates the angle of view of the object along a specific direction; the object size calculation module is used according to the
述特定方向的視角及物距計算出所述被測物體 的物尺寸。 问 一種測量物體尺寸的方法,被測物體的像位於影像感 測器的成像區’包括以下步驟:選取經過所述成像區幾何 t心的特定方向;調整像距使得被測物體的像沿特定方向 填滿所述影像感測器的成像區;測量被測物體的像沿特定 方向的像尺寸;測量所述被測物體的像距;測量被測物體 的物距;根據所述像沿特定方向的像尺寸及像距計算出所 #述被測物體沿特定方向的視角;根據所述物距,視角計算 出被測物體沿特定方向的物尺寸。 利用本發明所提供的電子設備,無需使用參照物便可 以通過照相直接測量被測物體的尺寸,由此大大的提高了 人們使用的便利性。另外,由於本發明只需要被測物體成 的像填滿影像感測器的成像區即可,所以即使採用變焦鏡 頭也不會影響被測物體尺寸的測量,並且影像感測器成像 區的尺寸、物距、像距均直接測得,所以測量的精度高。 【實施方式】 8 1375787 • 下面將結合附圖對本發明實施方式作進一步之詳細指 述。 • · 請參閱圖1、圖2及圖3,為本發明實施方式提供的電 .子設備100,所述電子設備100可以係具有攝像功能的手 機、具有攝像功能的掌上電腦、數碼相機或數碼攝像機等。 本實施方式中’所述電子設備1〇〇為數碼相機。 所述電子設備100包括鏡頭模組1〇、第一測距裝置 鲁20、第二測距裝置30、影像感測器4〇、處理器5〇、記憶體 60及馬達70。 所述第一測距裝置20可以採用雷射、超聲波或紅外線 等測距裝置。本實施方式中,所述第一測距裝置2〇採用雷 射測距裝置來獲取被測物體1的物距u。本實施方式中採用 雷射測距裝置通過發射雷射光束至被測物體i,利用反射光 束精確計算距離,以此獲取雷射物距u,而不採用自動對焦 焦長推算出物距U’可以避免由於物距U過大導致精度下降 •的問題。因為採用自動對焦焦長推算物距U時,當被測物 體1與電子設備1〇〇之間超過一定距離時,自動對焦對影 像感測器40的調節就不再改變了’所以雖然物距u發生了 史化,但疋影像感測器4〇不再移動,而焦距也不再變化, 攸而再利用焦長推算物距u就會導致測量精度下降被測 物體1的尺寸計算不準確。 所述馬達70用於調整所述鏡頭模組10與所述影像感 測器40之間的距離。所述影像感測器40具有成像區41。 本貫施方式中,所述成像區41為矩形。所述鏡頭模組1〇 9 1375787 光學中心01與所述成像區41幾何中心〇2位於同一光軸L 上。根據成像原理當所述被測物體1的像2經過所述成像 .區41的幾何中心02,並填滿所述影像感測器4〇的成像區 .41時,即所述被測物體1的像2邊緣的兩端均接觸邊界41& 時。所述被測物體1的視角Θ1等於所述像2兩端與所述光 學中心01連接而成的三角形的頂角θ2。 所述記憶體60記憶體有所述成像區41複數個方向上 鲁的邊界間距Μ。所述邊界間距Μ可以係所述成像區竹的 寬度方向、高度方向或對角線方向的邊界間距Μ。本實施 方式中’所述邊界間距Μ為成像區41的高度方向的邊界間 距Μ,即所述成像區41的高度。所述第二測距裝置邓用 於測量當所述被測物體i的像2經過所述成像區41的幾何 中心02,並填滿所述影像感測器4〇的成像區41的高产邊 界時,所述被測物體i的像距v。本實施方式中,所述;二 測距裝置30通過讀取鏡頭模組1〇變焦時馬達7〇的 : •出所述被測物體1的像距V。 y 寸 51、距離獲取模塊 54及物體尺寸計算 所述處理器50包括方向選取模塊 52、像尺寸獲取模塊53、視角計算模塊 模塊55。 所述方向選取模塊 ^ y w心乃问A。所诚姓中 方向A通過所述成像區41的幾何中心 特疋 二可以係所述成像區41的寬度方向、高度方向 ==特定方向A係複數個方向時,就採用、= 固方向相同的步驟分別進行複數個方向的測量。本實施方 1375787 式中,所述特定方向A係過所述成像區41的幾何中心〇2 的向度方向。 所述距離獲取模塊52用於獲取所述物距u及所述像距 v。本實施方式中,所述距離獲取模塊52分別從所述第一 測距裝置20及第二測距裝置3〇獲取所述物距u及所述像 距v。 像尺寸獲取模塊53用於獲取所述像2沿特定方向A的 像尺寸。本實施方式中,所述像尺寸獲取模塊53用於當所 述像2過所述成像區41的幾何中心〇2沿特定方向a填滿 所述影像感測器40的成像區41時,根據所述邊界間距M 計算出所述像2沿特定方向A的像尺寸N。當所述邊界間 距Μ不能通過影像感測器4〇的產品規格例如高度、寬产或 對角線長度的尺寸直接得到時,由於所述特定方向^所 述成像區41幾何中^ 02,所述像尺寸獲取模塊53可以根 據特定方向A與所述成像區41的寬度方向或高度方向的夹 角及影像感測H 4G的寬度方向或高度方向的邊界間距m, 所以可以根據簡單的幾何公式換算出所述成像_沿特定 =向A的邊界間距M。本實施方式中,所述像 的幾何中心〇2在高度方向填滿所述成像㈣,所 ==度1等於所述成像區41的高度,即所述像2的 :體:二間距M。所述像尺寸獲取模塊53獲取記 隐體60存有的所述成像區41的高度。 本實施方式中,採用像2填滿成像區41 區41的邊界間距M求取像2的高度比利關元求像高= 11 1375787 好的辨識性及更高的精度。因為圖元本身很小,使用者選 取像的邊界時會有一定差別,從而造成計算時的誤差所 •以利用像2填滿成像區41比使用者直接選取像的邊界更容 易辨識。本實施方式中,成像區41的尺寸係已知的所以 直接採用成像區41的邊界間距M取代像2的尺寸進行計 算,比利用圖元數量乘以圖元大小得到像高而言進一步減 小了誤差,提高精度。 • 所述視角計算模塊54,用於根據所述像距所述像 2沿特定方向A的像尺寸N計算出所述被測物體i沿特定 方向A的視角Θ卜所述被測物體丨的視角Θ1等於所述像2 兩端與所述光學中心01連接而成的三角形的頂肖们。本 實施方式中,所述特定方向Α為高度方向。根據成像原理 及幾何關係,利用三角公式可得e2=2xa她η(Ν/(2χν)),由 於像尺寸ν等於邊界間距式轉化為θ2=2χ arctan(M/(2xv))。由於從而計算出所述被測物體1在 φ 高度方向的視角Θ1。 物體尺寸計算模塊55用於根據所述特定方向Α的視角 Θ1及^距u计异出所述被測物體丄沿特定方向a的物尺j 本實知方式中,所述特定方向A為高度方向。根據成傳 原理及幾何關係’利用三角公式Β=2χ_ (Μ,”計算出 所述被測物體1的高&。 —本實,方式中,當利用電子設備謂對被測物體1進 "f亍南度測置時,只靈搜取好〜 而&取特疋方向A為高度方向,再使得 被測物體1的像2在所汁占你「^ 隹所述成像區41過所述成像區41的幾 12 1375787 度方向上填滿成像區41,所述電子設傷簾 得的物距U、像距V、成像區41的邊界間距Μ ,測物體!的高度。當需要測量寬度時,只需選取特 =向A寬度方向。當測量其他方向時,選取不同的特定 方向A即可^對於制物體〗填滿料成像區41,可 f用者直接調整像距v使得制物體i的像2在高度方向 =所述成像區。本實施方式中,為了節約調整時間及 誕尚調整精度,採用使用者直接調整的方式。 請參閲圖4,為本發明測量物體尺寸方法的流程圖。 —步驟sno:選取經過所述成像區41幾何中心〇2的特 ^向A。本實施方式中’所述方向選取模塊51用於選取 待疋方向心所述特定方向A可以係所述成像區41的寬产 :向、高度方向或對角線方向。當所述特定方向A係複^ :方向時’就採用與測量一個方向相同的步驟分別進行複 =方向的測量。本實施方式中,所述特定方向A係所述 成像區41的高度方向。 步驟S115 :調整像距v使得被測物體i的像2沿特定 方向A填滿影像感測器4〇的成像區41。該調整可=係^ 用者直接調整像距v使得被測物體i的像2在所述成像區 41的高度方向填滿所述成像區41。本實施方式中為了 ^ 、勺調整時間及提高調整精度,採用使用者直接調整的方式。 步驟S120:測量所述被測物體i的像沿特定方向A2 的像尺寸N〇像尺寸獲取模塊53獲取所述像2沿特定方向 A的像尺寸N。本實施方式中,當所述像2過所述成像區 13 1375787 :㈣幾何中心02沿特定方向A填滿所述影像感測器扣的 成像區41時’所述像尺寸獲取模塊53根據所述邊界間距 • Μ計算出所述像2沿特定方向A的像尺寸N。冑所述邊界 .·間距Μ不能通過影像感測器40的產品規格例如高度、寬度 或對角線長度的尺寸直接得到時’由於所述特定方向Α過 所述成像區41幾何_心02,所述像尺寸獲取模塊53可以 根據特定方向A與所述成像區41的寬度方向或高度方向的 春失角及影像感測器40的寬度方向或高度方向的^界間距 Μ,所以可以根據簡單的幾何公式換算出所述成像區4ι沿 特定方向Α的邊界間距Μ。本實施方式中,所述像2過所 述成像區41的幾何中心、02在高度方向填滿所述成像區 41,所述像2的高度就等於所述成像區41的高度,即所述 像2的像尺寸Ν等於邊界間距Μ。所述像尺寸獲取模塊μ 直接獲取記憶體60存有的所述成像區41的高度作為邊界 間距Μ。 • 步驟S125 :測量所述被測物體1的像距ν ^所述距離 獲取模塊52獲取所述像距v。本實施方式中,所述距離獲 取模塊52從所述第二測距裝置30獲取所述像距v。所述^ 二測距裝置30通過讀取鏡頭模組10變焦時馬達7〇的步數 得出所述被測物體1的像距v。 步驟S130:測量所述被測物體i的物距v。所述距離 獲取模塊52獲取所述物距u。本實施方式中,所述距離獲 取模塊52從所述第一測距裝置20獲取所述物距u。所述第 測距裝置20可以採用雷射、超聲波或紅外線等測距裳 14 1375787 :置。本實施方式中,所述第一測距裝置20採用雷射測距裝 置通過發射雷射光束至被測物體i,利用反射光束精確計算 s距離,以此獲取雷射物距u,來獲取被測物體丄的物距u。 • 步驟S135:根據所述像2沿特定方向A的像尺寸N及 像距v計算出所述被測物體1沿特定方向A的視角θ。所 述被測物體1的視角Θ1等於所述像2兩端與所述光學中心 〇1連接而成的三角形的頂角θ2。本實施方式中,所述特定 鲁方向Α為高度方向。根據成像原理及幾何關係,利用三角 a式可得02=2xarctan(N/(2xv)),由於像尺寸N等於邊界間 距Μ,所以公式轉化為02=2xarctan(M/(2xv))。由於 從而計算出所述被測物體1在高度方向的視角Θ1。 ^步驟Sl40:根據所述物距u,視角Θ計算出被測物體工 沿特定方向A的物尺寸b。所述物體尺寸計算模塊%根據 戶=述特定方向A的視角θ及物距u計算出所述被測物體1 沿特定方向A的物尺寸B。本實施方式中,所述特定方向 籲A為高度方向。根據成像原理及幾何關係,利用公式 uxtan ( Θ/2 )計算出所述被測物體丄的高度。 所述步驟S120到步驟S130可以不分先後順序,或同 時進行。 利用本發明所提供的電子設備,無需使用參照物便可 以通過照相直接測量被測物體的尺寸,由此大大的提高了 人們使用的便利性。另外,由於本發明只需要被測物體成 的像填滿影像感測器,而焦距的改變對於計算沒有影響, 所以即使採用變焦鏡頭也不會影響被測物體尺寸的測量。 15 1375787 並且影像感測器成像區的尺寸、物距、彳条 了物距像距均直接測得, 所以測量的精度高。 ^ 综上所述,本發明確已符合發明專利之要件,遂依法 ^出專利申請。惟,以上所述者僅為本發明之較佳實施方 式^自不能以此限制本案之申請專利範圍。舉凡熟悉本案 技藝之人士援依本發明之精神所作之等效修飾或變化,皆 應涵蓋於以下申請專利範圍内。 【圖式簡單說明】 圖1為本發明實施方式提供之電子設備的硬體架構圖; 圖2為本發明實施方式提供之電子設備測量物體尺寸 示意圖; 圖3為本發明實施方式提供之電子設備處理器之功能 模塊圖; 圖4為本發明實施方式提供之電子設備測量物體尺寸 之方法流程圖。 φ 【主要元件符號說明】 電子設備 100 被測物體 1 像 2 鏡頭模組 10 第一測距裝置 20 第二測距裝置 30 影像感測器 40 成像區 41 邊界 41a 處理器 50 方向選取模塊 51 距離獲取模塊 52 像尺寸獲取模塊 53 視角計算模塊 54 物體尺寸計算模塊 55 記憶體 60 16 1375787 70 馬達The object size of the object to be measured is calculated from the angle of view and the object distance in a specific direction. A method for measuring the size of an object, the image of the object to be measured is located in the imaging area of the image sensor' includes the following steps: selecting a specific direction passing through the geometric center of the imaging area; adjusting the image distance so that the image of the object to be measured is specific Filling the imaging area of the image sensor; measuring the image size of the image of the object to be measured along a specific direction; measuring the image distance of the measured object; measuring the object distance of the measured object; The image size of the direction and the image distance calculate the angle of view of the measured object in a specific direction; according to the object distance, the angle of view calculates the object size of the measured object in a specific direction. With the electronic device provided by the present invention, the size of the object to be measured can be directly measured by photographing without using a reference object, thereby greatly improving the convenience of use. In addition, since the invention only needs the image formed by the object to be filled to fill the imaging area of the image sensor, even if the zoom lens is used, the measurement of the size of the object to be measured is not affected, and the size of the imaging area of the image sensor is The object distance and the image distance are directly measured, so the measurement accuracy is high. [Embodiment] 8 1375787 • Embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Please refer to FIG. 1 , FIG. 2 and FIG. 3 , which are an electrical sub-device 100 according to an embodiment of the present invention. The electronic device 100 can be a mobile phone with a camera function, a handheld computer with a camera function, a digital camera or a digital device. Camera, etc. In the present embodiment, the electronic device 1 is a digital camera. The electronic device 100 includes a lens module 1A, a first distance measuring device Lu 20, a second distance measuring device 30, an image sensor 4A, a processor 5A, a memory 60, and a motor 70. The first distance measuring device 20 may employ a distance measuring device such as laser, ultrasonic or infrared. In the present embodiment, the first distance measuring device 2 uses a laser ranging device to acquire the object distance u of the object 1 to be measured. In the embodiment, the laser ranging device is used to transmit the laser beam to the measured object i, and the distance is accurately calculated by using the reflected beam, thereby obtaining the laser object distance u without using the autofocus focal length to calculate the object distance U'. It is possible to avoid the problem that the accuracy is degraded due to the excessive distance U of the object. Since the object distance U is estimated by using the autofocus focal length, when the measured object 1 and the electronic device 1〇〇 exceed a certain distance, the adjustment of the autofocus to the image sensor 40 is no longer changed. u has undergone history, but the image sensor 4〇 no longer moves, and the focal length does not change any more. The use of the focal length to calculate the object distance u will result in a decrease in measurement accuracy. The size of the measured object 1 is not accurately calculated. . The motor 70 is used to adjust the distance between the lens module 10 and the image sensor 40. The image sensor 40 has an imaging area 41. In the present embodiment, the imaging area 41 is rectangular. The lens module 1 〇 9 1375787 optical center 01 is located on the same optical axis L as the geometric center 〇 2 of the imaging region 41. According to the imaging principle, when the image 2 of the object 1 to be measured passes through the geometric center 02 of the imaging region 41 and fills the imaging region 41 of the image sensor 4, that is, the object 1 to be measured Both ends of the edge like 2 are in contact with the boundary 41& The angle of view Θ1 of the object 1 to be measured is equal to the apex angle θ2 of the triangle formed by connecting the ends of the image 2 to the optical center 01. The memory 60 memory has a boundary interval Μ of a plurality of directions in the imaging region 41. The boundary spacing Μ may be a boundary distance Μ between the width direction, the height direction, or the diagonal direction of the bamboo of the imaging area. In the present embodiment, the boundary pitch Μ is the boundary pitch 高度 of the height direction of the imaging region 41, that is, the height of the imaging region 41. The second ranging device Deng is used to measure when the image 2 of the measured object i passes through the geometric center 02 of the imaging region 41 and fills the high-yield boundary of the imaging region 41 of the image sensor 4 The image distance v of the measured object i. In the present embodiment, the second ranging device 30 reads the lens module 1 〇 during zooming of the motor 7〇: • the image distance V of the object 1 to be measured. y 51, distance acquisition module 54 and object size calculation The processor 50 includes a direction selection module 52, an image size acquisition module 53, and a perspective calculation module module 55. The direction selection module ^ y w heart is A. The direction A of the image in the direction of the image of the imaging area 41 may be the same as the width direction of the imaging area 41, the direction of the height == the specific direction A, and the same direction is used. The steps are performed in a plurality of directions. In the embodiment 1375787, the specific direction A is the direction of the dimension of the geometric center 〇2 of the imaging zone 41. The distance obtaining module 52 is configured to acquire the object distance u and the image distance v. In the embodiment, the distance acquiring module 52 acquires the object distance u and the image distance v from the first ranging device 20 and the second ranging device 3, respectively. The image size acquisition module 53 is configured to acquire the image size of the image 2 in a specific direction A. In this embodiment, the image size obtaining module 53 is configured to: when the image 2 passes through the geometric center 〇2 of the imaging area 41 to fill the imaging area 41 of the image sensor 40 in a specific direction a, according to The boundary spacing M calculates the image size N of the image 2 in a particular direction A. When the boundary spacing Μ cannot be directly obtained by the product specification of the image sensor 4, such as the height, the width, or the diagonal length, the imaging area 41 is geometrically located due to the specific direction. The image size obtaining module 53 can sense the boundary distance m between the width direction or the height direction of the H 4G according to the angle between the specific direction A and the width direction or the height direction of the imaging area 41, and thus can be based on a simple geometric formula. The boundary value M of the image_ along the specific = direction A is converted. In this embodiment, the geometric center 〇2 of the image fills the image (4) in the height direction, and == degree 1 is equal to the height of the image forming area 41, that is, the body 2: two spaces M. The image size acquisition module 53 acquires the height of the imaging area 41 in which the cryptogram 60 is stored. In the present embodiment, the boundary distance M of the image area 41 is filled with the image 2 to obtain the height of the image 2, and the image height is higher than 11 1375787, and the accuracy is higher. Since the primitive itself is small, there is a certain difference in the user's choice of the boundary of the image, which causes errors in the calculation. • The image area 41 is filled with the image 2 and is more easily discernible than the boundary of the user directly selecting the image. In the present embodiment, the size of the imaging region 41 is known, so that the boundary spacing M of the imaging region 41 is directly used instead of the size of the image 2, which is further reduced by multiplying the number of primitives by the size of the primitive to obtain the image height. The error is increased and the accuracy is improved. The viewing angle calculation module 54 is configured to calculate, according to the image size N of the image 2 in the specific direction A, the angle of view of the measured object i along a specific direction A, the object to be measured The angle of view Θ1 is equal to the top of the triangle formed by the ends of the image 2 being connected to the optical center 01. In the embodiment, the specific direction Α is a height direction. According to the imaging principle and geometric relationship, the triangle formula can be used to obtain e2=2xa her η(Ν/(2χν)), because the image size ν is equal to the boundary spacing formula and is converted to θ2=2χ arctan(M/(2xv)). Thereby, the angle of view Θ1 of the object 1 to be measured in the height direction of φ is calculated. The object size calculation module 55 is configured to, according to the angle of view Θ1 and the distance u of the specific direction 异, the object size of the object to be measured 丄 along a specific direction a. In the known manner, the specific direction A is a height. direction. According to the principle of transmission and the geometric relationship, 'the triangle formula Β=2χ_ (Μ," is used to calculate the height of the object 1 to be measured. - In this way, when using the electronic device, the object to be measured is entered into the " When f is used for southing, the only thing is to search for ~ and & take the direction of the special direction A as the height direction, and then make the image 2 of the measured object 1 occupy the image area 41 of the "^ 隹The image forming area 41 is filled with the imaging area 41 in a direction of 12 1375787 degrees, and the distance between the object distance U, the image distance V, and the imaging area 41 is measured, and the height of the object is measured. When measuring the width, it is only necessary to select the direction of the width direction of A. When measuring other directions, select a different specific direction A to fill the image imaging area 41 for the object, and the user can directly adjust the image distance v. The image 2 of the object i is in the height direction = the image forming area. In the present embodiment, in order to save the adjustment time and the adjustment accuracy of the birthday, the user directly adjusts the method. Referring to FIG. 4, the object size is measured according to the present invention. Flow chart of the method. - Step sno: selection through the geometry of the imaging zone 41 In the present embodiment, the direction selection module 51 is configured to select the direction of the to-be-centered direction, and the specific direction A may be the wide product of the imaging area 41: direction, height direction or diagonal Direction: When the specific direction A is complex: the direction is measured by the same step as measuring one direction, respectively. In the present embodiment, the specific direction A is the height of the imaging area 41. Step S115: Adjusting the image distance v so that the image 2 of the measured object i fills the imaging area 41 of the image sensor 4A in a specific direction A. The adjustment can be directly adjusted by the user to adjust the image distance v so that the image is measured The image 2 of the object i fills the image forming area 41 in the height direction of the image forming area 41. In the present embodiment, in order to adjust the time and improve the adjustment precision, the user directly adjusts the method. Step S120: Measuring station The image size N〇 image size acquiring module 53 of the image of the measured object i in the specific direction A2 acquires the image size N of the image 2 along the specific direction A. In the present embodiment, when the image 2 passes the imaging area 13 1375787 : (d) Geometry Center 02 fills in a specific direction A When the image sensor 41 of the image sensor buckles, the image size acquisition module 53 calculates the image size N of the image 2 along the specific direction A according to the boundary spacing 胄. The boundary · cannot pass When the product specification of the image sensor 40, such as the height, the width, or the diagonal length, is directly obtained, the image size acquisition module 53 may be specific according to the specific direction traversing the imaging area 41 geometry_heart 02. The direction A is offset from the width direction or the height direction of the imaging area 41 and the width direction or the height direction of the image sensor 40, so that the imaging area 4 can be converted according to a simple geometric formula. The boundary spacing Α in a particular direction Μ. In this embodiment, the image 2 passes through the geometric center of the imaging area 41, 02 fills the imaging area 41 in the height direction, and the height of the image 2 is equal to the height of the imaging area 41, that is, the Image size 像 like 2 is equal to the boundary spacing Μ. The image size acquisition module μ directly acquires the height of the image forming area 41 stored in the memory 60 as the boundary pitch Μ. • Step S125: Measuring the image distance ν of the measured object 1 The distance acquiring module 52 acquires the image distance v. In this embodiment, the distance obtaining module 52 acquires the image distance v from the second ranging device 30. The second distance measuring device 30 obtains the image distance v of the measured object 1 by reading the number of steps of the motor 7〇 when the lens module 10 is zoomed. Step S130: Measuring the object distance v of the measured object i. The distance acquisition module 52 acquires the object distance u. In the embodiment, the distance obtaining module 52 acquires the object distance u from the first distance measuring device 20. The first distance measuring device 20 can adopt a laser, ultrasonic or infrared light ranging skirt 14 1375787: set. In this embodiment, the first ranging device 20 uses a laser ranging device to acquire a laser beam to the measured object i, and accurately calculates the s distance by using the reflected beam, thereby acquiring the laser object distance u to obtain the Measure the object distance u of the object. • Step S135: Calculate the angle of view θ of the measured object 1 along the specific direction A according to the image size N and the image distance v of the image 2 in the specific direction A. The angle of view Θ1 of the object 1 to be measured is equal to the apex angle θ2 of the triangle formed by connecting the ends of the image 2 to the optical center 〇1. In this embodiment, the specific Lu direction is the height direction. According to the imaging principle and geometric relationship, using the triangle a formula, 02=2xarctan(N/(2xv)) is obtained. Since the image size N is equal to the boundary distance Μ, the formula is converted to 02=2xarctan(M/(2xv)). Thereby, the angle of view Θ1 of the object 1 to be measured in the height direction is calculated. [Step S40: According to the object distance u, the angle of view Θ calculates the object size b of the object to be measured along a specific direction A. The object size calculation module % calculates the object size B of the object 1 to be measured in a specific direction A according to the angle of view θ of the specific direction A and the object distance u. In the present embodiment, the specific direction A is the height direction. According to the imaging principle and geometric relationship, the height of the measured object 丄 is calculated by the formula uxtan ( Θ/2 ). The steps S120 to S130 may be performed in no particular order or simultaneously. With the electronic device provided by the present invention, the size of the object to be measured can be directly measured by photographing without using a reference object, thereby greatly improving the convenience of use. In addition, since the present invention only needs the image of the object to be measured to fill the image sensor, and the change of the focal length has no influence on the calculation, even if the zoom lens is used, the measurement of the size of the object to be measured is not affected. 15 1375787 And the size of the imaging area of the image sensor, the object distance, and the object distance of the image are directly measured, so the measurement accuracy is high. ^ In summary, the present invention has indeed met the requirements of the invention patent, and patent application is legally required. However, the above description is only a preferred embodiment of the present invention, and the scope of the patent application of the present invention is not limited thereto. Equivalent modifications or variations made by persons skilled in the art in light of the present invention are intended to be included within the scope of the following claims. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a hardware structural diagram of an electronic device according to an embodiment of the present invention; FIG. 2 is a schematic diagram of an electronic device measuring object according to an embodiment of the present invention; FIG. 3 is an electronic device according to an embodiment of the present invention. Functional block diagram of a processor; FIG. 4 is a flow chart of a method for measuring an object size of an electronic device according to an embodiment of the present invention. Φ [Description of main component symbols] Electronic device 100 Object to be measured 1 Image 2 Lens module 10 First distance measuring device 20 Second distance measuring device 30 Image sensor 40 Imaging area 41 Boundary 41a Processor 50 Direction selection module 51 Distance Acquisition module 52 image size acquisition module 53 perspective calculation module 54 object size calculation module 55 memory 60 16 1375787 70 motor
1717