Disclosure of Invention
Therefore, it is necessary to provide a method and an apparatus for detecting placement of a mobile phone, which are used for solving the problems that the mobile phone detection amount is large in the recycling process, the mobile phone belongs to small-sized equipment, whether the mobile phone placement is standard or not is difficult to determine by naked eyes of related personnel, and the mobile phone is prone to appearance loss due to irregular placement.
A mobile phone placement detection method comprises the following steps:
acquiring a front image of a mobile phone to be tested, and determining a contour mask image of the front image;
determining a contour object set meeting a contour object threshold value in a contour mask image according to a preset contour object threshold value; wherein the contour object threshold comprises a length-width ratio threshold range and an area threshold range;
determining the contour object meeting the coordinate threshold range in the contour object set as a prompt contour object; the prompt outline object is used for prompting that the placement of the mobile phone to be tested corresponding to the prompt outline object needs to be adjusted.
According to the mobile phone placement detection method, after the front image of the mobile phone to be detected is obtained and the outline mask image of the front image is determined, the outline object set meeting the outline object threshold value in the outline mask image is determined according to the preset outline object threshold value. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
In one embodiment, the process of determining a profile mask image for a front image includes the steps of:
filtering the front image to obtain a filtering result;
converting the filtering processing result into a gray image, and performing self-adaptive brightness adjustment processing on the gray image to obtain an adjustment processing result;
carrying out binarization on the adjustment processing result to obtain a binarized image;
performing morphological expansion operation on the binary image, and connecting small areas with broken lines to obtain a connection result;
and searching the contour information in the connection result, and drawing the contour information in an image with the same size and type as the connection result to obtain a contour mask image.
In one embodiment, the process of performing filtering processing on the front image to obtain a filtering processing result includes the steps of:
performing Gaussian filtering processing on the front image;
and performing mean shift filtering on the Gaussian filtering result to obtain a filtering result.
In one embodiment, the self-adaptive brightness adjustment process is performed on the grayscale image, as follows:
Y(i,j)=β(i,j)*X1(i,j)+α(i,j)*X2(i,j)
wherein X1(i, j) + X2(i, j) ═ 255, X1(i, j) ∈ [0,255], X2(i, j) ∈ [0,255], i, j represent pixel coordinates in the appearance image of the smart device, that is, the pixel position of the ith row and the jth column, Y (i, j) represents the final pixel value of the ith row and the jth column after adaptive brightness adjustment, Y (i, j) ∈ [0,255], α, β are adaptive brightness adjustment factors, and α, β satisfy the following formula:
wherein α (i, j) + β (i.j) is 1 and α (i, j) is e (0,1), β (i, j) is e (0, 1);
in addition, X1 ═ G, X2 ═ 255-G, and Y is assigned to G; wherein G is the result of the adjustment process.
In one embodiment, the process of binarizing the adjustment processing result includes the steps of:
and carrying out binarization operation on the adjustment processing result according to an Otsu threshold value method.
In one embodiment, the process of determining the set of contour objects in the contour mask image that satisfy the contour object threshold according to the preset contour object threshold is as follows:
wherein the length-width ratio threshold range of the contour object is [ T ]ratio1,Tratio2) The area threshold range of the contour object is [ T ]area1,Tarea2](ii) a The upper left corner coordinate threshold of the contour object is TxAnd TyWherein T isxThe corresponding threshold range is (0, T)x1]∪[Tx2,Mcols,),TyThe corresponding threshold range is (0, T)y1]。
In one embodiment, the threshold range of coordinates is (0, T)x1]。
A mobile phone placement detection device comprises the following steps:
the image determining module is used for acquiring a front image of the mobile phone to be tested and determining a contour mask image of the front image;
the set acquisition module is used for determining a contour object set meeting a contour object threshold value in the contour mask image according to a preset contour object threshold value; wherein the contour object threshold comprises a length-width ratio threshold range and an area threshold range;
the object detection module is used for determining the contour objects meeting the coordinate threshold range in the contour object set as prompt contour objects; the prompt outline object is used for prompting that the placement of the mobile phone to be tested corresponding to the prompt outline object needs to be adjusted.
According to the mobile phone placement detection device, after the front image of the mobile phone to be detected is obtained and the outline mask image of the front image is determined, the outline object set meeting the outline object threshold value in the outline mask image is determined according to the preset outline object threshold value. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
A computer storage medium having computer instructions stored thereon, the computer instructions when executed by a processor implement the method for detecting placement of a mobile phone according to any of the above embodiments.
After the front image of the mobile phone to be tested is obtained and the contour mask image of the front image is determined, the computer storage medium determines the contour object set meeting the contour object threshold in the contour mask image according to the preset contour object threshold. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
A computer device comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the program, the mobile phone placement detection method of any one of the embodiments is realized.
After the front image of the mobile phone to be tested is obtained and the contour mask image of the front image is determined, the computer equipment determines the contour object set meeting the contour object threshold in the contour mask image according to the preset contour object threshold. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
Detailed Description
For better understanding of the objects, technical solutions and effects of the present invention, the present invention will be further explained with reference to the accompanying drawings and examples. Meanwhile, the following described examples are only for explaining the present invention, and are not intended to limit the present invention.
In the field of mobile phone recovery detection, for example, in the recovery application of a recovery detection terminal to a mobile phone to be detected, the mobile phone to be detected is placed on a detection platform of a recovery bin of the recovery detection terminal, and the detection platform can dynamically drive the mobile phone to be detected to adjust the placement state, such as rotation, of the mobile phone to be detected. Based on the above, the embodiment of the invention provides a mobile phone placement detection method based on image shooting of recovery detection.
Fig. 1 is a flowchart of a method for detecting placement of a mobile phone according to an embodiment, and as shown in fig. 1, the method for detecting placement of a mobile phone according to an embodiment includes steps S100 to S102:
s100, acquiring a front image of the mobile phone to be tested, and determining a contour mask image of the front image;
the shooting equipment obtains a front image of the mobile phone to be detected by shooting the mobile phone to be detected. For example, when the mobile phone to be tested is recovered and tested through the recovery detection terminal, the camera of the recovery detection terminal provides a front image including a shooting background and the front of the mobile phone to be tested by shooting the mobile phone to be tested in the recovery bin.
After the front image of the mobile phone to be tested is determined, the outline mask image is determined by selecting the area of the front image, so that the information of the front image can be conveniently identified, the processing amount is reduced, and the accuracy of subsequent processing is improved.
In one embodiment, the outline mask image determined by the front image is used for screening the position of the front camera of the mobile phone to be tested, so that the position of the rear camera of the mobile phone to be tested is judged according to the subsequent steps, and whether the placement position of the mobile phone to be tested is standard or not is determined according to the position of the rear camera.
In one embodiment, fig. 2 is a flowchart of a mobile phone placement detection method according to another embodiment, and as shown in fig. 2, the process of determining the outline mask image of the front image in step S100 includes steps S200 to S204:
s200, filtering the front image to obtain a filtering result;
the corresponding noise and interference in the front image are eliminated through filtering processing, and the accuracy of the subsequent processing of the filtering processing result is improved.
In one embodiment, fig. 3 is a flowchart of a mobile phone placement detection method according to yet another embodiment, and as shown in fig. 3, the process of performing filtering processing on the front image in step S200 to obtain a filtering processing result includes step S300 and step S301:
s300, performing Gaussian filtering processing on the front image;
wherein, white noise interference in the front image is eliminated through Gaussian filtering processing. As one of the preferred embodiments, the front image is subjected to 5 × 5 gaussian filter processing, and the result of the gaussian filter processing is obtained.
S301, performing mean shift filtering on the Gaussian filtering result to obtain a filtering result.
And performing mean shift filtering processing on the Gaussian filtering processing result so as to facilitate subsequent image processing. As a preferred embodiment, the result of the mean shift filtering process is obtained by setting the sliding window of the mean shift filtering process to 11 × 11 and the color threshold to 25.
S201, converting the filtering processing result into a gray image, and performing self-adaptive brightness adjustment processing on the gray image to obtain an adjustment processing result;
the gray level image is subjected to self-adaptive brightness adjustment processing, images in darker areas and images in brighter areas are subjected to brightness adjustment and dimming processing, and areas which are too dark are brightened and areas which are too bright are dimmed.
In one embodiment, the self-adaptive brightness adjustment process is performed on the grayscale image in step S201, as follows:
Y(i,j)=β(i,j)*X1(i,j)+α(i,j)*X2(i,j)
wherein X1(i, j) + X2(i, j) ═ 255, X1(i, j) ∈ [0,255], X2(i, j) ∈ [0,255], i, j represent pixel coordinates in the appearance image of the smart device, that is, the pixel position of the ith row and the jth column, Y (i, j) represents the final pixel value of the ith row and the jth column after adaptive brightness adjustment, Y (i, j) ∈ [0,255], α, β are adaptive brightness adjustment factors, and α, β satisfy the following formula:
wherein α (i, j) + β (i.j) is 1 and α (i, j) is e (0,1), β (i, j) is e (0, 1);
in addition, X1 ═ G, X2 ═ 255-G, and Y is assigned to G; wherein G is the result of the adjustment process.
S202, binarizing the adjusting processing result to obtain a binarized image;
and obtaining a binary image by binarizing the adjustment processing result so as to extract information in the front image and increase the recognition rate in the subsequent image processing process.
In one embodiment, the process of binarizing the adjustment processing result in step S202 includes step S400:
and S400, performing binarization operation on the adjustment processing result according to an Otsu threshold value method.
And performing OTSU operation on the adjustment processing result to obtain a corresponding binary image.
S203, performing morphological expansion operation on the binary image, and connecting small areas with broken lines to obtain a connection result;
s204, searching the contour information in the connection result, and drawing the contour information in an image with the same size and type as the connection result to obtain a contour mask image.
S101, determining a contour object set meeting a contour object threshold value in a contour mask image according to a preset contour object threshold value; wherein the contour object threshold comprises a length-width ratio threshold range and an area threshold range;
and traversing all contour objects according to the determined contour mask image of the front image of the mobile phone to be detected, and determining a contour object set meeting a contour object threshold in the contour mask image.
In one embodiment, in step S101, a process of determining a set of contour objects satisfying a contour object threshold in the contour mask image according to a preset contour object threshold is as follows:
wherein the length-width ratio threshold range of the contour object is [ T ]ratio1,Tratio2) The area threshold range of the contour object is [ T ]area1,Tarea2](ii) a The upper left corner coordinate threshold of the contour object is TxAnd TyWherein T isxThe corresponding threshold range is (0, T)x1]∪[Tx2,Mcols,),TyThe corresponding threshold range is (0, T)y1]。
S102, determining the contour object meeting the coordinate threshold range in the contour object set as a prompt contour object; the prompt outline object is used for prompting that the placement of the mobile phone to be tested corresponding to the prompt outline object needs to be adjusted.
And determining a prompt outline object, wherein the prompt outline object has a corresponding relation with the mobile phone to be tested. The outline object of the mobile phone to be detected, the placement position of which needs to be adjusted, is the prompt outline object.
In one embodiment, the threshold range of coordinates is (0, T)x1]. As a preferred embodiment, the contour object whose coordinate x satisfies the coordinate threshold range in the contour object set is determined as the prompt contour object.
In one embodiment, in the recovery detection terminal, after the prompt outline object is determined, the placement state flag bit of the corresponding mobile phone to be detected is set to be 1, and the detection platform is controlled to rotate left and right to place the mobile phone to be detected again.
In the method for detecting placement of a mobile phone according to any of the embodiments, after the front image of the mobile phone to be detected is obtained and the contour mask image of the front image is determined, the contour object set meeting the contour object threshold in the contour mask image is determined according to the preset contour object threshold. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
The embodiment of the invention also provides a mobile phone placement detection device.
Fig. 4 is a block diagram of a mobile phone placement detection apparatus according to an embodiment, and as shown in fig. 4, the mobile phone placement detection apparatus according to an embodiment includes amodule 100, amodule 101, and a module 102:
theimage determining module 100 is configured to obtain a front image of the mobile phone to be tested, and determine a contour mask image of the front image;
theset acquisition module 101 is configured to determine, according to a preset contour object threshold, a contour object set that meets the contour object threshold in the contour mask image; wherein the contour object threshold comprises a length-width ratio threshold range and an area threshold range;
theobject detection module 102 is configured to determine a contour object satisfying a coordinate threshold range in the contour object set as a prompt contour object; the prompt outline object is used for prompting that the placement of the mobile phone to be tested corresponding to the prompt outline object needs to be adjusted.
According to the mobile phone placement detection device, after the front image of the mobile phone to be detected is obtained and the outline mask image of the front image is determined, the outline object set meeting the outline object threshold value in the outline mask image is determined according to the preset outline object threshold value. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
The embodiment of the invention also provides a computer storage medium, wherein computer instructions are stored on the computer storage medium, and when the instructions are executed by a processor, the method for detecting the placement of the mobile phone in any embodiment is realized.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a RAM, a ROM, a magnetic or optical disk, or various other media that can store program code.
Corresponding to the computer storage medium, in one embodiment, a computer device is further provided, where the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method for detecting placement of a mobile phone is implemented in any one of the above embodiments.
The computer device may be a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to realize a mobile phone placement detection method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like
After the front image of the mobile phone to be tested is obtained and the contour mask image of the front image is determined, the computer equipment determines the contour object set meeting the contour object threshold in the contour mask image according to the preset contour object threshold. And finally, determining the contour object meeting the coordinate threshold range in the contour object set, and using the contour object as a prompt contour object for prompting the corresponding to-be-tested mobile phone to be placed to be adjusted. Based on the method, the appearance of the mobile phone to be tested is detected, the obtained front image is used for carrying out corresponding image processing, the placing posture of the mobile phone to be tested is judged, whether the placing of the mobile phone to be tested is standard or not is determined, the mobile phone to be tested is prompted to be placed again when the placing is not standard, appearance loss caused by irregular placing of the back face of the mobile phone or a rear camera and the like is prevented, and the recycling value of the mobile phone to be tested is guaranteed.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.