Camera status determination methods, devices and software products
Patent Information
- Application Number
- CN202610579810.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-28
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]然而,这种方式延迟较高且效率较低
[0016]第四方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面所述的摄像头状态确定方法。
Smart Images

Figure CN122578952A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, device and program product for determining the status of a camera. Background Technology
[0002] With the continuous development of technology, external shooting devices specifically designed for mobile phones are becoming increasingly common. These external shooting devices typically need to acquire the status of the phone's camera to adjust their operation, achieving a low-power, highly professional mode.
[0003] In related technologies, after capturing a frame of an image of a mobile phone screen using another camera, key visual features are extracted based on the image, and then the visual features are compared with preset normal or abnormal states to determine the camera status.
[0004] However, this method is both slow and inefficient. Summary of the Invention
[0005] This application provides a method, device, and program product for determining camera status, which can reduce the delay in determining camera status and improve the efficiency of determination. The technical solution is as follows: In a first aspect, a method for determining the state of a camera is provided, applied to a first device, the method comprising: Receive screen video stream sent by the second device; Multiple pixel data are acquired based on the screen video stream; Based on the multiple pixel data, the camera status of the second device is determined through a hardware parallel pipeline triggered by a pixel clock.
[0006] In this application, the hardware parallel pipeline is a dedicated hardware circuit designed for real-time processing of continuous pixel streams. This hardware parallel pipeline includes a series of dedicated hardware logic modules, each responsible for a specific processing step. All modules operate synchronously under the drive of the same pixel clock. In each clock cycle of this pixel clock, each module passes its current processing result to the next module and simultaneously receives new data from the previous module. Its operating rhythm is determined by the pixel clock frequency to achieve a "one pixel arrives, one is processed, one is output" pipeline operation. This achieves deterministic low latency and extremely high data throughput, meeting the real-time requirements for determining camera status and improving the efficiency of camera status determination. Furthermore, determining the camera status through multiple pixel data corresponding to the screen video stream prevents malicious applications from bypassing or hijacking it, or causing unrecognizable conditions, thus ensuring device operational security.
[0007] Optionally, acquiring multiple pixel data based on the screen video stream includes: The screen video stream is parsed to obtain pixel data of one or more frames of screen images; The method further includes: The rising edge of the clock cycle corresponding to the first pixel data of each frame of the screen image in the one or more frames of screen images sets the frame start marker to be valid; The rising edge of the clock cycle corresponding to the last pixel data in a row of pixel data in each frame of the screen image sets the row end marker to be valid.
[0008] Optionally, determining the camera status of the second device based on the plurality of pixel data via a hardware parallel pipeline includes: For any one of the plurality of pixel data, the pixel data is input into the hardware parallel pipeline at the rising edge of one clock cycle of the pixel clock; The hardware parallel pipeline is used to: determine whether the pixel coordinates corresponding to the pixel data are within a preset range; if the pixel coordinates are within the preset range, determine whether the pixel data belongs to a target color pixel; if the pixel data belongs to a target color pixel, increment the target color pixel count value by 1, the target color pixel count value being used to count the target color pixels in a row of pixels to which the pixel data belongs; if the row end marker is valid, set a first camera marker based on the target color pixel count value, the first camera marker being used to indicate whether a frame of screen image to which the pixel data belongs satisfies the camera on feature; The hardware parallel pipeline is also used to: determine the camera state based on the first camera tag.
[0009] Optionally, the hardware parallel pipeline is further configured to: reset the target color pixel count value on the rising edge of the next clock cycle if the line end marker changes from invalid to valid.
[0010] Optionally, setting the first camera marker based on the target color pixel count value includes: Determine whether the target color pixel count value is within a preset range; If the target color pixel count value is within a preset range, increment the valid row count value by 1; If the target color pixel count value is not within the preset range, reset the valid row count value; If the number of valid rows is greater than the first threshold, the first camera is marked as valid.
[0011] Optionally, determining the camera status based on the first camera tag includes: If the start-of-frame marker changes from invalid to valid, assign the value of the first camera marker to the second camera marker; or set the first camera marker to invalid. If the second camera flag is valid in this assignment, or if the second camera flag is valid at least a preset number of times in a series of consecutive assignments, the camera is determined to be in an on state; otherwise, the camera is determined to be in a off state.
[0012] Optionally, assigning the value of the first camera marker to the second camera marker when the start-of-frame marker changes from invalid to valid includes: When the frame start marker changes from invalid to valid, if the first frame count value is equal to m, and the ratio of the second frame count value to the first frame count value is less than or equal to a preset ratio, then the value of the first camera marker is assigned to the second camera marker. The first frame count value is used to count the screen images detected in this round, and the second frame count value is used to count the repeated frames in the screen images detected in this round. The m is an integer greater than or equal to 2.
[0013] Optionally, the hardware parallel pipeline is further configured to: set the line marker to valid when the start-of-frame marker changes from invalid to valid; Before determining whether the pixel coordinates corresponding to the pixel data are within a preset range, the method further includes: If the row marker is valid, the step of determining whether the pixel coordinates corresponding to the pixel data are within a preset range and subsequent steps are executed. After determining whether the pixel coordinates corresponding to the pixel data are within a preset range, the method further includes: If the pixel coordinates are within a preset range, determine whether the pixel data belongs to a non-black pixel; if the pixel data belongs to a non-black pixel, increment the non-black pixel count by 1. The non-black pixel count is used to count the non-black pixels in the row to which the pixel data belongs; if the row end mark is valid, determine whether the non-black pixel count is greater than or equal to a second threshold; if the non-black pixel count is greater than or equal to the second threshold, set the row mark to invalid.
[0014] Secondly, a camera status determination device is provided, the device comprising: The receiving module is used to receive the screen video stream sent by the second device; The acquisition module is used to acquire multiple pixel data based on the screen video stream; The determination module is used to determine the camera status of the second device based on the multiple pixel data through a hardware parallel pipeline, wherein the hardware parallel pipeline is triggered based on a pixel clock.
[0015] Thirdly, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, it implements the camera state determination method described in the first aspect.
[0016] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the camera state determination method described in the first aspect.
[0017] Fifthly, a computer program product is provided, which, when run on a computer device, causes the computer device to execute the camera state determination method described in the first aspect.
[0018] It is understood that the beneficial effects of the second, third, fourth, and fifth aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the structure of a communication system provided in an embodiment of this application; Figure 2 This is a flowchart of a camera status determination method provided in an embodiment of this application; Figure 3 This is a flowchart of a camera status determination method provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a camera status determination device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0020] In the following description, specific details such as particular system architectures and technologies are set forth for illustrative purposes and not for limiting purposes, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details.
[0021] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0022] It should be understood that "one or more" as used in this application refers to one, two, or more, and "multiple" as used in this application refers to two or more. In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone.
[0023] To facilitate a clear description of the technical solutions of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" do not necessarily imply that they are different.
[0024] The terms "one embodiment" or "some embodiments" used in this application mean that one or more embodiments of this application include the specific features, structures, or characteristics described in that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this application do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.
[0025] The application scenarios involved in the embodiments of this application are described below.
[0026] For external shooting devices specifically designed for mobile phones, the goal of performance optimization is to achieve a high level of professional performance with low power consumption. External shooting devices typically activate only after the phone's camera is turned on, thus requiring access to the phone's camera status.
[0027] In related technologies, the following two methods are commonly used to determine the camera status.
[0028] The first method involves an external camera requesting permission from the user to access the phone's camera status. Once authorized, the external camera accesses the camera's status via its corresponding API to determine whether the camera is on.
[0029] The second method involves capturing a frame of the phone screen using another camera, extracting key visual features from that image, and then comparing those visual features with preset normal or abnormal states to determine the camera's status.
[0030] However, both of the above methods have some problems to varying degrees. The first method relies on the software layer, which is easily bypassed or hijacked by malicious applications during the continuous acquisition of camera status, affecting device security. The second method is limited by the system version. In Android 11 and below, or highly customized ROMs (such as some older models), the position / color of the privacy indicator is inconsistent (such as orange dots and icons), making the solution unusable. (2) It is easily obscured. Some mobile phone models have punch-hole screens or notch screens with a lot of status bar information. Some applications (such as games or video applications) will forcibly hide the status bar (such as hiding the green dot) or change the status bar to black / dark mode. Although the green dot is still there, the visual contrast is reduced, or it is obscured by the notch, making it impossible to capture in the screenshot and resulting in low detection accuracy. (3) The position is not fixed. Although the privacy indicator is located in the upper right corner of the phone screen when it is turned on in most models, different manufacturers have different placement, size, and animation effects (such as breathing effects) of the privacy indicator. It needs to be adapted for different models, which is costly.
[0031] To address this, this application provides a method for determining camera status, applied to a first device with a hardware parallel pipeline. In this method, a screen video stream sent by a second device is received. Multiple pixel data are acquired based on the screen video stream. Based on this multiple pixel data, the camera status of the second device is determined through a hardware parallel pipeline triggered by a pixel clock. Since the hardware parallel pipeline is a dedicated hardware circuit designed for real-time processing of continuous pixel streams, it includes a series of dedicated hardware logic modules, each responsible for a specific processing step. All modules operate synchronously under the drive of the same pixel clock. In each clock cycle of the pixel clock, each module passes its current processing result to the next module and simultaneously receives new data from the previous module. Its operating rhythm is determined by the pixel clock frequency to achieve a "one pixel arrives, one is processed, one is output" pipeline operation. This achieves deterministic low latency and extremely high data throughput, meeting the real-time requirements for determining camera status and improving the efficiency of camera status determination. Furthermore, by determining the camera status through multiple pixel data corresponding to the screen video stream, there will be no situation where it is bypassed or hijacked by malicious applications or cannot be recognized, thus ensuring the security of device operation.
[0032] The communication system provided in the embodiments of this application will be described below.
[0033] Figure 1 This is a schematic diagram of the structure of a communication system provided in an embodiment of this application. See also... Figure 1 The communication system 10 may include a first device 101, a second device 102 and a third device 103.
[0034] It should be noted that the above structure is only used as an example to illustrate the communication system 10 in this application embodiment. In actual applications, the communication system 10 may include more devices, components, modules, etc. than shown in the figure. This application embodiment does not limit this.
[0035] The first device 101 can communicate with the second device 102 and the third device 103 via a wired or wireless connection. For example, the first device 101 and the second device 102 can communicate via a universal serial bus (USB) Type-C.
[0036] The second device 102 can communicate with the third device 103 via a wired or wireless connection.
[0037] The first device 101 is used to send a screen video stream acquisition request to the second device 102, receive the screen video stream sent by the second device 102, and determine the camera status of the second device 102 based on the screen video stream. For example, the first device 101 can be a field-programmable gate array (FPGA) or an application-specific integrated circuit (ASIC), etc., and this application embodiment does not limit it.
[0038] For example, the first device 101 may include a parsing module and a hardware parallel pipeline.
[0039] This parsing module is used to parse the received screen video stream to obtain pixel data of one or more frames of screen images.
[0040] This hardware pipeline is used to determine the camera status of the second device 102 based on pixel data from one or more frames of screen images. This parallel hardware pipeline is a dedicated hardware circuit designed for real-time processing of continuous pixel streams. The parallel hardware pipeline may include a series of dedicated hardware logic modules, each responsible for a specific processing step. All modules operate synchronously driven by the same pixel clock. In each clock cycle of this pixel clock, each module passes its current processing result to the next module and simultaneously receives new data from the previous module. Its operating rhythm is determined by the pixel clock frequency to achieve a "one pixel arrives, one is processed, one is output" pipeline operation.
[0041] For example, one clock cycle of the pixel clock corresponds to processing one pixel of data, and the pixel clock determines the rhythm of the pixel data input to the hardware parallel pipeline. A hardware parallel pipeline triggered by the pixel clock means that each stage of the hardware parallel pipeline proceeds synchronously on the rising edge of the pixel clock cycle. That is, when each clock cycle arrives, all stages of the hardware parallel pipeline operate simultaneously. Thus, in one clock cycle, one pixel of data can be input into the hardware parallel pipeline for processing, and simultaneously, a processing result can be output from the hardware parallel pipeline.
[0042] The screen video stream can be pixel data of one or more frames of screen images in the second device 102. For example, the screen video stream can be a serial video stream, such as a UVC (USB Video Class) data stream.
[0043] Optionally, the first device 101 may further include a video stream duplicate frame detection module, which is used to detect the number of duplicate frames in multiple screen images in a screen video stream.
[0044] The second device 102 is used to receive a screen video stream acquisition request sent by the first device 101, record its own screen image based on the screen video stream acquisition request, obtain a screen video stream, and send it to the first device 101. For example, the second device 102 can be a mobile device (such as a mobile phone, tablet, etc.), but this application embodiment does not limit it.
[0045] The third device 103 is used to receive a camera status acquisition request sent by the first device 101 and to receive the camera status sent by the first device 101. For example, the third device 103 can be an external shooting device, a projector, a barcode scanner, or other device that needs to acquire the camera status of the second device 102. This application embodiment does not limit this.
[0046] For example, the first device 101 may send a screen video stream acquisition request to the second device 102 after receiving a camera status acquisition request from the third device 103 to determine the camera status; or, the first device 101 may actively send a screen video stream acquisition request to the second device 102 after establishing a communication connection with the second device 102. This application embodiment does not limit this.
[0047] For example, after the first device 101 determines the camera status of the second device 102, it can actively send the camera status to the third device 103. Alternatively, the first device 101 can send the camera status to the third device 103 after receiving a camera status acquisition request from the third device 103. This application embodiment does not limit this.
[0048] The camera status determination method provided in the embodiments of this application will be explained in detail below.
[0049] Figure 2 This is a flowchart illustrating a camera state determination method provided in an embodiment of this application. For example, this method can be applied to the above... Figure 1 The first device 101 in this embodiment can specifically consist of a parsing module and a hardware parallel pipeline. See also Figure 2 The method may include the following steps: Step 201: The computer device receives the screen video stream sent by the second device.
[0050] For example, the screen video stream may include pixel data of one or more frames of screen images from the second device. For example, the computer device may receive the screen video stream sent by the second device via Type-C.
[0051] For example, the screen video stream can be a serial video stream, such as a UVC (USB video class) data stream.
[0052] By receiving the screen video stream sent by the second device, data is provided for subsequently determining the camera status of the second device.
[0053] Step 202: The computer device acquires multiple pixel data based on the screen video stream.
[0054] For example, the computer device parses the screen video stream to obtain pixel data of one or more frames of screen images.
[0055] Since these multiple pixel data can reflect whether there is a sign indicating whether the camera is on (such as a privacy indicator) on the current screen of the second device, these multiple pixel data can be obtained based on the screen video stream.
[0056] In some implementations, the computer device may enable a frame start marker at the rising edge of the clock cycle corresponding to the first pixel data of each frame of screen image in one or more frames of screen image; and enable a line end marker at the rising edge of the clock cycle corresponding to the last pixel data of a line of pixel data in each frame of screen image.
[0057] The clock cycle corresponding to this pixel data is the clock cycle during which the pixel data is input into the hardware parallel pipeline.
[0058] For example, the start-of-frame marker is used to indicate (e.g., tuser) the start of a screen image frame. A valid start-of-frame marker indicates that the pixel data to be processed is for a new screen image frame; an invalid start-of-frame marker indicates that the system is processing pixel data for a current screen image frame. For example, after the start-of-frame marker is set to valid, the computer device can set it to invalid on the rising edge of the next clock cycle.
[0059] For example, this line end marker is used to indicate (e.g., tlast) the end of a line of pixel data transmission. A valid line end marker indicates that a line of pixel transmission has been detected, while an invalid line end marker indicates that data transmission of a line of pixels is currently in progress and the last pixel of the line has not yet been reached. For example, after the line end marker is set to valid, the computer device can set it to invalid on the rising edge of the next clock cycle.
[0060] By using line end markers, intermediate decisions can be made immediately for that line of data. This "process line as it comes" approach makes the processing speed almost synchronized with the inflow of pixel data, avoiding the huge delay of waiting for the entire frame to be received before processing. By using frame start markers, camera status detection can be performed on a "frame" basis.
[0061] Step 203: Based on the multiple pixel data, the computer device determines the camera status of the second device through a hardware parallel pipeline triggered by the pixel clock.
[0062] One clock cycle of the pixel clock can process one pixel of data, and the pixel clock determines the rhythm of the pixel data input hardware parallel pipeline.
[0063] This hardware parallel pipeline, triggered by a pixel clock, means that each stage of the pipeline proceeds synchronously on the rising edge of the pixel clock cycle. In other words, when each clock cycle arrives, all stages of the hardware parallel pipeline operate simultaneously. Thus, in one clock cycle, one pixel of data can be input into the hardware parallel pipeline for processing, and simultaneously, a processing result can be output from the hardware parallel pipeline.
[0064] In this way, on the one hand, the underlying hardware processes multiple pixel data in parallel according to the pixel clock frequency, realizing a pipelined operation of "one pixel arrives, one is processed, one is output." This achieves deterministic low latency and extremely high data throughput, meeting the application requirements of high frame rates (such as 1080 progressive scanning (P) @ 60 frames per second (fps)) and the real-time requirements (such as microsecond-level) for determining camera status, enabling seamless real-time monitoring of the video stream and improving the efficiency of determining camera status. On the other hand, since the camera status is determined based on pixel data, there is no need to obtain the camera status through the interface of a second device. Therefore, it is not susceptible to being bypassed or hijacked by malicious applications, nor is it affected by system version limitations, obstruction, or unstable location. Thus, it not only has high security, compatibility, and anti-tampering capabilities, but also a high degree of accuracy in determining the camera status.
[0065] In some implementations, step 203 can be performed as follows: For any one of the multiple pixel data, the computer device inputs the pixel data into the hardware parallel pipeline at the rising edge of one clock cycle of the pixel clock; the hardware parallel pipeline is used to: determine whether the pixel coordinates corresponding to the pixel data are within a preset range; if the pixel coordinates are within the preset range, determine whether the pixel data belongs to a target color pixel; if the pixel data belongs to a target color pixel, increment the target color pixel count value by 1, the target color pixel count value is used to count the target color pixels in the row of pixels to which the pixel data belongs; if the row end marker is valid, set a first camera marker based on the target color pixel count value, the first camera marker is used to indicate whether the screen image of the frame to which the pixel data belongs meets the camera on feature.
[0066] For example, the pixel coordinates corresponding to the pixel data include row coordinates (rx_line_cnt) and column coordinates (rx_pix_cnt). For example, the pixel coordinates corresponding to the pixel data can be determined based on the resolution of the screen image. For instance, the resolution of the screen image could be 1920x1080, etc., and this embodiment does not limit this. For the first input pixel, the row coordinate of the pixel data is 1 and the column coordinate is 1; for the second input pixel, the row coordinate of the pixel data is 1 and the column coordinate is 2.
[0067] For example, the preset range can be the pixel range in which the camera status flag is located in the screen image. The preset range can be preset. The preset range can include preset row ranges (such as [LINE_ST, LINE_END]) and preset column ranges (such as [PIX_ST, PIX_END]).
[0068] For example, the pixel data may include the pixel's red component (red, R), green component (green, G), blue component (blue, B), etc., but this application embodiment does not limit this.
[0069] The target color pixels can be preset. For example, the target color pixels can be set to green, etc., but this application embodiment does not limit this. The target color pixel count value is the number of pixels belonging to the target color in this row of pixel data.
[0070] For example, if the target color pixel is green, and the G component of the pixel data is greater than or equal to 128, and the R and B components are both less than the difference between the G component and a preset value, then the pixel data is determined to belong to the target color pixel, and the target color pixel count value (e.g., green_pix_cnt) is incremented by 1. For example, the preset value (e.g., THRESHOLD) can be set to 50.
[0071] For example, the line end marker can be tlast. For example, if the line end marker changes from invalid to valid, the target color pixel count value can be reset on the rising edge of the next clock cycle.
[0072] If the pixel coordinates corresponding to the pixel data are not within the preset range, it means that the pixel data is not a pixel within the pixel range where the camera status flag is located, so there is no need to perform the operation of determining whether the pixel data belongs to the target color pixel; if the pixel coordinates corresponding to the pixel data are within the preset range, it means that the pixel data is a pixel within the pixel range where the camera status flag is located, so the operation of determining whether the pixel data belongs to the target color pixel can continue.
[0073] Since the target color pixel count can represent the number of pixels in that row of pixels on the screen image that belong to the camera status flag, the target color pixel count can be used to determine whether the camera is on or off relatively accurately, and thus set the first camera flag accordingly.
[0074] In this way, the camera status can be determined with relatively simple operations. Compared with the complex and risky operations in related technologies, it can not only efficiently determine the camera status, but also ensure the safety of the second device.
[0075] Optionally, a line blanking period can follow the transmission of each row of pixel data. In this case, at the input interface of the hardware parallel pipeline, there is a fixed time interval between the last pixel data in a row and the first pixel data in the next row. This interval is the line blanking period, during which no pixel data is input.
[0076] In some implementations, the computer device may set the first camera marker based on the target color pixel count value as follows: the computer device determines whether the target color pixel count value is within a preset range; if the target color pixel count value is within the preset range, the valid row count value is incremented by 1; if the target color pixel count value is not within the preset range, the valid row count value is reset; if the valid row count value is greater than a first threshold, the first camera marker is set to valid.
[0077] The preset range (e.g., [DIFF_PIX_MIN, DIFF_PIX_MAX]) can be set in advance. For example, the preset range can be set according to the number of pixels occupied by the camera status indicator (e.g., privacy indicator). For example, the preset range can be set to [3,10], [3,11], or [4,10], etc., and this application embodiment does not limit this.
[0078] The valid row count is used to count consecutive valid rows in a frame of screen image to which the pixel data belongs. A valid row is a row where the number of target color pixels is within a preset range. The first threshold can be preset. For example, the first threshold can be set by a technician based on the count of the pixel rows occupied by the privacy indicator. For example, the first threshold can be set to a positive integer such as 8, 9, or 10, and this application embodiment does not limit this.
[0079] For example, the first camera flag (cam_on_pre) can be set to 1.
[0080] If the target color pixel count value (such as green_pix_cnt) is within the preset range, it means that there is a camera status flag in the screen image corresponding to that row of pixels, which meets the characteristics of the camera being turned on, that is, the camera is in the turned-on state; if the target color pixel count value is not within the preset range, it means that there is no camera status flag in the screen image corresponding to that row of pixels, so the first camera flag is not set.
[0081] If the consecutive valid rows are less than or equal to the first threshold, it indicates that the probability of determining that the screen image frame meets the camera-on feature is low. It is necessary to continue detecting the pixels in the next row to further increase the probability of determining the camera-on feature. Therefore, the first camera flag is not set. If the valid row count is greater than the first threshold, it indicates that each row in the consecutive rows includes a flag indicating the camera status, meeting the camera-on feature. Therefore, the first camera flag can be set as valid.
[0082] Since the camera-on indicator typically occupies multiple consecutive rows of pixels in the screen image, by determining whether the number of consecutive valid rows equals a first threshold, the error caused by detecting only a single row can be reduced, thus improving the accuracy of determining the camera status.
[0083] In some implementations, the computer device resets the valid line count value when the start-of-frame marker changes from invalid to valid.
[0084] Optionally, if the target color pixel count value is less than the lower limit of the preset range, the computer device can continue to determine the camera status based on the pixel data of other rows in the preset range in the screen image of that frame; if the target color pixel count value is greater than the upper limit of the preset range, the operation can be terminated and other rows of pixels in the screen image of that frame can no longer be detected.
[0085] If the target color pixel count is less than the lower limit of the preset range, it means that the camera icon may not exist in that row of pixels, so we can continue to check if the pixel data of other rows in this frame of screen image meets the requirements; if the target color pixel count is greater than the upper limit of the preset range, it means that this frame of screen image does not belong to the characteristics of the interface when the camera is turned on, so we can end the operation.
[0086] In some implementations, the operation of the computer device to determine the camera status based on the first camera marker can be as follows: when the frame start marker changes from invalid to valid, assign the value of the first camera marker to the second camera marker; set the first camera marker to invalid; when the second camera marker is valid this time, or when the second camera marker is valid at least a preset number of times in a series of consecutive assignments, determine that the camera status is on; otherwise, determine that the camera status is off.
[0087] The frame start marker changing from invalid to valid means that the current frame of the screen image has been processed and a new frame of the screen image has begun to be processed.
[0088] The second camera is marked with a marker indicating the camera status that needs to be output.
[0089] The preset number of attempts can be set in advance. For example, the preset number of attempts can be set based on experience.
[0090] If the first camera status is marked as valid, then the second camera status is updated to valid; if the first camera status is marked as invalid, then the second camera status is updated to invalid.
[0091] If the second camera marker is valid at least a preset number of times in a series of consecutive assignments, it means that the camera is in an "on" state at least a preset number of times in the processed consecutive screen images, thus confirming that the camera is in an "on" state. If the number of valid assignments to the second camera marker is less than the preset number, it means that the camera is not in an "on" state in the processed consecutive screen images, thus confirming that the camera is in an "on" state. This method of determining the camera state based on consecutive frames improves the anti-interference capability and reliability of camera state determination, enables multi-frame filtering, and avoids the accuracy of camera state determination being affected by special cases (such as breathing effects).
[0092] By using a frame start marker, a final state decision (such as cam_on) can be made immediately based on the processing results of all rows in the previous frame, and the result can be output, allowing the state determination to be updated in real time on a frame-by-frame basis. Furthermore, by assigning the value of the first camera marker to the second camera marker when the frame start marker is valid, and setting the first camera marker to invalid, the camera state is determined after one frame is processed. This not only ensures the determinism and completeness of the camera state, but also allows for outputting the camera state with extremely low fixed processing latency, effectively meeting the real-time requirements for determining the camera state.
[0093] In some implementations, when the start-of-frame marker changes from invalid to valid, the operation of assigning the value of the first camera marker to the second camera marker can be as follows: when the start-of-frame marker changes from invalid to valid, if the first frame count value is equal to m, and the ratio of the second frame count value to the first frame count value is less than or equal to a preset ratio, then the value of the first camera marker is assigned to the second camera marker. The first frame count value is used to count the screen images detected in this round, and the second frame count value is used to count the repeated frames in the screen images detected in this round. m is an integer greater than or equal to 2.
[0094] m can be preset. For example, m can be set to 12, 14, or 16, etc., but this application embodiment does not limit this.
[0095] For example, the preset ratio can be set to 60%, or 70%, etc.
[0096] This method avoids potential misjudgments caused by special circumstances of privacy indicators in the screen video stream (such as breathing effects). Thus, it improves the accuracy of determining the camera's status.
[0097] In some implementations, after assigning the value of the first camera marker to the second camera marker, the computer device resets the first frame count value and the second frame count value to 0 if the frame start marker changes from invalid to valid.
[0098] The following is a detailed explanation of another method for determining the state of a camera provided in the embodiments of this application.
[0099] The method may include the following steps 301 to 303: Step 301: The computer device receives the screen video stream sent by the second device.
[0100] The procedure in step 301 can be referenced above. Figure 2 The description of step 201 in the embodiments will not be repeated here.
[0101] Step 302: The computer device acquires multiple pixel data based on the screen video stream.
[0102] The operation in step 302 can be referred to the above text. Figure 2 The description of step 202 in the embodiments will not be repeated here.
[0103] In some implementations, the computer device may enable a frame start marker at the rising edge of the clock cycle corresponding to the first pixel data of each frame of screen image in one or more frames of screen image; and enable a line end marker at the rising edge of the clock cycle corresponding to the last pixel data of a line of pixel data in each frame of screen image.
[0104] By using the end-of-line marker, an intermediate decision can be made immediately for that line of data. This "process one line as it comes in" approach ensures that the processing speed is almost synchronized with the inflow of pixel data, avoiding the significant delay of waiting for the entire frame to be received before processing. By using the start-of-frame marker, a final state decision (such as cam_on) can be made immediately based on the processing results of all lines in the previous frame, and the result can be output. This ensures that the state judgment can be updated in real time on a "frame" basis.
[0105] In some implementations, the line marker can be set to valid when the start-of-frame marker changes from invalid to valid.
[0106] For example, a line flag (such as valid_line_en) can be set to 1.
[0107] This row is marked as indicating whether the remaining rows of pixel data in a screen image frame will be processed. If the row is marked as valid, the hardware parallel pipeline processes the pixel data in that screen image frame; if the row is marked as invalid, the hardware parallel pipeline does not process the pixel data.
[0108] Step 303: Based on the multiple pixel data, the computer device determines the camera status of the second device through a hardware parallel pipeline triggered by the pixel clock.
[0109] By using the line end marker, an intermediate decision can be made immediately on the line of data. This "process one line at a time" approach makes the processing speed almost synchronized with the speed of pixel data inflow, avoiding the huge delay of waiting for the entire frame of data to be received before processing.
[0110] In some implementations, step 303 can be performed as follows: For any one of the multiple pixel data, the computer device inputs the pixel data into the hardware parallel pipeline at the rising edge of one clock cycle of the pixel clock; the hardware parallel pipeline is used to: determine whether the pixel coordinates corresponding to the pixel data are within a preset range; if the pixel coordinates are within the preset range, determine whether the pixel data belongs to a target color pixel; if the pixel data belongs to a target color pixel, increment the target color pixel count value by 1, the target color pixel count value is used to count the target color pixels in the row of pixels to which the pixel data belongs; if the row end marker is valid, set a first camera marker based on the target color pixel count value, the first camera marker is used to indicate whether the screen image of the frame to which the pixel data belongs meets the camera on feature.
[0111] In this way, the camera status can be determined with relatively simple operations. Compared with the complex and risky operations in related technologies, it can not only efficiently determine the camera status, but also ensure the safety of the second device.
[0112] In some implementations, before the computer device determines whether the pixel coordinates corresponding to the pixel data are within a preset range based on the row marker, if the row marker is valid, it performs the step of determining whether the pixel coordinates corresponding to the pixel data are within a preset range and subsequent steps.
[0113] In some implementations, after the computer device determines whether the pixel coordinates corresponding to the pixel data are within a preset range, if the pixel coordinates are within the preset range, it determines whether the pixel data belongs to a non-black pixel; if the pixel data belongs to a non-black pixel, it increments the non-black pixel count value by 1, and the non-black pixel count value is used to count the non-black pixels in the row to which the pixel data belongs; if the row end mark is valid, it determines whether the non-black pixel count value is greater than or equal to a second threshold; if the non-black pixel count value is greater than or equal to the second threshold, it sets the row mark to invalid.
[0114] For example, whether a pixel is a non-black pixel refers to whether the R, G, and B components of the pixel data are all non-zero.
[0115] Since the chromaticity information of the target color becomes insignificant due to excessive brightness against a bright background, the accuracy of target color pixel recognition may drop sharply, making it easy to miss or falsely detect. Therefore, non-black pixels in a row of pixels can be counted to determine whether there is interference from overly bright areas.
[0116] If the count of non-black pixels is greater than or equal to the second threshold, it indicates that the overall brightness of the pixels in that row is high, which may reduce the accuracy of identifying the target color pixels and lead to false detection. Therefore, the row can be marked as invalid to end the processing of this frame of screen image. If the count of non-black pixels is less than the second threshold, it indicates that the brightness of the pixels in that row is relatively normal and has a low impact on the identification of the target color pixels. Therefore, the row is not marked as invalid and the remaining pixel data in this frame of screen image can continue to be processed.
[0117] In this way, on the one hand, interference from overly bright areas in the screen image can be eliminated in a timely manner, thus improving the accuracy of target color pixel recognition and consequently the accuracy of subsequent camera status determination. On the other hand, invalid frames can be eliminated as early as possible, avoiding the need to continue performing more complex target pixel recognition and line counting logic on known unreliable data, thereby improving computational efficiency and resource utilization.
[0118] In some implementations, the computer device can set the first camera marker based on the target color pixel count value as follows: the computer device determines whether the target color pixel count value is within a preset range; if the target color pixel count value is within the preset range, the valid row count value is incremented by 1; if the target color pixel count value is not within the preset range, the valid row count value is reset; if the valid row count value is greater than a first threshold, the first camera marker is set to valid.
[0119] In some implementations, the operation of the computer device to determine the camera status based on the first camera marker can be as follows: when the frame start marker changes from invalid to valid, assign the value of the first camera marker to the second camera marker; set the first camera marker to invalid; when the second camera marker is valid this time, or when the second camera marker is valid at least a preset number of times in a series of consecutive assignments, determine that the camera status is on; otherwise, determine that the camera status is off.
[0120] To facilitate understanding, the following will be combined with... Figure 3 The camera status determination method provided in the embodiments of this application will be described by way of example. Figure 3 As shown, the camera status determination method may include the following steps 301 to 324.
[0121] Step 301: The computer device detects the start of frame (tuser) marker, and then proceeds to step 302.
[0122] Step 302: After the computer device assigns the value of the first camera marker to the second camera marker (cam_on), it executes step 303 or step 304.
[0123] Step 303: When the second camera flag cam_on=1, the camera is in the on state.
[0124] Step 304: When the second camera flag cam_on=0, the camera is in the off state.
[0125] Step 305: The computer device resets the inline counter, sets the line marker to valid, and sets the first camera marker to invalid.
[0126] Step 306: The computer device waits for pixel input to update the column coordinate rx_pix_cnt and row coordinate rx_line_cnt of the pixel.
[0127] Step 307: The computer device determines whether the current pixel is within a preset row range.
[0128] If the current pixel is within the preset row range, proceed to step 308; otherwise, proceed to step 309.
[0129] Step 308: The computer device determines whether the current pixel is within a preset column range.
[0130] If the current pixel is not in the preset row interval, proceed to step 309; otherwise, proceed to step 310.
[0131] Step 309: The computer device continues processing the next pixel.
[0132] Step 310: The computer device performs inline detection.
[0133] Step 311: The computer device determines whether the pixel data of the current pixel belongs to a non-black pixel.
[0134] If the pixel data of the current pixel belongs to a non-black pixel, then proceed to step 311; otherwise, proceed to step 315.
[0135] Step 312: The computer device increments the non-black pixel count by 1.
[0136] Step 313: The computer device determines whether the pixel data of the current pixel meets the green condition.
[0137] If the pixel data of the current pixel meets the green condition, proceed to step 314; otherwise, proceed to step 315.
[0138] Step 314: The computer device increments the green pixel count by 1.
[0139] Step 315: The computer device determines whether the pixel data of the current pixel is the last pixel data in a row of pixel data.
[0140] If the pixel data of the current pixel is not the last pixel data in the row of pixel data, then execute step 306; otherwise, execute step 316.
[0141] Step 316: The computer device determines whether the count value of non-black pixels is greater than the second threshold.
[0142] If the count of non-black pixels is greater than the second threshold, proceed to step 317; otherwise, proceed to step 318.
[0143] Step 317: The computer device sets the line marker to invalid (i.e., Valid_line_en=0), and then executes step 325.
[0144] Step 318: The computer device determines whether the green pixel count value is within a preset range.
[0145] If the green pixel count is within a preset range, proceed to step 319; otherwise, proceed to step 325.
[0146] Step 319: The computer device increments the valid row count by 1.
[0147] Step 320: The computer device determines whether the valid row count value is greater than the first threshold.
[0148] If the valid row count is greater than the first threshold, proceed to step 321; otherwise, proceed to step 325.
[0149] Step 321: The computer device determines whether the first frame count value is equal to m.
[0150] If the count value of the first frame is equal to m, then proceed to step 322; otherwise, proceed to step 325.
[0151] Step 322: The computer device determines whether the proportion of repeated frames in the m frames is less than a preset ratio.
[0152] If it is determined that the proportion of repeated frames in the m frames is less than the preset ratio, then proceed to step 323; otherwise, proceed to step 324.
[0153] Step 323: The computer device does not assign the value of the first camera tag to the second camera tag.
[0154] Step 324: The computer device assigns the value of the first camera tag to the second camera tag.
[0155] Step 325: The computer device waits for the next line of pixel data or the next frame of screen image.
[0156] For example, the computer device waits for pixel data of the next frame of screen image when the row marker is invalid or the first camera marker is valid; the computer device waits for pixel data of the next row when the target color pixel count value is not within a preset range.
[0157] In this embodiment, the first device receives a screen video stream from the second device, then acquires multiple pixel data based on the screen video stream, and finally determines the camera status of the second device based on the multiple pixel data through a hardware parallel pipeline triggered by a pixel clock. Since the hardware parallel pipeline is a dedicated hardware circuit designed for real-time processing of continuous pixel streams, it includes a series of dedicated hardware logic modules, each responsible for a specific processing step. All modules work synchronously under the drive of the same pixel clock. In each clock cycle of the pixel clock, each module passes its current processing result to the next module and simultaneously receives new data from the previous module. Its operating rhythm is determined by the pixel clock frequency to achieve a "one pixel arrives, one is processed, one is output" pipeline operation. It can achieve deterministic low latency and extremely high data throughput, meeting the real-time requirements for determining the camera status. Furthermore, determining the camera status through a screen video stream prevents malicious applications from bypassing or hijacking it, thus ensuring device operational security.
[0158] Figure 4This is a schematic diagram of a camera status determination device provided in an embodiment of this application. This device can be implemented as part or all of a computer device by software, hardware, or a combination of both. This computer device can be described below. Figure 5 The computer equipment shown. See also Figure 4 The device includes a receiving module 401, an acquisition module 402, and a determining module 403.
[0159] The receiving module 401 is used to receive the screen video stream sent by the second device; The acquisition module 402 is used to acquire multiple pixel data based on the screen video stream; The determination module 403 is used to determine the camera status of the second device based on the multiple pixel data through a hardware parallel pipeline triggered by a pixel clock.
[0160] Optionally, the acquisition module 402 is used for: The screen video stream is parsed to obtain pixel data of one or more frames of screen images; Optionally, the device further includes: The first setting module is used to set the frame start mark to be valid at the rising edge of the clock cycle corresponding to the first pixel data of each frame screen image in the one or more frames of screen images. The second setting module is used to set the line end marker to be valid at the rising edge of the clock cycle corresponding to the last pixel data in a line of pixel data of each frame of screen image.
[0161] Optionally, the determining module 403 is used for: For any one of the multiple pixel data, the pixel data is input into the hardware parallel pipeline at the rising edge of one clock cycle of the pixel clock. The hardware parallel pipeline is used to: determine whether the pixel coordinates corresponding to the pixel data are within a preset range; if the pixel coordinates are within the preset range, determine whether the pixel data belongs to a target color pixel; if the pixel data belongs to a target color pixel, increment the target color pixel count value by 1, the target color pixel count value is used to count the target color pixels in the row to which the pixel data belongs; if the row end marker is valid, set a first camera marker based on the target color pixel count value, the first camera marker is used to indicate whether the screen image of the frame to which the pixel data belongs meets the camera on feature; This hardware parallel pipeline is also used to: determine the state of the camera based on the first camera marker.
[0162] Optionally, the hardware parallel pipeline is also used to reset the target color pixel count value on the rising edge of the next clock cycle if the line end marker changes from invalid to valid.
[0163] Optionally, the determining module 403 is used for: Determine whether the target color pixel count value is within a preset range; If the target color pixel count value is within the preset range, increment the valid row count value by 1; If the target color pixel count value is not within the preset range, reset the count value of the valid row. If the number of valid rows is greater than the first threshold, the first camera is marked as valid.
[0164] Optionally, the determining module 403 is used for: If the start-of-frame marker changes from invalid to valid, assign the value of the first camera marker to the second camera marker; otherwise, set the first camera marker to invalid. If the value assigned to the second camera marker is valid, or if the second camera marker is valid at least a preset number of times in a series of consecutive assignments, the camera is determined to be in the on state; otherwise, the camera is determined to be in the off state.
[0165] Optionally, the hardware parallel pipeline is also used to: set the line marker to valid if the start-of-frame marker changes from invalid to valid.
[0166] Optionally, the determining module 403 is used for: If the frame start marker changes from invalid to valid, and the first frame count value is equal to m, and the ratio of the second frame count value to the first frame count value is less than or equal to a preset ratio, then the value of the first camera marker is assigned to the second camera marker. The first frame count value is used to count the screen images detected in this round, and the second frame count value is used to count the repeated frames in the screen images detected in this round. m is an integer greater than or equal to 2.
[0167] Optionally, the device further includes: The execution module is used to perform the step of determining whether the pixel coordinates corresponding to the pixel data are within a preset range, and subsequent steps, when the row is marked as valid.
[0168] Optionally, the device further includes: The judgment module is used to determine whether the pixel data belongs to a non-black pixel when the pixel coordinates are within a preset range; The counting module is used to increment the non-black pixel count value by 1 when the pixel data belongs to a non-black pixel. The non-black pixel count value is used to count the non-black pixels in the row of pixels to which the pixel data belongs. The judgment module is used to determine whether the count value of the non-black pixel is greater than the second threshold when the row end mark is valid; The third setting module is used to set the row marker to invalid if the non-black pixel count value is greater than the second threshold.
[0169] In this embodiment, multiple pixel data are acquired based on the screen video stream. Based on this multiple pixel data, the camera status of the second device is determined through a hardware parallel pipeline triggered by a pixel clock. Since the hardware parallel pipeline is a dedicated hardware circuit designed for real-time processing of continuous pixel streams, it includes a series of dedicated hardware logic modules, each responsible for a specific processing step. All modules operate synchronously under the drive of the same pixel clock. In each clock cycle of the pixel clock, each module passes its current processing result to the next module and simultaneously receives new data from the previous module. Its operating rhythm is determined by the pixel clock frequency to achieve a "one pixel arrives, one is processed, one is output" pipeline operation. It can achieve deterministic low latency and extremely high data throughput, meeting the real-time requirements for determining the camera status. Furthermore, determining the camera status through multiple pixel data corresponding to the screen video stream prevents malicious applications from bypassing or hijacking it, or causing unrecognizable features, thus ensuring device operational security.
[0170] It should be noted that the camera state determination device provided in the above embodiments is only illustrated by the division of the above functional modules when determining the camera state. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0171] The functional modules in the above embodiments can be integrated into one processing unit, or each functional module can exist as a separate physical processing unit, or two or more functional modules can be integrated into one processing unit. The processing unit can be implemented in hardware or software. Furthermore, the specific names of the functional modules are only for easy differentiation and are not intended to limit the scope of protection of the embodiments of this application.
[0172] The camera state determination device and the camera state determination method provided in the above embodiments belong to the same concept. The specific working process and technical effects of the functional modules in the above embodiments can be found in the method embodiments section, and will not be repeated here.
[0173] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 5 As shown, the computer device 5 includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, it implements the steps in the camera state determination method in the above embodiments.
[0174] Computer device 5 can be a general-purpose computer device or a special-purpose computer device. In specific implementations, computer device 5 can be a desktop computer, portable computer, network server, handheld computer, mobile phone, tablet computer, wireless terminal device, communication device, or embedded device. This application embodiment does not limit the type of computer device 5. Those skilled in the art will understand that... Figure 5 The computer device 5 is merely an example and does not constitute a limitation on the computer device 5. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0175] Processor 50 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0176] In some embodiments, memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or RAM of the computer device 5. In other embodiments, memory 51 may be an external storage device of the computer device 5, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device 5. Furthermore, memory 51 may include both internal storage units and external storage devices of the computer device 5. Memory 51 is used to store the operating system, applications, boot loader, data, and other programs. Memory 51 may also be used to temporarily store data that has been output or will be output.
[0177] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0178] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0179] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0180] This application provides a computer program product that, when run on a computer, causes the computer to perform the steps described in the various method embodiments above.
[0181] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above method embodiments of this application can be implemented by a computer program. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable storage medium can include at least: any entity or device capable of carrying computer program code to a computer device, recording media, computer memory, read-only memory (ROM), random access memory (RAM), compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage devices. The computer-readable storage medium mentioned in this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.
[0182] It should be understood that all or part of the steps of the above embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-described computer-readable storage medium.
[0183] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0184] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, i.e., they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this application according to actual needs.
[0185] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0186] The embodiments described above are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for determining the state of a camera, characterized in that, Applied to a first device, the method includes: Receive screen video stream sent by the second device; Multiple pixel data are acquired based on the screen video stream; Based on the multiple pixel data, the camera status of the second device is determined through a hardware parallel pipeline triggered by a pixel clock.
2. The method as described in claim 1, characterized in that, The acquisition of multiple pixel data based on the screen video stream includes: The screen video stream is parsed to obtain pixel data of one or more frames of screen images; The method further includes: The rising edge of the clock cycle corresponding to the first pixel data of each frame of the screen image in the one or more frames of screen images sets the frame start marker to be valid; The rising edge of the clock cycle corresponding to the last pixel data in a row of pixel data in each frame of the screen image sets the row end marker to be valid.
3. The method as described in claim 1, characterized in that, The step of determining the camera status of the second device based on the multiple pixel data through a hardware parallel pipeline includes: For any one of the plurality of pixel data, the pixel data is input into the hardware parallel pipeline at the rising edge of one clock cycle of the pixel clock; The hardware parallel pipeline is used to: determine whether the pixel coordinates corresponding to the pixel data are within a preset range; if the pixel coordinates are within the preset range, determine whether the pixel data belongs to a target color pixel; if the pixel data belongs to a target color pixel, increment the target color pixel count value by 1, the target color pixel count value being used to count the target color pixels in a row of pixels to which the pixel data belongs; if the row end marker is valid, set a first camera marker based on the target color pixel count value, the first camera marker being used to indicate whether a frame of screen image to which the pixel data belongs satisfies the camera on feature; The hardware parallel pipeline is also used to: determine the camera state based on the first camera tag.
4. The method as described in claim 3, characterized in that, The hardware parallel pipeline is also used to: reset the target color pixel count value on the rising edge of the next clock cycle when the line end marker changes from invalid to valid.
5. The method as described in claim 3, characterized in that, Setting the first camera marker based on the target color pixel count value includes: Determine whether the target color pixel count value is within a preset range; If the target color pixel count value is within a preset range, increment the valid row count value by 1; If the target color pixel count value is not within the preset range, reset the valid row count value; If the number of valid rows is greater than the first threshold, the first camera is marked as valid.
6. The method as described in claim 3, characterized in that, Determining the camera status based on the first camera marker includes: If the start-of-frame marker changes from invalid to valid, assign the value of the first camera marker to the second camera marker; or set the first camera marker to invalid. If the second camera flag is valid in this assignment, or if the second camera flag is valid at least a preset number of times in a series of consecutive assignments, the camera is determined to be in an on state; otherwise, the camera is determined to be in a off state.
7. The method as described in claim 6, characterized in that, The step of assigning the value of the first camera marker to the second camera marker when the frame start marker changes from invalid to valid includes: When the frame start marker changes from invalid to valid, if the first frame count value is equal to m, and the ratio of the second frame count value to the first frame count value is less than or equal to a preset ratio, then the value of the first camera marker is assigned to the second camera marker. The first frame count value is used to count the screen images detected in this round, and the second frame count value is used to count the repeated frames in the screen images detected in this round. The m is an integer greater than or equal to 2.
8. The method as described in any one of claims 3 to 7, characterized in that, The hardware parallel pipeline is also used to: set the line marker to valid when the start-of-frame marker changes from invalid to valid; Before determining whether the pixel coordinates corresponding to the pixel data are within a preset range, the method further includes: If the row marker is valid, the step of determining whether the pixel coordinates corresponding to the pixel data are within a preset range and subsequent steps are executed. After determining whether the pixel coordinates corresponding to the pixel data are within a preset range, the method further includes: If the pixel coordinates are within a preset range, determine whether the pixel data belongs to a non-black pixel; if the pixel data belongs to a non-black pixel, increment the non-black pixel count by 1. The non-black pixel count is used to count the non-black pixels in the row to which the pixel data belongs; if the row end mark is valid, determine whether the non-black pixel count is greater than or equal to a second threshold; if the non-black pixel count is greater than or equal to the second threshold, set the row mark to invalid.
9. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the computer program, when executed by the processor, implements the method as claimed in any one of claims 1 to 8.
10. A computer program product, characterized in that, When the computer program product is run on a computer device, the computer device causes the computer device to perform the method as described in any one of claims 1 to 8.