DETECTION CIRCUIT
20230215012 · 2023-07-06
Inventors
Cpc classification
International classification
Abstract
A detection circuit includes a first pulse sequence generator configured to generate a first pulse sequence based on a first signal and a second pulse sequence generator configured to generate a second pulse sequence based on a second signal. Amplitudes and frequencies of the first signal and the second signal are different. The detection circuit further includes a first conductance device configured to receive the first pulse sequence to generate a first conductance, a second conductance device configured to receive the second pulse sequence to generate a second conductance, and a difference detection circuit configured to, when both the first conductance device and the second conductance device receive a third signal, output a voltage representing a difference between the first conductance and the second conductance. The detection circuit can be applied to an image edge detection scenario.
Claims
1. A detection circuit, comprising: a first pulse sequence generator and a second pulse sequence generator, the first pulse sequence generator being configured to receive a first signal and generate a first pulse sequence based on the first signal, the second pulse sequence generator being configured to receive a second signal, and generate a second pulse sequence based on the second signal, wherein amplitudes of the first signal and the second signal are different, and wherein frequencies or amplitudes of the first pulse sequence and the second pulse sequence are different; a first conductance device and a second conductance device, the first conductance device being configured to receive the first pulse sequence to generate a first conductance, the second conductance device being configured to receive the second pulse sequence to generate a second conductance, wherein the first conductance device and the second conductance device are further configured to separately receive a third signal; and a difference detection circuit, configured to connect to the first conductance device and the second conductance device and to output a difference voltage when both the first conductance device and the second conductance device receive the third signal, the difference voltage representing a difference between the first conductance and the second conductance.
2. The detection circuit according to claim 1, wherein the first conductive device is configured such that the first conductance of the first conductance device varies with a frequency or an amplitude of the first pulse sequence received by the first conductance device, and wherein the second conductive device is configured such that the second conductance of the second conductance device varies with a frequency or an amplitude of the second pulse sequence received by the second conductance device.
3. The detection circuit according to claim 2, wherein the first conductive device is configured such that the first conductance of the first conductance device increases as the frequency of the first pulse sequence received by the first conductance device increases, and wherein the second conductive device is configured such that the second conductance of the second conductance device increases as the frequency of the second pulse sequence received by the second conductance device increases.
4. The detection circuit according to claim 2, wherein the first conductive device is configured such that the first conductance of the first conductance device increases as the amplitude of the first pulse sequence received by the first conductance device increases, and wherein the second conductive device is configured such that the second conductance of the second conductance device increases as the frequency of the second pulse sequence received by the second conductance device increases.
5. The detection circuit according to claim 1, wherein the first conductive device is configured such that the first conductance of the first conductance device increases as a quantity of pulses in the pulse sequence received by the first conductance device increases, and wherein the second conductive device is configured such that the second conductance of the second conductance device increases as the frequency of the pulse sequence received by the second conductance device increases.
6. The detection circuit according to claim 1, wherein the first conductance device and the second conductance device are volatile devices; wherein, at a first moment, the first conductance device is configured to receive the first pulse sequence, and the second conductance device is configured to receive the second pulse sequence; wherein, at a second moment, the first conductance device and the second conductance device are configured to separately receive the third signal; and a time interval between the first moment and the second moment is less than or equal to an interval threshold.
7. The detection circuit according to claim 1, wherein the first conductance device and the second conductance device are non-volatile devices; the first conductance device is further configured to, after the difference detection circuit outputs the difference voltage, initialize the conductance of the first conductance device; and wherein the second conductance device is further configured to, after the difference detection circuit outputs the difference voltage, initialize the conductance of the second conductance device.
8. The detection circuit according to claim 1, wherein both the first signal and the second signal are current signals or voltage signals.
9. The detection circuit according to claim 1, wherein the amplitudes of the first pulse sequence and the second pulse sequence are both greater than or equal to a first threshold; and wherein an amplitude of the third signal is less than the first threshold.
10. The detection circuit according to claim 1, wherein the first signal is an analog signal corresponding to a grayscale value of a first pixel in a to-be-detected image; wherein the second signal is an analog signal corresponding to a grayscale value of a second pixel in the to-be-detected image; and wherein the first pixel is adjacent to the second pixel.
11. The detection circuit according to claim 10, wherein the detection circuit further comprises: a first differential amplifier, comprising a first input end configured to receive the difference voltage, a second input end configured to receive a reference voltage, and an output configured to output a voltage representing a gradient between the grayscale values of the first pixel and the second pixel.
12. The detection circuit according to claim 10, wherein one pixel pair in the to-be-detected image corresponds to the detection circuit; and wherein the pixel pair comprises two adjacent pixels in a same row in the to-be-detected image, or two adjacent pixels in a same column in the to-be-detected image.
13. A system comprising: the detection circuit according to claim 12, wherein a first pixel pair in the to-be-detected image corresponds to the detection circuit; and a second detection circuit, wherein a second pixel pair in the to-be-detected image corresponds to the second detection circuit; wherein both the first pixel pair and the second pixel pair comprise a same pixel; wherein the detection circuit and the second detection circuit share a same branch, and wherein the shared branch comprises the first pulse sequence generator and the first conductance device, or the shared branch comprises the second pulse sequence generator and the second conductance device.
14. A system comprising: the detection circuit according to claim 12, wherein a first pixel pair in the to-be-detected image corresponds to the detection circuit; a second detection circuit, wherein a second pixel pair in the to-be-detected image corresponds to a second detection circuit; wherein both the first pixel pair and the second pixel pair comprise a same pixel; and wherein the detection circuit and the second detection circuit share a pulse sequence generator corresponding to the same pixel.
15. A system comprising: the system according to claim 14, a third detection circuit, wherein a third pixel pair in the to-be-detected image corresponds to the third detection circuit; a fourth detection circuit, wherein a fourth pixel pair in the to-be-detected image corresponds to the fourth detection circuit; wherein both the third pixel pair and the fourth pixel pair comprise the same pixel; and wherein the third detection circuit and the fourth detection circuit share a pulse sequence generator corresponding to the same pixel.
16. The detection circuit according to claim 1, wherein the difference detection circuit comprises: a first resistor, a second resistor, and a differential amplifier; wherein the first pulse sequence generator, the first conductance device, and the first resistor are sequentially connected in series, and a connection point between the first resistor and the first conductance device is connected to a first input end of the differential amplifier; wherein the second pulse sequence generator, the second conductance device, and the second resistor are sequentially connected in series, and a connection point between the second resistor and the second conductance device is connected to the other input end of the differential amplifier; and an output end of the differential amplifier is used as an output end of the difference detection circuit.
17. A detection circuit, comprising: a first pulse sequence generator configured to receive a first signal having a first amplitude and a first frequency and to generate a first pulse sequence based on the first signal; a second pulse sequence generator configured to receive a second signal having a second amplitude and a second frequency and to generate a second pulse sequence based on the second signal, wherein the first and the second amplitudes are different, and wherein the first and the second frequencies are different; a first conductance device configured to receive the first pulse sequence and the second pulse sequence to generate a first conductance; a second conductance device configured to receive the first pulse sequence and the second pulse sequence to generate a second conductance; a first resistor and a second resistor, wherein the first conductance device and the first resistor are sequentially connected in series, and wherein the second resistor and the second conductance device are sequentially connected in series; and an output end of the detection circuit, being a connection point between the first resistor and the second resistor, configured to output a difference voltage representing a difference between the first conductance and the second conductance.
18. The detection circuit according to claim 17, wherein the first conductance device and the second conductance device are configured such that the first conductance of the first conductance device and the second conductance of the second conductance device change with a frequency of a pulse sequence received by each of the first conductance device and the second conductance device.
19. The detection circuit according to claim 18, wherein the first conductance device and the second conductance device are configured such that the first conductance of the first conductance device and the second conductance of the second conductance device increase as a frequency of a positive pulse sequence received by each of the first conductance device and the second conductance device each increases and decrease as a frequency of a negative pulse sequence received by each of the first conductance device and the second conductance device increases.
20. The detection circuit according to claim 17, wherein the first conductance device and the second conductance device are configured such that the first conductance of the first conductance device and the second conductance of the second conductance device increase as a quantity of pulses in a respective positive pulse sequence received by each of the first conductance device and the second conductance device each increases, and decrease as a quantity of pulses in a respective negative pulse sequence received by each of the first conductance device and the second conductance device increases.
Description
BRIEF DESCRIPTION OF DRAWINGS
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
DESCRIPTION OF EMBODIMENTS
[0071] In embodiments, the word “example”, “for example”, or the like is used to represent giving an example, an illustration, or a description. Any embodiment or design scheme described as “example” or “for example” in embodiments of this application should not be explained as being more preferred or having more advantages than another embodiment or design scheme. Exactly, use of the word “example”, “for example”, or the like is intended to present a related concept in a specific manner.
[0072] The terms “first” and “second” in embodiments of this application are merely intended for a purpose of description, and shall not be understood as an indication or implication of relative importance or implicit indication of a quantity of indicated technical features. Therefore, a feature limited by “first” or “second” may explicitly or implicitly include one or more features. In the descriptions, unless otherwise stated, “a plurality of” means two or more than two.
[0073] The term “at least one” means one or more, and the term “a plurality of” means two or more. For example, a plurality of second packets mean two or more second packets.
[0074] It should be understood that the terms used in the descriptions of various examples in this specification are merely intended to describe specific examples, but are not intended to constitute a limitation. The terms “one” (“a” and “an”) and “the” of singular forms used in the descriptions of various examples and the appended claims are also intended to include plural forms, unless otherwise specified in the context clearly.
[0075] It should be further understood that, the term “and/or” used in this specification indicates and includes any or all possible combinations of one or more items in associated listed items. The term “and/or” describes an association relationship between associated objects and represents that three relationships may exist. For example, A and/or B may represent the following three cases: Only A exists, both A and B exist, and only B exists. In addition, the character “/” generally indicates an “or” relationship between associated objects.
[0076] It should be further understood that sequence numbers of processes do not mean execution sequences in embodiments. The execution sequences of the processes should be determined based on functions and internal logic of the processes, and should not be construed as any limitation on the implementation processes of embodiments described herein.
[0077] It should be understood that determining B based on A does not mean that B is determined based on only A, but B may alternatively be determined based on A and/or other information.
[0078] It should be further understood that the term “include” (or referred to as “includes”, “including”, “comprises”, and/or “comprising”), when being used in this specification, specifies the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
[0079] It should be further understood that the term “if” may be interpreted as a meaning “when” (“when” or “upon”), “in response to determining”, or “in response to detecting”. Similarly, according to the context, the phrase “if it is determined that” or “if (a stated condition or event) is detected” may be interpreted as a meaning of “when it is determined that”, “in response to determining”, “when (a stated condition or event) is detected”, or “in response to detecting (a stated condition or event)”.
[0080] It should be understood that “one embodiment”, “an embodiment”, and “a possible implementation” mentioned in the entire specification mean that particular features, structures, or characteristics related to the embodiment or the implementation are included in at least one embodiment. Therefore, “in one embodiment”, “in an embodiment”, or “in a possible implementation” appearing throughout this specification does not necessarily mean a same embodiment. In addition, these particular features, structures, or characteristics may be combined in one or more embodiments by using any appropriate manner.
[0081] With reference to the accompanying drawings, the following describes the technical solutions provided in embodiments.
[0082]
[0083] The detection circuit 1 includes: a first pulse sequence generator 10, a second pulse sequence generator 20, a first conductance device 30, a second conductance device 40, and a difference detection circuit 50.
[0084] The first pulse sequence generator 10 is configured to receive a first signal, and generate a first pulse sequence based on the first signal.
[0085] The second pulse sequence generator 20 is configured to receive a second signal, and generate a second pulse sequence based on the second signal. Amplitudes of the first signal and the second signal are different, and frequencies or amplitudes of the first pulse sequence and the second pulse sequence are different.
[0086] The first conductance device 30 is configured to receive the first pulse sequence to generate a first conductance.
[0087] The second conductance device 40 is configured to receive the second pulse sequence to generate a second conductance.
[0088] The first conductance device 30 and the second conductance device 40 are further configured to separately receive a third signal.
[0089] The difference detection circuit 50 is configured to connect to the first conductance device 30 and the second conductance device 40.
[0090] The difference detection circuit 50 is further configured to output a difference voltage when both the first conductance device 30 and the second conductance device 40 receive the third signal. The difference voltage is used to represent a difference between the first conductance and the second conductance.
[0091] Optionally, both the first signal and the second signal are current signals or voltage signals.
[0092] The first signal and the second signal may be different based on different application scenarios of the detection circuit 1. For example, if the detection circuit 1 is configured to detect a difference between grayscale values of two pixels, the first signal and the second signal may be current signals (or voltage signals) obtained after the grayscale values of the two pixels are converted. For another example, if the detection circuit 1 is configured to detect a difference between two characters, the first signal and the second signal may be current signals (or voltage signals) obtained after the two characters are converted.
[0093] Optionally, the first pulse sequence generator 10 and the second pulse sequence generator 20 have a same hardware structure and a same hardware parameter.
[0094] For example, the first pulse sequence generator 10 and the second pulse sequence generator 20 are pulse sequence generators of a same model. In this way, a difference between the frequencies or the amplitudes of the first pulse sequence and the second pulse sequence caused by a hardware difference between the first pulse sequence generator 10 and the second pulse sequence generator 20 can be reduced, so that a difference between the first pulse sequence and the second pulse sequence can more accurately represent a difference between the first signal and the second signal, and a detection result of the detection circuit 1 is more accurate.
[0095] Optionally, the first conductance device 30 and the second conductance device 40 have a same hardware structure, and have a same initial hardware parameter.
[0096] That the first conductance device 30 and the second conductance device 40 have a same initial hardware parameter means that an initial conductance of the first conductance device 30 is the same as an initial conductance of the second conductance device 40, or a difference between the initial conductances is within a preset range. For example, the first conductance device 30 and the second conductance device 40 are conductance devices of a same model. In this way, a difference between the first conductance and the second conductance caused by a hardware difference between the first conductance device 30 and the second conductance device 40 can be reduced, so that a difference between the first conductance and the second conductance can more accurately represent a difference between the first pulse sequence and the second pulse sequence, and can more accurately represent a difference between the first signal and the second signal, and a detection result of the detection circuit 1 is more accurate.
[0097] Optionally, directions of the first pulse sequence and the second pulse sequence are the same. For example, the first pulse sequence is a positive pulse sequence relative to the first conductance device 30, and the second pulse sequence is a positive pulse sequence relative to the second conductance device 40. For example, the first pulse sequence is a negative pulse sequence relative to the first conductance device 30, and the second pulse sequence is a negative pulse sequence relative to the second conductance device 40.
[0098] In this case, as shown in
[0099] Optionally, both the first pulse sequence and the second pulse sequence may include one or more pulses. Correspondingly, other pulse sequences in the following, such as a third pulse sequence and a fourth pulse sequence, may also include one or more pulses. When the pulse sequence includes one pulse, the pulse sequence is specifically a single pulse.
[0100] Optionally, duration for receiving the first pulse sequence by the first conductance device 30 is the same as duration for receiving the second pulse sequence by the second conductance device 40. In other words, the first pulse sequence and the second pulse sequence respectively function on the first conductance device 30 and the second conductance device 40 for same duration.
[0101] In the detection circuit 1, the first conductance device 30 and the second conductance device 40 have electrical characteristics as follows.
[0102] Optionally, a conductance of each of the first conductance device 30 and the second conductance device 40 changes with a quantity of pulses in a pulse sequence received by each of the first conductance device 30 and the second conductance device 40.
[0103] For example, the conductance of each of the first conductance device 30 and the second conductance device 40 increases, for example, increases linearly as the quantity of pulses in the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0104] For another example, the conductance of each of the first conductance device 30 and the second conductance device 40 separately decreases, for example, decreases linearly as the quantity of pulses in the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0105] In some optional implementations, a conductance of each of the first conductance device 30 and the second conductance device 40 changes with a frequency of a pulse sequence received by each of the first conductance device 30 and the second conductance device 40. In this case, the detection circuit 1 may convert the difference between the first signal and the second signal into a difference between the frequencies of the first pulse sequence and the second pulse sequence.
[0106] For example, the conductance of each of the first conductance device 30 and the second conductance device 40 increases, for example, increases linearly as the frequency of the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0107] For another example, the conductance of each of the first conductance device 30 and the second conductance device 40 separately decreases, for example, decreases linearly as the frequency of the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0108]
[0109] It can be learned from
[0110] In some other optional implementations, a conductance of each of the first conductance device 30 and the second conductance device 40 changes with an amplitude of a pulse sequence received by each of the first conductance device 30 and the second conductance device 40. In this case, the detection circuit 1 may convert a difference between a first signal and a second signal into a difference between amplitudes of a first pulse sequence and a second pulse sequence.
[0111] For example, the conductance of each of the first conductance device 30 and the second conductance device 40 increases, for example, increases linearly as the amplitude of the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0112] For another example, the conductance of each of the first conductance device 30 and the second conductance device 40 separately decreases, for example, decreases linearly as the amplitude of the pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0113]
[0114] It can be learned from
[0115] In this embodiment, a specific form of the conductance device having the characteristic shown in
[0116] Optionally, amplitudes of both a first pulse sequence and a second pulse sequence are greater than or equal to a first threshold.
[0117] Optionally, an amplitude of a third signal is less than a first threshold.
[0118] The first threshold is a critical value of an amplitude of a signal input to a conductance device when a conductance of the conductance device can be changed. In other words, the first pulse sequence can change the conductance of the first conductance device 30, and the second pulse sequence can change the conductance of the second conductance device 40. The third signal neither can change the conductance of the first conductance device 30 nor can change the conductance of the second conductance device 40. A value of the first threshold is related to properties of the first conductance device 30 and the second conductance device 40.
[0119] Optionally, the third signal may be a voltage signal or a current signal. In this embodiment, a specific form of the third signal is not limited. For example, the third signal may be a wide pulse sequence (or a single pulse), that is, a pulse sequence (or a single pulse) whose pulse width is greater than or equal to a specific threshold. The third signal may be predefined.
[0120] For example, the third signal may be generated by a power supply independent of the detection circuit 1 shown in
[0121] A working principle of the detection circuit 1 is described below.
[0122] Step 1: Convert a difference between a first signal and a second signal into a difference between the frequencies/amplitudes of the first pulse sequence and the second pulse sequence, and then convert the difference into a difference between a first conductance and a second conductance.
[0123] To implement this process, the detection circuit 1 may further include a resistor 31 and a resistor 41. A connection relationship between the resistor 31 and the resistor 41, and another device in the detection circuit 1 may be shown in
[0124] An implementation process of this step may also be shown in
[0125] Step 2: Detect the difference between the first conductance and the second conductance.
[0126] An implementation process of this step may be shown in
[0127] Optionally, the third signal may be signals separately generated by the first pulse sequence generator 10 and the second pulse sequence generator 20. In this case, an implementation process of this step may be shown in
[0128] A specific implementation of the difference detection circuit 50 is not limited in this embodiment. For example, as shown in
[0129] The first pulse sequence generator 10, the first conductance device 30, and the first resistor 501 are sequentially connected in series, and a “connection point between the first resistor 501 and the first conductance device 30” is connected to one input end of the second differential amplifier 503.
[0130] The second pulse sequence generator 20, the second conductance device 40, and the second resistor 502 are sequentially connected in series, and a “connection point between the second resistor 502 and the second conductance device 40” is connected to the other input end of the second differential amplifier 503.
[0131] An output end of the second differential amplifier 503 is used as an output end of the difference detection circuit 50.
[0132] It should be noted that, when the difference detection circuit 50 is implemented by using
[0133] Optionally, the first resistor 501 and the second resistor 502 are the same. In this way, the first resistor 501 and the second resistor 502 have a same voltage division degree in step 1 and step 2, so that the difference between the first conductance and the second conductance can more accurately represent the difference between the first pulse sequence and the second pulse sequence, and can accurately represent the difference between the first signal and the second signal, and a detection result of the detection circuit 1 is more accurate.
[0134] It can be learned from
[0135] It should be noted that, in a case in which generation conditions and detection conditions of the first conductance and the second conductance are the same, for example, the first pulse sequence generator 10 and the second pulse sequence generator 20 are pulse sequence generators of a same model, the first conductance device 30 and the second conductance device 40 are conductance devices of a same model, and the first resistor 501 and the second resistor 502 are the same, a larger difference between the first conductance and the second conductance indicates a larger difference between the first signal and the second signal.
[0136] Optionally, the first conductance device 30 and the second conductance device 40 are volatile devices. Specifically, the first conductance generated by the first conductance device 30 and the second conductance generated by the second conductance device 40 may be both maintained for a specific time period, and when the time period ends, the first conductance and the second conductance are respectively initialized to the first initial conductance and the second initial conductance. For example, the volatile device may include a diffusive memristor, a dynamic resistive random access memory with weak initialization processing, or the like.
[0137] In this case, at a first moment, the first conductance device 30 receives the first pulse sequence, and the second conductance device 40 receives the second pulse sequence. At a second moment, the first conductance device 30 and the second conductance device separately receive the third signal. A time interval between the first moment and the second moment is less than or equal to an interval threshold.
[0138] A specific moment (for example, the first moment and the second moment) may not be a strict moment. For example, if a time interval between two time points is less than or equal to a threshold, the two time points may be used as a same moment.
[0139] The interval threshold is determined based on a time period in which the first conductance is maintained and a time period in which the second conductance is maintained. For example, the interval threshold is less than “a smallest value of the time period in which the first conductance is maintained and the time period in which the second conductance is maintained”. If a model of the first conductance device 30 is the same as a model of the second conductance device 40, the time period in which the first conductance is maintained is the same as the time period in which the second conductance is maintained.
[0140] It should be noted that “at a first moment, the first conductance device 30 receives the first pulse sequence, and the second conductance device 40 receives the second pulse sequence” may be replaced with the following: at a first moment, the first conductance device 30 generates the first conductance, and the second conductance device 40 generates the second conductance. In this way, a new embodiment is obtained.
[0141] Further, the optional implementation may be understood as follows. When the first conductance device 30 and the second conductance device 40 are volatile devices, in a specific time period starting from an end moment of a process of “converting the difference between the first signal and the second signal into the difference between the first conductance and the second conductance” (or in a specific time period starting from a specific moment in the process), a process of “detecting the difference between the first conductance and the second conductance” is performed.
[0142] Optionally, the first conductance device 30 and the second conductance device 40 are non-volatile devices. In other words, the first conductance generated by the first conductance device 30 and the second conductance generated by the second conductance device 40 do not disappear after being generated. For example, the non-volatile device includes a CBRAM and the like.
[0143] In this case, the first conductance device 30 is further configured to: after the difference detection circuit 50 outputs the difference voltage, initialize the conductance of the first conductance device 30, that is, initialize the first conductance to the first initial conductance. The second conductance device 40 is further configured to: after the difference detection circuit 50 outputs the difference voltage, initialize the conductance of the second conductance device 40 that is, and initialize the second conductance to the second initial conductance. In this way, subsequently, the detection circuit 1 may be directly used to measure a difference between a new first signal and a new second signal.
[0144] In this embodiment, a specific implementation of initializing the conductance of the first conductance device 30 and the conductance of the second conductance device 40 is not limited.
[0145] In a possible implementation, if a conductance of each of the first conductance device 30 and the second conductance device 40 changes with a frequency of a pulse sequence received by each of the first conductance device 30 and the second conductance device 40, the conductance of the first conductance device 30 and the conductance of the second conductance device 40 may be initialized in the following manner: The first conductance device 30 is further configured to receive a fourth pulse sequence, where the fourth pulse sequence and the first pulse sequence have a same frequency and opposite directions. The second conductance device 40 is further configured to receive a fifth pulse sequence, where the fifth pulse sequence and the second pulse sequence have a same frequency and opposite directions.
[0146] In another possible implementation, if a conductance of each of the first conductance device 30 and the second conductance device 40 changes with an amplitude of a pulse sequence received by each of the first conductance device 30 and the second conductance device 40, the conductance of the first conductance device 30 and the conductance of the second conductance device 40 may be initialized in the following manner: The first conductance device 30 is further configured to receive a sixth pulse sequence, where the sixth pulse sequence and the first pulse sequence have a same amplitude and opposite directions. The second conductance device 40 is further configured to receive a seventh pulse sequence, where the seventh pulse sequence and the second pulse sequence have a same amplitude and opposite directions.
[0147] According to the detection circuit 1 provided in this embodiment, a difference between the amplitudes of the first signal and the second signal is converted into the difference between the frequencies or the amplitudes of the pulse sequences, and then is converted into the difference between the first conductance and the second conductance. In this way, the difference between the first signal and the second signal can be indirectly detected by detecting the difference between the first conductance and the second conductance. The detection circuit 1 may be applied to an image edge detection scenario, to reduce calculation steps, improve calculation efficiency, and reduce power consumption of a device.
[0148] In one aspect, for each pixel in a to-be-detected image, there are at most four pixels adjacent to the pixel. Therefore, by using the detection circuit 1, a difference between a grayscale value of one pixel and grayscale values of all adjacent pixels of the pixel can be obtained by performing calculation for at most four times. However, in a conventional technology, when a convolution algorithm is used to calculate a difference between grayscale values of adjacent pixels, a magnitude of a convolution kernel is usually large, which causes a large quantity of calculation steps. For example, for a 3*3 convolution kernel, for each pixel in the to-be-detected image, 10 operations (specifically including nine product operations and one summation operation) need to be computed, to obtain the difference between a grayscale value of the pixel and grayscale values of all adjacent pixels of the pixel. Using the detection circuit 1 helps reduce calculation steps, improve calculation efficiency, and reduce power consumption of a device.
[0149] In another aspect, for the entire to-be-detected image, a detection circuit 1 may be designed for each adjacent pixel pair. Some devices shown in examples in
[0150] A specific example is used below to describe an application of the detection circuit 1 provided above.
[0151] This example is described by using an example in which the detection circuit 1 provided above is applied to an image edge detection scenario. Because each pixel corresponds to one grayscale value, edge detection is to find a location at which a grayscale value changes sharply, that is, to distinguish a difference between grayscale values of two adjacent pixels, so as to determine whether the two pixels are edge pixels.
[0152] Based on this, in this scenario, the first signal is an analog signal corresponding to a grayscale value of a first pixel in the to-be-detected image. The second signal is an analog signal corresponding to a grayscale value of a second pixel in the to-be-detected image. The first pixel is adjacent to the second pixel. For example, the first pixel and the second pixel may be two adjacent pixels in any row of the to-be-detected image. For another example, the first pixel and the second pixel may be two adjacent pixels in any column of the to-be-detected image. The analog signals are both current signals or voltage signals.
[0153] Specifically, before the detection circuit 1, a front-end sensor (not shown in the figure) may be further disposed, and the front-end sensor is configured to convert grayscale value information of two adjacent pixels in the to-be-detected image into a first analog signal and a second analog signal. The first analog signal and the second analog signal are both voltage signals or current signals.
[0154] In an implementation, the first analog signal and the second analog signal are directly used as the first signal and the second signal respectively, and the first signal and the second signal are input to the first pulse sequence generator 10 and the second pulse sequence generator 20 respectively.
[0155] In another implementation, an amplifier is disposed between the front-end sensor and the detection circuit 1, and is configured to: after appropriately amplifying the first analog signal and the second analog signal, use the amplified first analog signal and the amplified second analog signal as the first signal and the second signal respectively, and input the first signal and the second signal to the first pulse sequence generator 10 and the second pulse sequence generator 20 respectively.
[0156] As shown in
[0157] One input end of the first differential amplifier 60 is configured to receive the difference voltage.
[0158] The other input end of the first differential amplifier 60 is configured to receive a reference voltage. The reference voltage may be a voltage critical value corresponding to an edge pixel, and may be specifically determined based on an actual requirement or an empirical value.
[0159] A voltage output by the first differential amplifier 60 is used to represent a gradient between the grayscale values of the first pixel and the second pixel.
[0160] If grayscale values of all pixels in the to-be-detected image are considered as a two-dimensional discrete function, the gradient between the grayscale values of the first pixel and the second pixel is a derivative of the two-dimensional discrete function in a local range of the first pixel and the second pixel.
[0161] The gradient between the grayscale values of the first pixel and the second pixel may further represent whether the first pixel and the second pixel are edge pixels.
[0162] When the difference voltage is greater than the reference voltage, the first differential amplifier 60 outputs a high level, where the high level is used to represent that both the first pixel and the second pixel are edge pixels in the to-be-detected image. A voltage amplitude of the high level reflects a degree of a difference between the grayscale values of the first pixel and the second pixel. A larger voltage amplitude indicates a larger difference between the grayscale values of the two pixels, that is, a larger gradient between the grayscale values of the two pixels.
[0163] When the difference voltage is less than or equal to the reference voltage, the first differential amplifier 60 outputs a low level such as a zero level, where the low level is used to represent that neither the first pixel nor the second pixel is an edge pixel in the to-be-detected image.
[0164]
[0165] A working principle of the detection circuit 1 shown in
[0166] Step 1: Refer to
[0167] Step 2: Input a third signal to both the first conductance device 30 and the second conductance device 40, and input a reference voltage to the first differential amplifier 60. The difference between the first conductance and the second conductance is detected by using the difference detection circuit 50, and the gradient between the grayscale values of the first pixel and the second pixel is detected by using the first differential amplifier 60.
[0168] In this example, an example in which the first differential amplifier 60 is used to determine the gradient between the grayscale values of the first pixel and the second pixel is used for description. In actual implementation, the gradient may be alternatively determined by using another device or a device combination.
[0169]
[0170] Specifically, in an example in which the to-be-detected image is an image with a resolution of m×n (that is, the to-be-detected image includes m rows and n columns of pixels), a principle of obtaining the edge gradient of the to-be-detected image is as follows.
[0171] Step 1: Group pixels in the image with a resolution of m×n first.
[0172] Step 2: Process grayscale values of pixels in each group by using the detection circuit 1 shown in
[0173] It should be noted that, if it is required that a quantity of pixels of the edge gradient image be the same as a quantity of pixels of the to-be-detected image, zeroes need to be added behind a last row and a last column of the to-be-detected image (as shown by dashed lines in
[0174] For example, the quantity of pixels of the generated edge gradient image is the same as the quantity of pixels of the to-be-detected image. Pixels in a first row of the to-be-detected image may be divided into two groups, that is, a circle-identified group and a square-identified group. The circle-identified group is processed by using the detection circuit 1 to obtain X.sub.(1,1), X.sub.(1,3), . . . , X.sub.(1,n−1), which respectively correspond to pixels (1,1), (1,3), . . . , (1,n−1) in the edge gradient image. The square-identified group is processed by using the detection circuit 1 to obtain X.sub.(1,2), X.sub.(1,4), . . . , X.sub.(1,n), which respectively correspond to pixels (1,2), (1,4), . . . , (1,n) in the edge gradient image. Similarly, another row may also be grouped to obtain a similar output.
[0175] Further, a first column of the to-be-detected image is divided into a triangle-identified group and a diamond-identified group. After the two groups are processed by using the detection circuit 1, “Y.sub.(1,1), Y.sub.(3,1), . . . , Y.sub.(m−1, 1)” and “Y.sub.(2,1), Y.sub.(4,1), . . . , Y.sub.(m,1)” are respectively obtained, and are respectively corresponding to pixels “(1,1), (3,3), . . . , (m−1,1)” and “(2,1), (4,1), . . . , (m,1)” in the edge gradient image. Similarly, another column may also be grouped to obtain a similar output.
[0176] Step 3: After outputs obtained by processing all rows and all columns of the to-be-detected image by using the detection circuit 1 are obtained, X and Y with same coordinates are combined to obtain a gradient of adjacent pixels of corresponding coordinates in the to-be-detected image. Gradients of all adjacent pixels in the to-be-detected image form an edge gradient image of the to-be-detected image.
[0177] The foregoing process may be summarized as follows. Pixels (a,b) and (a,b+1) in the to-be-detected image are processed in groups, to obtain X(a,b), that is, an X component of the pixel (a,b) in the edge gradient image. Pixels (a,b) and (a+1,b) in the to-be-detected image are processed in groups, to obtain Y(a,b), that is, a Y component of the pixel (a,b) in the edge gradient image. Finally, the X component and the Y component of the same pixel are combined (for example, combination is performed by using the formula sqrt(X.sup.2+Y.sup.2)), to obtain the pixel (a,b) in the edge gradient image.
[0178] By using the technical solution provided in the first step to the third step, the edge gradient image is obtained, and edge gradient components are obtained in X and Y directions and then combined, so that a small grayscale value difference can be effectively filtered out, and an edge gradient of the to-be-detected image is sharper.
[0179] In circuit implementation, a circuit for obtaining the edge gradient of the to-be-detected image may include a plurality of detection circuits, and one pixel pair in the to-be-detected image corresponds to one detection circuit. For example, the detection circuit may be the detection circuit shown in
[0180] The following describes several specific implementations of the circuit for obtaining the edge gradient of the to-be-detected image provided in this embodiment.
[0181] Manner 1: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. The first pixel pair and the second pixel pair both include a same pixel. The first detection circuit and the second detection circuit share a same branch. The branch includes the first pulse sequence generator 10 and the first conductance device 30, or the branch includes the second pulse sequence generator 20 and the second conductance device 40.
[0182] For example, both the first detection circuit and the second detection circuit are the detection circuit 1 shown in
[0183]
[0184] Refer to
[0185] Other examples are similar, and details are not described herein again.
[0186] Based on
[0187] If each row of the to-be-detected image uses this circuit structure, all rows of the to-be-detected image may be grouped in parallel, that is, edge detection operations in all row directions are completed in two steps, to generate X components of gradients of all adjacent pixels. Similarly, in a column direction, such an operation may be performed by using the MUX, and Y components of the gradients of all adjacent pixels are generated in two steps. In this case, a total of four parallel operations can be performed to complete calculation of the gradients of all adjacent pixels in the to-be-detected image.
[0188] If a manner of processing row by row and column by column is used, a detection circuit of a row-column scale may be reused, and a total of 2*(m+n) operations are required, to complete calculation of the gradients of all adjacent pixels in the to-be-detected image.
[0189] Manner 2: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. The first pixel pair and the second pixel pair both include a same pixel. The first detection circuit and the second detection circuit share a pulse sequence generator corresponding to the same pixel.
[0190] For example, both the first detection circuit and the second detection circuit are the detection circuit 1 shown in
[0191]
[0192] Refer to
[0193] Based on
[0194] If each row of the to-be-detected image uses this circuit structure, all rows of the to-be-detected image may be grouped in parallel, that is, edge detection operations in all row directions are completed in one step, to generate X components that represent gradients of all adjacent pixels. Similarly, such an operation may be performed in column directions to generate Y components that represent the gradients of all adjacent pixels in one step. In this case, a total of two parallel operations can be performed to complete calculation of the gradients of all adjacent pixels in the to-be-detected image.
[0195] If a manner of processing row by row and column by column is used, a detection circuit of a row-column scale may be reused, and a total of (m+n) operations are required, to complete calculation of the gradients of all adjacent pixels in the to-be-detected image.
[0196] Compared with the foregoing manner 1, the manner 2 can further reduce a quantity of operations. When the detection circuit shown in
[0197] Manner 3: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. A third pixel pair in the to-be-detected image corresponds to a third detection circuit. A fourth pixel pair in the to-be-detected image corresponds to a fourth detection circuit. The first pixel pair, the second pixel pair, the third pixel pair, and the fourth pixel pair all include a same pixel. The first detection circuit, the second detection circuit, the third detection circuit, and the fourth detection circuit share a pulse sequence generator corresponding to the same pixel.
[0198] For example, the first detection circuit, the second detection circuit, the third detection circuit, and the fourth detection circuit are all the detection circuit 1 shown in
[0199]
[0200] Based on
[0201] In other words, the pixel (2,2) and the pixel (2,1) form a first pixel pair, the pixel (2,2) and the pixel (2,3) form a second pixel pair, the pixel (2,2) and the pixel (1,2) form a third pixel pair, and the pixel (2,2) and the pixel (3,2) form a fourth pixel pair. The four pixel pairs each include the pixel (2,2).
[0202] The first detection circuit includes: S1, D1, S2, and D2, and is configured to obtain X.sub.(2,1).
[0203] The second detection circuit includes: S2, D3, S3, and D6, and is configured to obtain X.sub.(2,2).
[0204] The third detection circuit includes: S2, D4, S4, and D7, and is configured to obtain Y.sub.(1,2).
[0205] The fourth detection circuit includes: S2, D5, S5, and D8, and is configured to obtain Y.sub.(2,2).
[0206] The four detection circuits share a pulse sequence generator corresponding to the pixel (2,2), that is, the pulse sequence generator S2.
[0207] Other examples are similar, and details are not described herein again.
[0208] The circuit shown in
[0209] Compared with the foregoing manner 1 and manner 2, the manner 3 can further reduce a quantity of operations, to reduce a calculation time length.
[0210] Another specific example is used below to describe an application of the detection circuit 1 provided above.
[0211] This example is described by using an example in which the detection circuit 1 is applied to a character string difference detection scenario. Specifically, two characters that are in two character strings respectively and have a difference to be detected are used as a character pair. For each character pair, two characters in the character pair are respectively converted into a first signal and a second signal, and the first signal and the second signal are separately input to the detection circuit 1 shown in
[0212] It may be understood that an image edge detection scenario may be considered as detecting a difference between two-dimensional information. A character string difference detection scenario may be considered as detecting a difference between one-dimensional information. Therefore, for a circuit for an overall difference detection of two character strings, refer to the circuit shown in
[0213] Certainly, the detection circuit 1 shown in
[0214]
[0215] The detection circuit 2 includes: a first pulse sequence generator 10, a second pulse sequence generator 20, a first conductance device 30, a second conductance device 40, and a difference detection circuit 50.
[0216] The first pulse sequence generator 10 is configured to receive a first signal, and generate a first pulse sequence based on the first signal.
[0217] The second pulse sequence generator 20 is configured to receive a second signal, and generate a second pulse sequence based on the second signal. Amplitudes of the first signal and the second signal are different, and frequencies of the first pulse sequence and the second pulse sequence are different.
[0218] The first conductance device 30 is configured to receive the first pulse sequence and the second pulse sequence to generate a first conductance.
[0219] The second conductance device 40 is configured to receive the first pulse sequence and the second pulse sequence to generate a second conductance.
[0220] There is a first resistor 70 and a second resistor 80. The first conductance device 30 and the first resistor 70 are sequentially connected in series, and the second resistor 80 and the second conductance device 40 are sequentially connected in series, and a connection point between the first resistor 70 and the second resistor 80 is used as an output end of the detection circuit 2.
[0221] The output end of the detection circuit 2 is configured to output a difference voltage. The difference voltage is used to represent a difference between the first conductance and the second conductance.
[0222] When no conflict occurs, for descriptions of related content of the detection circuit 2 provided in this embodiment, refer to the foregoing descriptions of the detection circuit 1. For example, both the first signal and the second signal are current signals or voltage signals. For example, the first conductance device 30 and the second conductance device 40 have a same hardware structure, and have a same initial hardware parameter. For example, the first conductance device 30 and the second conductance device 40 have a same hardware structure, and have a same initial hardware parameter. For example, both the amplitudes of the first pulse sequence and the second pulse sequence are greater than or equal to a first threshold.
[0223] The following describes some different characteristics of the detection circuit 2 compared with the detection circuit 1.
[0224] Optionally, directions of the first pulse sequence and the second pulse sequence are opposite.
[0225] For example, the first pulse sequence is a positive pulse sequence relative to the first conductance device, and the second pulse sequence is a negative pulse sequence relative to the first conductance device. In addition, the first pulse sequence is a negative pulse sequence relative to the second conductance device, and the second pulse sequence is a positive pulse sequence relative to the second conductance device.
[0226] For another example, the first pulse sequence is a negative pulse sequence relative to the first conductance device, and the second pulse sequence is a positive pulse sequence relative to the first conductance device. In addition, the first pulse sequence is a positive pulse sequence relative to the second conductance device, and the second pulse sequence is a negative pulse sequence relative to the second conductance device.
[0227] Optionally, amplitudes of the positive pulse sequence and the negative pulse sequence are equal.
[0228] In the detection circuit 2, the first conductance device 30 and the second conductance device 40 have electrical characteristics as follows.
[0229] Optionally, under the positive pulse sequence and the negative pulse sequence, conductance values of the first conductance device 30 and the second conductance device 40 change oppositely.
[0230] For example, a conductance of each of the first conductance device 30 and the second conductance device 40 increases as a quantity of pulses in a positive pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases, and separately decreases as a quantity of pulses in a negative pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0231] Optionally, when the quantity of pulses in the positive sequence is equal to the quantity of pulses in the negative sequence, under the positive and negative pulse sequences, the first conductance device 30 and the second conductance device 40 have a symmetric relationship in terms of conductance.
[0232]
[0233] Optionally, the conductance of each of the first conductance device 30 and the second conductance device 40 changes with a frequency of a pulse sequence received by each of the first conductance device 30 and the second conductance device 40.
[0234] Further, optionally, the conductance of each of the first conductance device 30 and the second conductance device 40 increases as a frequency of a positive pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases, and decreases as a frequency of a negative pulse sequence received by each of the first conductance device 30 and the second conductance device 40 increases.
[0235] In this embodiment, a specific form of the conductance device having the characteristic shown in
[0236] The first resistor 70 and the second resistor 80 are current-limiting resistors, and are used to reduce static power consumption and ensure normal operation of the circuit.
[0237] Optionally, the first resistor 70 and the second resistor 80 are the same. In this way, a voltage division degree of the first resistor 70 is the same as that of the second resistor 80, so that the difference between the first conductance and the second conductance can more accurately reflect a difference between the first signal and the second signal, and a detection result of the detection circuit 2 is more accurate.
[0238] A working principle of the detection circuit 2 shown in
[0239] When the first signal and the second signal are input to the first pulse sequence generator 10 and the second pulse sequence generator 20 respectively, the first pulse sequence generator 10 and the second pulse sequence generator 20 respectively generate a group of pulse sequences with equal amplitudes and equal pulse widths but opposite directions. The first conductance device 30 and the second conductance device 40 are in a same initial state (initial conductances are the same). Because the first conductance device 30 and the second conductance device 40 are connected back to back (for example, negative electrodes are connected), if the first pulse sequence gradually increases the conductance of the first conductance device 30, the first pulse sequence gradually decreases the conductance of the second conductance device 40. In addition, the second pulse sequence gradually decreases the conductance of the first conductance device 30 and gradually increases the conductance of the second conductance device 40. The first pulse sequence and the second pulse sequence have a contention relationship.
[0240] If the frequency of the first pulse sequence is high, within a period of time, an increase in the conductance of the first conductance device 30 is greater than a decrease in the conductance, and the conductance generally increases. Similarly, for the second conductance device 40, the conductance generally decreases.
[0241] When the conductances of the first conductance device 30 and the second conductance device 40 change, the difference voltage Vout output at the connection point between the first resistor 70 and the second resistor 80 changes. For the first signal, Vout=G1/(G1+G2)*V1, and for the second signal, Vout=G2/(G1+G2)*V2. G1 is a sum of the first conductance and “a conductance corresponding to the first resistor 70”. G2 is a sum of the second conductance and “a conductance corresponding to the second resistor 80”.
[0242] It should be noted that, it can be learned from a comparison between the detection circuit 1 and the detection circuit 2 that the detection circuit 1 completes detection of the difference between the first signal and the second signal by inputting signals twice (that is, inputting the first signal and the second signal for the first time, and inputting the third signal for the second time). The detection circuit 2 can complete detection of the difference between the first signal and the second signal by inputting a signal once (that is, inputting the first signal and the second signal at the same time).
[0243] Optionally, the first conductance device 30 and the second conductance device 40 are volatile devices. At a same moment, the first conductance device 30 receives the first pulse sequence, and the second conductance device 40 receives the second pulse sequence.
[0244] Optionally, the first conductance device 30 and the second conductance device 40 are non-volatile devices. The first conductance device 30 is further configured to: after the difference detection circuit 2 outputs the difference voltage, initialize the conductance of the first conductance device 30. The second conductance device 40 is further configured to: after the difference detection circuit 2 outputs the difference voltage, initialize the conductance of the second conductance device 40. For related descriptions of an initialization process, refer to the foregoing description. Details are not described herein again.
[0245] According to the detection circuit 2 provided in this embodiment, a difference between the amplitudes of the first signal and the second signal is converted into a difference between the frequencies of the pulse sequences, and then is converted into the difference between the first conductance and the second conductance. In this way, the difference between the first signal and the second signal can be indirectly detected by detecting the difference between the first conductance and the second conductance. The detection circuit may be applied to an image edge detection scenario, to reduce calculation steps, improve calculation efficiency, and reduce power consumption of a device. For a specific analysis process, refer to the foregoing process of analyzing beneficial effects of the detection circuit 1. Details are not described herein again.
[0246] A specific example is used below to describe an application of the detection circuit 2 provided above.
[0247] This example is described by using an example in which the detection circuit 2 provided above is applied to an image edge detection scenario. Based on this, in this scenario, the first signal is an analog signal corresponding to a grayscale value of a first pixel in the to-be-detected image. The second signal is an analog signal corresponding to a grayscale value of a second pixel in the to-be-detected image. The first pixel is adjacent to the second pixel.
[0248] As shown in
[0249] In circuit implementation, a circuit for obtaining an edge gradient of the to-be-detected image may include a plurality of detection circuits, and one pixel pair in the to-be-detected image corresponds to one detection circuit. For example, the detection circuit may be a detection circuit 2 shown in
[0250] The following describes several specific implementations of the circuit for obtaining the edge gradient of the to-be-detected image provided in this embodiment.
[0251] Manner 1: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. The first pixel pair and the second pixel pair both include a same pixel. The first detection circuit and the second detection circuit share a same branch. The branch includes the first pulse sequence generator 10 and the first conductance device 30, or the branch includes the second pulse sequence generator 20 and the second conductance device 40.
[0252] For example, both the first detection circuit and the second detection circuit are the detection circuit 2 shown in
[0253]
[0254] Manner 2: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. The first pixel pair and the second pixel pair both include a same pixel. The first detection circuit and the second detection circuit share a pulse sequence generator corresponding to the same pixel.
[0255] For example, both the first detection circuit and the second detection circuit are the detection circuit 2 shown in
[0256]
[0257] Manner 3: A first pixel pair in the to-be-detected image corresponds to a first detection circuit. A second pixel pair in the to-be-detected image corresponds to a second detection circuit. A third pixel pair in the to-be-detected image corresponds to a third detection circuit. A fourth pixel pair in the to-be-detected image corresponds to a fourth detection circuit. The first pixel pair, the second pixel pair, the third pixel pair, and the fourth pixel pair all include a same pixel. The first detection circuit, the second detection circuit, the third detection circuit, and the fourth detection circuit share a pulse sequence generator corresponding to the same pixel.
[0258] In this manner, the circuit for obtaining the edge gradient of the to-be-detected image may be obtained with reference to
[0259] It should be noted that the detection circuit 2 may also be applied to a character string difference detection scenario. For related descriptions of the detection circuit 2, refer to the foregoing related descriptions of the detection circuit 1 applied to the character string difference detection scenario. Certainly, the detection circuit 2 may be further applied to another difference detection scenario. Further, for any two parameters that can be converted into analog signals (for example, voltage signals and current signals), difference detection may be performed based on any detection circuit 2 shown above.
[0260] Based on the detection circuit provided in embodiments, the present disclosure further provides a chip, and the chip includes any detection circuit provided above.
[0261] Correspondingly, an embodiment further provides an electronic device, and the electronic device includes any chip provided above. Correspondingly, the electronic device includes a printed circuit board (Printed Circuit Board, PCB), and a chip may be located on the PCB of the electronic device.
[0262] Correspondingly, in another implementation, the disclosure further provides an electronic device, and the electronic device includes any detection circuit provided above. Correspondingly, the electronic device includes a PCB, and a chip may be located on the PCB of electronic device.
[0263] A specific form of the electronic device is not limited in this embodiment. For example, the electronic device may be any electronic device such as a camera, an image recognition device, an industrial detection device, a mobile phone, or a computer.
[0264] Correspondingly, an embodiment provides an image processing method. The method includes:
[0265] constructing a grayscale value difference detection circuit of adjacent pixels, and performing grayscale value difference detection of a complete image based on X and Y directions to obtain an X component and a Y component of an edge gradient of two adjacent pixels; and
[0266] combining an X component and Y component of a same pixel to obtain an edge gradient output of the complete image for implementing an edge detection function.
[0267] In a possible design, there are two circuit implementations for detecting a grayscale value difference between adjacent pixels. A principle is that different input grayscale values are first converted into pulse sequences with different frequencies or amplitudes, and then output is completed by using a response difference of a resistor device to the different pulse sequences. If a final output is a zero level, it indicates that no edge exists. If a final output is a high level, it indicates that an edge exists and an amplitude of the high level is directly proportional to an edge gradient. A difference between the two circuits lies in operation steps. If the converted pulse sequences are input to separately function on the resistor devices, two operations are required to complete a final output. If the converted pulse sequences are input to simultaneously function on the resistor devices, only one operation is required to complete a final output.
[0268] In a possible design, there are three usage methods combined for the grayscale value difference detection circuit of adjacent pixels. For an image with a resolution of m×n, three structures may be used to concurrently output an edge detection result. If each pixel corresponds to one device, at least four parallel operations are performed. If each pixel corresponds to two devices, at least two parallel operations are performed. If each pixel corresponds to four devices, at least one parallel operation is performed. After a parallel operation output is complete, components of coordinates of a same pixel are combined to obtain edge gradient information of the entire image.
[0269] In a possible design, the method further includes:
[0270] A device in a basic edge detection unit may be a resistance-volatile device, or may be a resistance-non-volatile device. For the volatile device, two input signals need to be applied simultaneously and an output result needs to be read in time.
[0271] Correspondingly, embodiments provide an image processing apparatus and a corresponding electronic device. In an implementation, the image processing apparatus includes a corresponding unit configured to implement the foregoing image processing method. In another implementation, the image processing apparatus includes a corresponding circuit configured to implement the foregoing image processing method. The corresponding electronic device includes the foregoing image processing apparatus.
[0272] For descriptions of beneficial effects of a chip, the electronic device, and a method for applying a detection circuit, refer to the foregoing descriptions of beneficial effects of a corresponding detection circuit. Details are not described herein again.
[0273] The foregoing descriptions are merely specific implementations, but are not intended to limit the protection scope. Any variation or replacement within the technical scope disclosed herein shall fall within the protection scope.