CN106123784A - Method and device for measuring length - Google Patents
Method and device for measuring length Download PDFInfo
- Publication number
- CN106123784A CN106123784A CN201610584390.0A CN201610584390A CN106123784A CN 106123784 A CN106123784 A CN 106123784A CN 201610584390 A CN201610584390 A CN 201610584390A CN 106123784 A CN106123784 A CN 106123784A
- Authority
- CN
- China
- Prior art keywords
- length
- pixels
- distance
- measured
- screen
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/02—Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Length Measuring Devices By Optical Means (AREA)
Abstract
本发明适用计算机技术领域,提供了一种测量长度的方法及装置,所述方法包括:获取基准物在距离d时,基准物的长度所占屏幕中对应的像素点个数n;获取待测物的距离D,及待测物的长度所占屏幕中像素点个数N;将所述距离D与所述距离d进行匹配,得到对应的像素点个数n;根据匹配得到的所述像素点个数n、所述待测物的长度所占屏幕中像素点个数N、以及所述基准物的长度l,得到所述待测物的长度L。本发明在不同距离下获取基准物的长度所对应的像素点个数,根据待测物距离摄像头的距离,找到与基准物在同样距离下所对应的像素点个数,由此计算出待测物的长度,提高了测量的便捷性、测量精度以及减少测量误差。
The present invention is applicable to the field of computer technology, and provides a method and device for measuring length. The method includes: obtaining the number n of pixels corresponding to the length of the reference object in the screen occupied by the reference object at a distance d; obtaining the number of pixels to be measured The distance D of the object, and the number N of pixels in the screen occupied by the length of the object to be measured; the distance D is matched with the distance d to obtain the corresponding number of pixels n; the pixel points obtained according to the matching The number n of points, the number N of pixels on the screen occupied by the length of the object to be measured, and the length l of the reference object are used to obtain the length L of the object to be measured. The present invention obtains the number of pixels corresponding to the length of the reference object at different distances, and finds the number of pixels corresponding to the reference object at the same distance according to the distance between the object to be measured and the camera, thereby calculating the number of pixels to be measured The length of the object improves the convenience and accuracy of the measurement and reduces the measurement error.
Description
技术领域technical field
本发明属于计算机技术领域,尤其涉及一种测量长度的方法及装置。The invention belongs to the technical field of computers, in particular to a method and device for measuring length.
背景技术Background technique
生活中有很多场景下都有测量物体长度的需求,通常方式是使用一把尺子去测量,但在互联网时代,移动终端是每个家庭的必备,而且手机的使用已经覆盖到很大一部分人群,相反传统的尺子已经很难找到。There are many scenarios in life where there is a need to measure the length of an object. The usual way is to use a ruler to measure, but in the Internet age, mobile terminals are a must for every family, and the use of mobile phones has covered a large part of the population. , on the contrary, traditional rulers are hard to find.
目前利用移动终端设备进行测量物体长度的方法是移动终端内置的加速度传感器和计时器,通过加速移动移动终端来计算出物体长度,但是这种方法有很多弊端,如:在测量某个物体时必须要快速移动装置来获取加速度,而且在测量直线距离的时候误差较大,因为无法保证用户也是直线移动装置,还有最大的一个限制是必须要贴近所测量的物体进行移动测量。At present, the method of using mobile terminal equipment to measure the length of an object is the built-in acceleration sensor and timer of the mobile terminal, and the length of the object is calculated by accelerating the mobile terminal. However, this method has many disadvantages, such as: when measuring an object, it must It is necessary to move the device quickly to obtain the acceleration, and the error is large when measuring the linear distance, because there is no guarantee that the user is also moving the device in a straight line, and the biggest limitation is that the moving measurement must be close to the measured object.
发明内容Contents of the invention
本发明的目的在于提供一种测量长度的方法及装置,旨在解决现有技术中需要在待测物上移动终端设备进行测量所造成的测量方式繁琐、测量误差大的问题。The purpose of the present invention is to provide a method and device for measuring length, aiming to solve the problems in the prior art that the measurement method is cumbersome and the measurement error is large caused by the need to measure the object with a mobile terminal device.
一方面,本发明提供了一种测量长度的方法,所述方法包括下述步骤:In one aspect, the present invention provides a method of measuring length, said method comprising the steps of:
获取基准物在距离d时,所述基准物的长度所占屏幕中对应的像素点个数n,所述基准物为已知长度l的物体,所述距离d为基准物至摄像头的距离;When obtaining the reference object at a distance d, the length of the reference object occupies the corresponding pixel number n in the screen, the reference object is an object of known length l, and the distance d is the distance from the reference object to the camera;
获取待测物的距离D,及所述待测物的长度所占屏幕中像素点个数N,所述距离D为待测物至摄像头的距离;Obtain the distance D of the object to be measured, and the number N of pixels in the screen occupied by the length of the object to be measured, and the distance D is the distance from the object to be measured to the camera;
将所述距离D与所述距离d进行匹配,得到对应的像素点个数n;Matching the distance D with the distance d to obtain the corresponding number n of pixels;
根据匹配得到的所述像素点个数n、所述待测物的长度所占屏幕中像素点个数N、以及所述基准物的长度l,得到所述待测物的长度L。According to the number n of pixels obtained through matching, the number N of pixels in the screen occupied by the length of the object under test, and the length l of the reference object, the length L of the object under test is obtained.
另一方面,本发明提供了一种测量长度的装置,所述装置包括:In another aspect, the present invention provides a device for measuring length, said device comprising:
像素点个数n获取单元,用于获取基准物在距离d时,所述基准物的长度所占屏幕中对应的像素点个数n,所述基准物为已知长度l的物体,所述距离d为基准物至摄像头的距离;The acquisition unit for the number of pixels n is used to obtain the number n of pixels corresponding to the length of the reference object in the screen when the reference object is at a distance d, the reference object is an object with a known length l, the The distance d is the distance from the reference object to the camera;
像素点个数N获取单元,用于获取待测物的距离D,及所述待测物的长度所占屏幕中像素点个数N,所述距离D为待测物至摄像头的距离;The acquisition unit for the number of pixels N is used to obtain the distance D of the object to be measured, and the number N of pixels in the screen occupied by the length of the object to be measured, and the distance D is the distance from the object to be measured to the camera;
匹配单元,用于将所述距离D与所述距离d进行匹配,得到对应的像素点个数n;以及A matching unit, configured to match the distance D with the distance d to obtain a corresponding number n of pixels; and
待测物长度计算单元,用于根据匹配得到的所述像素点个数n、所述待测物的长度所占屏幕中像素点个数N、以及所述基准物的长度l,得到所述待测物的长度L。The length calculation unit of the object to be measured is used to obtain the number of pixels n obtained by matching, the number N of pixels in the screen occupied by the length of the object to be measured, and the length l of the reference object to obtain the The length L of the object to be measured.
在本发明实施例中,在不同距离下获取基准物的长度所对应的像素点个数,以此作为匹配数据,在测量物体长度时,根据待测物距离摄像头的距离,找到与基准物在同样距离下所对应的像素点个数,由此计算出待测物的长度,其有益效果在于无需通过移动终端设备获取待测物的长度,提高了测量的便捷性、测量精度以及减少测量误差。In the embodiment of the present invention, the number of pixels corresponding to the length of the reference object is obtained at different distances as matching data. The number of pixels corresponding to the same distance is used to calculate the length of the object to be measured. The beneficial effect is that there is no need to obtain the length of the object to be measured through the mobile terminal device, which improves the convenience of measurement, measurement accuracy and reduces measurement errors. .
附图说明Description of drawings
图1是本发明实施例一提供的测量长度的方法的实现流程图;以及Fig. 1 is the implementation flowchart of the method for measuring length provided by Embodiment 1 of the present invention; and
图2是本发明实施例二提供的测量长度的装置的结构示意图。Fig. 2 is a schematic structural diagram of the length measuring device provided by Embodiment 2 of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
以下结合具体实施例对本发明的具体实现进行详细描述:The specific realization of the present invention is described in detail below in conjunction with specific embodiment:
实施例一:Embodiment one:
图1示出了本发明实施例一提供的测量长度的方法的实现流程图,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:Fig. 1 shows the implementation flowchart of the method for measuring length provided by Embodiment 1 of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
在步骤S101中,获取基准物在距离d时,基准物的长度所占屏幕中对应的像素点个数n。In step S101, when the reference object is at a distance d, the number n of pixels corresponding to the length of the reference object in the screen is obtained.
在本发明实施例中,基准物为已知长度l的物体,距离d为基准物至摄像头的距离,另外,用户根据自身的需要,可以选择适当长度的物体作为基准物,例如,需要经常需要测量较长的物体,可以选择较长的物体作为基准物。In the embodiment of the present invention, the reference object is an object of known length l, and the distance d is the distance from the reference object to the camera. In addition, users can choose an object of appropriate length as the reference object according to their own needs. To measure a longer object, you can choose a longer object as a reference object.
在本发明实施例中,利用终端设备上的摄像头采集基准物的图像,显示在终端设备的屏幕上,并通过在终端设备上设置距离传感器,获取基准物距离摄像头的距离,由此可以得到在不同的距离d下对应的基准物的长度所占屏幕中对应的像素点个数n,将这些一一对应的数据进行存储,以便计算待测物长度。In the embodiment of the present invention, the camera on the terminal device is used to collect the image of the reference object, and the image is displayed on the screen of the terminal device, and the distance between the reference object and the camera is obtained by setting a distance sensor on the terminal device, so that the distance between the reference object and the camera can be obtained. The length of the corresponding reference object under different distances d occupies the corresponding number n of pixels on the screen, and these one-to-one corresponding data are stored to calculate the length of the object to be measured.
进一步地,为了获取到更加完整的数据,需要最大程度的获取到不同距离d所对应基准物的长度所占屏幕中对应的像素点个数n,可以如下方式实现:Further, in order to obtain more complete data, it is necessary to obtain the maximum number of pixels n in the screen occupied by the length of the reference object corresponding to the different distance d, which can be achieved in the following way:
依次从基准物的长度所占屏幕中的像素点个数为最大值时起始捕捉,至基准物的长度所占屏幕中的像素点个数为最小值时截止;或者Sequentially start capturing when the number of pixels on the screen occupied by the length of the reference object is the maximum value, and stop when the number of pixels on the screen occupied by the length of the reference object is the minimum value; or
依次从基准物的长度所占屏幕中的像素点个数为最小值时起始捕捉,至基准物的长度所占屏幕中的像素点个数为最大值时截止。The capture starts when the number of pixels on the screen occupied by the length of the reference object is the minimum, and ends when the number of pixels on the screen occupied by the length of the reference object reaches the maximum.
具体地,上述两种获取在距离d时基准物的长度所占屏幕中对应的像素点个数n的方法,是通过利用摄像头获取基准物在屏幕上呈现的临界值实现的,这还取决用户在获取数据时的使用习惯,例如,对于使用横屏进行采集的方式,其在屏幕上对应显示的像素点个数会多于使用竖屏进行采集的方式。因此,为了提高数据的完整性,以及提高后面的测量精度可以采用横屏的采集方式。Specifically, the above two methods of obtaining the number n of pixels corresponding to the length of the reference object on the screen occupied by the distance d are realized by using the camera to obtain the critical value of the reference object presented on the screen, which also depends on the user The usage habits when acquiring data, for example, for the method of collecting with a horizontal screen, the number of corresponding display pixels on the screen will be more than that of using a vertical screen for collection. Therefore, in order to improve the integrity of the data and improve the accuracy of subsequent measurements, a horizontal screen acquisition method can be adopted.
在步骤S102中,获取待测物的距离D,及待测物的长度所占屏幕中像素点个数N。In step S102, the distance D of the object under test and the number N of pixels on the screen occupied by the length of the object under test are acquired.
具体地,根据距离传感器获取待测物的距离D;Specifically, the distance D of the object to be measured is obtained according to the distance sensor;
获取屏幕上触摸点的坐标位置,以确定待测物长度的计算范围;Obtain the coordinate position of the touch point on the screen to determine the calculation range of the length of the object to be measured;
根据待测物长度的计算范围,计算待测物长度所占屏幕中像素点个数N。According to the calculation range of the length of the object to be measured, calculate the number N of pixels in the screen occupied by the length of the object to be measured.
在本发明实施例中,在获取到基准物的数据后,可以开始测量待测物的长度,通过终端设备上的距离传感器获取待测物到摄像头的距离,得到距离D;此时,摄像头采集到待测物的图像,并显示在终端设备的屏幕上,为了增加测量的准确性,减少计算量以及快速找到计算对象(即待测物),通过用户在屏幕上点击选取需要测量的待测长度的计算范围,由此,根据用户选取的需要测量的待测长度的计算范围,精准地计算待测物长度所占屏幕中像素点个数N。In the embodiment of the present invention, after obtaining the data of the reference object, the length of the object to be measured can be measured, and the distance from the object to be measured to the camera can be obtained through the distance sensor on the terminal device to obtain the distance D; at this time, the camera collects The image of the object to be tested is displayed on the screen of the terminal device. In order to increase the accuracy of measurement, reduce the amount of calculation and quickly find the calculation object (that is, the object to be measured), the user clicks on the screen to select the object to be measured The calculation range of the length, thus, according to the calculation range of the length to be measured selected by the user, the number N of pixels in the screen occupied by the length of the object to be measured is accurately calculated.
进一步地,获取屏幕上触摸点的坐标位置,以确定待测物长度的计算范围,具体为:Further, obtain the coordinate position of the touch point on the screen to determine the calculation range of the length of the object to be measured, specifically:
在屏幕上检测第一触摸点,并获取第一触摸点的坐标位置;Detect the first touch point on the screen, and obtain the coordinate position of the first touch point;
在屏幕上检测第二触摸点,并获取第二触摸点的坐标位置;Detecting the second touch point on the screen, and obtaining the coordinate position of the second touch point;
根据第一触摸点的坐标位置以及第二触摸点的坐标位置,确定待测物长度的计算范围。According to the coordinate position of the first touch point and the coordinate position of the second touch point, the calculation range of the length of the object under test is determined.
具体地,用户在屏幕上选取需要测量的待测长度的计算范围时,可以分别点击需要量测长度的起点和终端,当用户点击需要量测长度的起点时,在屏幕上检测第一触摸点,并获取第一触摸点的坐标位置,当用户点击需要量测长度的终端时,在屏幕上检测第二触摸点,并获取第二触摸点的坐标位置;根据第一触摸点的坐标位置以及第二触摸点的坐标位置,确定待测物长度的计算范围。Specifically, when the user selects the calculation range of the length to be measured that needs to be measured on the screen, he can click the starting point and the terminal of the length to be measured respectively. When the user clicks the starting point of the length to be measured, the first touch point is detected on the screen. , and obtain the coordinate position of the first touch point, when the user clicks on the terminal that needs to measure the length, detect the second touch point on the screen, and obtain the coordinate position of the second touch point; according to the coordinate position of the first touch point and The coordinate position of the second touch point determines the calculation range of the length of the object to be measured.
在步骤S103中,将距离D与距离d进行匹配,得到对应的像素点个数n。In step S103, the distance D is matched with the distance d to obtain the corresponding number n of pixels.
在本发明实施例中,当获取到待测物的距离D时,与之前存储的基准物的数据进行匹配,找到与待测物的距离D相等的距离d,当匹配到相等的距离d时,得到在距离d时基准物的长度所占屏幕中对应的像素点个数n。In the embodiment of the present invention, when the distance D of the object to be measured is obtained, it is matched with the data of the previously stored reference object to find a distance d equal to the distance D of the object to be measured. , to obtain the corresponding pixel number n in the screen occupied by the length of the reference object at the distance d.
在步骤S104中,根据匹配得到的像素点个数n、待测物的长度所占屏幕中像素点个数N、以及基准物的长度l,得到待测物的长度L。In step S104, the length L of the object to be tested is obtained according to the number n of pixels obtained by matching, the number N of pixels in the screen occupied by the length of the object to be tested, and the length l of the reference object.
在本发明实施例中,待测物的长度L的计算公式为:待测物的长度 In the embodiment of the present invention, the calculation formula of the length L of the test object is: the length of the test object
在本发明实施例中,在不同距离下获取基准物的长度所对应的像素点个数,以此作为匹配数据,在测量物体长度时,根据待测物距离摄像头的距离,找到与基准物在同样距离下所对应的像素点个数,由此计算出待测物的长度,无需通过移动终端设备获取待测物的长度,提高了测量的便捷性、测量精度以及减少测量误差。In the embodiment of the present invention, the number of pixels corresponding to the length of the reference object is obtained at different distances as matching data. The number of pixels corresponding to the same distance is used to calculate the length of the object to be measured, without the need to obtain the length of the object to be measured through a mobile terminal device, which improves the convenience and accuracy of measurement and reduces measurement errors.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可读取存储介质中,所述的存储介质,如ROM/RAM、磁盘、光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage Media such as ROM/RAM, magnetic disk, optical disk, etc.
实施例二:Embodiment two:
图2示出了本发明实施例二提供的测量长度的装置的结构示意图,为了便于说明,仅示出了与本发明实施例相关的部分。在本发明实施例中,测量长度的装置包括:像素点个数n获取单元21,像素点个数N获取单元22,匹配单元23以及待测物长度计算单元24,其中:Fig. 2 shows a schematic structural view of the length measuring device provided by Embodiment 2 of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown. In the embodiment of the present invention, the device for measuring length includes: an acquisition unit 21 for the number of pixels n, an acquisition unit 22 for the number N of pixels, a matching unit 23, and a length calculation unit 24 of the object to be measured, wherein:
像素点个数n获取单元21,用于获取基准物在距离d时,基准物的长度所占屏幕中对应的像素点个数n,基准物为已知长度l的物体,距离d为基准物至摄像头的距离。The number of pixels n acquisition unit 21 is used to obtain the number n of pixels corresponding to the length of the reference object in the screen when the reference object is at a distance d, the reference object is an object with a known length l, and the distance d is the reference object distance to the camera.
在本发明实施例中,基准物为已知长度l的物体,距离d为基准物至摄像头的距离,另外,用户根据自身的需要,可以选择适当长度的物体作为基准物,例如,需要经常需要测量较长的物体,可以选择较长的物体作为基准物。In the embodiment of the present invention, the reference object is an object of known length l, and the distance d is the distance from the reference object to the camera. In addition, users can choose an object of appropriate length as the reference object according to their own needs. To measure a longer object, you can choose a longer object as a reference object.
在本发明实施例中,利用终端设备上的摄像头采集基准物的图像,显示在终端设备的屏幕上,并通过在终端设备上设置距离传感器,获取基准物距离摄像头的距离,由此可以得到在不同的距离d下对应的基准物的长度所占屏幕中对应的像素点个数n,将这些一一对应的数据进行存储,以便计算待测物长度。In the embodiment of the present invention, the camera on the terminal device is used to collect the image of the reference object, and the image is displayed on the screen of the terminal device, and the distance between the reference object and the camera is obtained by setting a distance sensor on the terminal device, so that the distance between the reference object and the camera can be obtained. The length of the corresponding reference object under different distances d occupies the corresponding number n of pixels on the screen, and these one-to-one corresponding data are stored to calculate the length of the object to be measured.
其中,像素点个数n获取单元21包括:Wherein, the pixel number n acquisition unit 21 includes:
第一获取单元,用于依次从基准物的长度所占屏幕中的像素点个数为最大值时起始捕捉,至基准物的长度所占屏幕中的像素点个数为最小值时截止;以及The first acquisition unit is used to start capturing sequentially from when the number of pixels in the screen occupied by the length of the reference object is the maximum value, and stop when the number of pixels in the screen occupied by the length of the reference object is the minimum value; as well as
第二获取单元,用于依次从基准物的长度所占屏幕中的像素点个数为最小值时起始捕捉,至基准物的长度所占屏幕中的像素点个数为最大值时截止。The second acquiring unit is used to sequentially start capturing from when the number of pixels on the screen occupied by the length of the reference object is the minimum value, and stop when the number of pixels on the screen occupied by the length of the reference object is the maximum.
具体地,上述两种获取在距离d时基准物的长度所占屏幕中对应的像素点个数n的方法,是通过利用摄像头获取基准物在屏幕上呈现的临界值实现的,这还取决用户在获取数据时的使用习惯,例如,对于使用横屏进行采集的方式,其在屏幕上对应显示的像素点个数会多于使用竖屏进行采集的方式。因此,为了提高数据的完整性,以及提高后面的测量精度可以采用横屏的采集方式。Specifically, the above two methods of obtaining the number n of pixels corresponding to the length of the reference object on the screen occupied by the distance d are realized by using the camera to obtain the critical value of the reference object presented on the screen, which also depends on the user The usage habits when acquiring data, for example, for the method of collecting with a horizontal screen, the number of corresponding display pixels on the screen will be more than that of using a vertical screen for collection. Therefore, in order to improve the integrity of the data and improve the accuracy of subsequent measurements, a horizontal screen acquisition method can be adopted.
像素点个数N获取单元22,用于获取待测物的距离D,及待测物的长度所占屏幕中像素点个数N,距离D为待测物至摄像头的距离。The number of pixels N acquisition unit 22 is used to acquire the distance D of the object to be tested and the number N of pixels in the screen occupied by the length of the object to be tested, where the distance D is the distance from the object to be tested to the camera.
在本实施例中,像素点个数N获取单元22包括:In this embodiment, the acquisition unit 22 for the number of pixels N includes:
距离获取单元,用于根据距离传感器获取待测物的距离D;a distance acquisition unit, configured to acquire the distance D of the object to be measured according to the distance sensor;
坐标位置获取单元,用于获取所述屏幕上触摸点的坐标位置,以确定所述待测物长度的计算范围;以及a coordinate position acquiring unit, configured to acquire the coordinate position of the touch point on the screen to determine the calculation range of the length of the object to be measured; and
计算单元,用于根据所述待测物长度的计算范围,计算所述待测物长度所占屏幕中像素点个数N。The calculation unit is configured to calculate the number N of pixels in the screen occupied by the length of the object to be measured according to the calculation range of the length of the object to be measured.
在本发明实施例中,在获取到基准物的数据后,可以开始测量待测物的长度,通过终端设备上的距离传感器获取待测物到摄像头的距离,得到距离D;此时,摄像头采集到待测物的图像,并显示在终端设备的屏幕上,为了增加测量的准确性,减少计算量以及快速找到计算对象(即待测物),通过用户在屏幕上点击选取需要测量的待测长度的计算范围,由此,根据用户选取的需要测量的待测长度的计算范围,精准地计算待测物长度所占屏幕中像素点个数N。In the embodiment of the present invention, after obtaining the data of the reference object, the length of the object to be measured can be measured, and the distance from the object to be measured to the camera can be obtained through the distance sensor on the terminal device to obtain the distance D; at this time, the camera collects The image of the object to be tested is displayed on the screen of the terminal device. In order to increase the accuracy of measurement, reduce the amount of calculation and quickly find the calculation object (that is, the object to be measured), the user clicks on the screen to select the object to be measured The calculation range of the length, thus, according to the calculation range of the length to be measured selected by the user, the number N of pixels in the screen occupied by the length of the object to be measured is accurately calculated.
进一步地,坐标位置获取单元包括:Further, the coordinate position acquisition unit includes:
第一坐标位置获取单元,用于在屏幕上检测第一触摸点,并获取第一触摸点的坐标位置;The first coordinate position acquisition unit is used to detect the first touch point on the screen and acquire the coordinate position of the first touch point;
第二坐标位置获取单元,用于在屏幕上检测第二触摸点,并获取第二触摸点的坐标位置;以及A second coordinate position acquisition unit, configured to detect a second touch point on the screen, and acquire the coordinate position of the second touch point; and
计算范围确定单元,用于根据第一触摸点的坐标位置以及第二触摸点的坐标位置,确定待测物长度的计算范围。The calculation range determining unit is configured to determine the calculation range of the length of the object to be tested according to the coordinate position of the first touch point and the coordinate position of the second touch point.
具体地,用户在屏幕上选取需要测量的待测长度的计算范围时,可以分别点击需要量测长度的起点和终端,当用户点击需要量测长度的起点时,在屏幕上检测第一触摸点,并获取第一触摸点的坐标位置,当用户点击需要量测长度的终端时,在屏幕上检测第二触摸点,并获取第二触摸点的坐标位置;根据第一触摸点的坐标位置以及第二触摸点的坐标位置,确定待测物长度的计算范围。Specifically, when the user selects the calculation range of the length to be measured that needs to be measured on the screen, he can click the starting point and the terminal of the length to be measured respectively. When the user clicks the starting point of the length to be measured, the first touch point is detected on the screen. , and obtain the coordinate position of the first touch point, when the user clicks on the terminal that needs to measure the length, detect the second touch point on the screen, and obtain the coordinate position of the second touch point; according to the coordinate position of the first touch point and The coordinate position of the second touch point determines the calculation range of the length of the object to be measured.
匹配单元23,用于将距离D与距离d进行匹配,得到对应的像素点个数n。The matching unit 23 is configured to match the distance D with the distance d to obtain the corresponding number n of pixel points.
在本发明实施例中,当获取到待测物的距离D时,与之前存储的基准物的数据进行匹配,找到与待测物的距离D相等的距离d,当匹配到相等的距离d时,得到在距离d时基准物的长度所占屏幕中对应的像素点个数n。In the embodiment of the present invention, when the distance D of the object to be measured is obtained, it is matched with the data of the previously stored reference object to find a distance d equal to the distance D of the object to be measured. , to obtain the corresponding pixel number n in the screen occupied by the length of the reference object at the distance d.
待测物长度计算单元24,用于根据匹配得到的像素点个数n、待测物的长度所占屏幕中像素点个数N、以及基准物的长度l,得到待测物的长度L。The length calculation unit 24 of the object to be tested is used to obtain the length L of the object to be tested according to the number n of pixels obtained by matching, the number N of pixels in the screen occupied by the length of the object to be tested, and the length l of the reference object.
在本发明实施例中,待测物的长度L的计算公式为:待测物的长度 In the embodiment of the present invention, the calculation formula of the length L of the test object is: the length of the test object
在本发明实施例中,测量长度的装置的各单元可由相应的硬件或软件单元实现,各单元可以为独立的软、硬件单元,也可以集成为一个软、硬件单元,在此不用以限制本发明。该装置各单元的实施方式具体可参考前述实施例一的描述,在此不再赘述。In the embodiment of the present invention, each unit of the device for measuring length can be realized by corresponding hardware or software units, and each unit can be an independent software and hardware unit, or can be integrated into a software and hardware unit, which is not intended to limit the present invention. invention. For the implementation manner of each unit of the device, reference may be made to the description of the first embodiment above, and details are not repeated here.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610584390.0A CN106123784B (en) | 2016-07-22 | 2016-07-22 | method and device for measuring length |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610584390.0A CN106123784B (en) | 2016-07-22 | 2016-07-22 | method and device for measuring length |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106123784A true CN106123784A (en) | 2016-11-16 |
| CN106123784B CN106123784B (en) | 2019-03-15 |
Family
ID=57289424
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610584390.0A Expired - Fee Related CN106123784B (en) | 2016-07-22 | 2016-07-22 | method and device for measuring length |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106123784B (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107504902A (en) * | 2017-08-24 | 2017-12-22 | 广东小天才科技有限公司 | Length measuring method and device, mobile terminal and storage medium |
| CN108304119A (en) * | 2018-01-19 | 2018-07-20 | 腾讯科技(深圳)有限公司 | object measuring method, intelligent terminal and computer readable storage medium |
| CN110702001A (en) * | 2018-07-10 | 2020-01-17 | 皓琪科技股份有限公司 | Non-contact optical measurement method and system |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102494616A (en) * | 2011-11-22 | 2012-06-13 | 捷开通讯科技(上海)有限公司 | Length measuring device based on mobile terminal and method thereof |
| CN103063143A (en) * | 2012-12-03 | 2013-04-24 | 苏州佳世达电通有限公司 | Measuring method and system based on image identification |
| US20130169756A1 (en) * | 2011-12-29 | 2013-07-04 | Samsung Electronics Co., Ltd. | Depth sensor, method of calculating depth in the same |
-
2016
- 2016-07-22 CN CN201610584390.0A patent/CN106123784B/en not_active Expired - Fee Related
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102494616A (en) * | 2011-11-22 | 2012-06-13 | 捷开通讯科技(上海)有限公司 | Length measuring device based on mobile terminal and method thereof |
| US20130169756A1 (en) * | 2011-12-29 | 2013-07-04 | Samsung Electronics Co., Ltd. | Depth sensor, method of calculating depth in the same |
| CN103063143A (en) * | 2012-12-03 | 2013-04-24 | 苏州佳世达电通有限公司 | Measuring method and system based on image identification |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107504902A (en) * | 2017-08-24 | 2017-12-22 | 广东小天才科技有限公司 | Length measuring method and device, mobile terminal and storage medium |
| CN108304119A (en) * | 2018-01-19 | 2018-07-20 | 腾讯科技(深圳)有限公司 | object measuring method, intelligent terminal and computer readable storage medium |
| CN110702001A (en) * | 2018-07-10 | 2020-01-17 | 皓琪科技股份有限公司 | Non-contact optical measurement method and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106123784B (en) | 2019-03-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103591894B (en) | The method and apparatus of object length is measured by camera | |
| CN108050943B (en) | Length measurement method and terminal | |
| CN103206919A (en) | Device and method used for measuring object size in portable terminal | |
| JP2012185161A (en) | Method for measuring real dimension of object by using camera included in portable terminal | |
| CN104613930B (en) | Method and device for measuring distance as well as mobile terminal | |
| CN104468916A (en) | Test method based on cell phone response time | |
| CN105554247A (en) | Measuring method, measuring system and terminal | |
| CN106657988B (en) | It is automatically positioned Camera Test method and apparatus, the computer equipment of test pattern | |
| CN105444678A (en) | Handset size measurement method and system | |
| CN110506400A (en) | Bluetooth equipment locator | |
| CN105091847B (en) | The method and electronic equipment of a kind of measurement distance | |
| CN113781534B (en) | Distance measurement method and device | |
| CN105547159A (en) | Method of measuring object based on mobile terminal and mobile terminal | |
| CN106123784A (en) | Method and device for measuring length | |
| TWI468658B (en) | Lens test device and method | |
| CN107967701B (en) | Calibration method, device and equipment of depth camera equipment | |
| CN107504902A (en) | Length measuring method and device, mobile terminal and storage medium | |
| CN111835959A (en) | Method and apparatus for dual light fusion | |
| CN109489560B (en) | A method and device for measuring linear dimensions, and an intelligent terminal | |
| CN102314387A (en) | Method for measuring accuracy of touch screen | |
| CN114565911A (en) | Instrument reading method and device, computer equipment and storage medium | |
| CN110646134A (en) | Calibration method and calibration device for air pressure sensor | |
| CN104116505B (en) | Pulse Estimator | |
| CN112906681A (en) | Meter reading method and device, electronic equipment and storage medium | |
| CN107734324B (en) | Method and system for measuring illumination uniformity of flash lamp and terminal equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190315 |
|
| CF01 | Termination of patent right due to non-payment of annual fee |