Image feature obtaining method and electronic device
This application provides an image feature obtaining method and an electronic device, and relates to the field of terminal technologies. The method includes: A first device receives a first obtaining instruction. The first obtaining instruction indicates the first device to obtain an image feature. The first device obtains a first feature in response to the first obtaining instruction. The first feature is a feature of a first image of a target device, the target device is the first device or a second device associated with the first device, and the first image is at least a partial image in a picture currently displayed on a display of the target device. According to the technical solutions provided in this application, flexibility and diversity of obtained image features can be improved.
1 . A method applied to a communications system comprising a first device and a second device, the method comprising:
receiving, by the second device from the first device, a first obtaining request that requests to obtain an image feature from the second device;
creating, by the second device in response to the first obtaining request, a first window having a same size as a size of a display of the second device, with the first window being a global transparent window located over all applications displayed on the display of the second device;
obtaining, by the second device, a first image in a first closed area determined based on a first screen capture operation by a stylus on the first window;
analyzing, by the second device, the first image in the first closed area to obtain a first feature of a detected color of the first image;
closing, by the second device, the first window after the second device obtains the first image;
receiving, by the first device, the first feature of the detected color of the first image via a data exchange channel between the first device and the second device; and
performing, by the first device, an image editing operation based on the first feature of the detected color of the first image and an operation by the stylus on a display of the first device.
2 . The method of claim 1 , wherein the screen capture operation comprises a sliding operation by the stylus, wherein the obtaining, by the second device, the first image further comprises:
obtaining, by the second device, the first image according to the first closed area formed by the sliding operation by the stylus.
3 . The method of claim 1 , the method further comprising:
receiving, by the first device, an obtaining instruction that is used to instruct the first device to obtain the image feature of a color type; and
in response to the obtaining instruction, obtaining, by the first device, the first feature indicating the color type from the second device.
4 . The method of claim 1 , wherein the image editing operation comprises a drawing operation by the stylus, and the method further comprises:
binding, by the first device, a color feature to the stylus; and
displaying, by the first device, a drawn track in response to the drawing operation of the stylus, wherein a color of the drawn track is a color indicated by the color feature.
5 . The method of claim 1 , the method further comprising:
adding, by the first device, the first feature of the detected color to a built-in palette.
6 . The method of claim 1 , wherein the first obtaining request indicates a color type to request the image feature of the color type.
7 . The method of claim 1 , wherein the first feature of the first image is a red green blue (RGB) value.
8 . The method of claim 1 , wherein the analyzing, by the second device, the first image in the first closed area comprises:
analyzing, by the second device, the first image in the first closed area to obtain the first feature of the detected color of the first image and a text feature of the first image; and
the performing, by the first device, the image editing operation comprises:
performing, by the first device, an image-text editing operation of an image-text application based on the first feature of the detected color and the text feature.
9 . A second device, comprising:
at least one processor; and
at least one memory comprising computer program instructions that, when executed by the at least one processor, cause the second device to perform operations including:
receiving, by the second device from a first device, a first obtaining request that requests to obtain an image feature from the second device;
creating, by the second device in response to the first obtaining request, a first window having a same size as a size of a display of the second device, with the first window being a global transparent window located over all applications displayed on the display of the second device;
obtaining, by the second device, a first image in a first closed area determined based on a first screen capture operation by a stylus on the first window;
analyzing, by the second device, the first image in the first closed area to obtain a first feature of a detected color of the first image;
closing, by the second device, the first window after the second device obtains the first image; and
sending, to the first device, the first feature of a detected color of the first image via a data exchange channel between the first device and the second device.
10 . The second device of claim 9 , wherein the first obtaining request indicates a texture type and a color type; and
the analyzing, by the second device, the first image in the first closed area comprises:
analyzing, by the second device, the first image in the first closed area to obtain the first feature of the detected color of the first image and a text feature of the first image, the first feature of the detected color of the first image and the text feature of the first image being sent to the first device for an image-text editing operation of an image-text application on the first device.
11 . A system, comprising a first device and a second device, wherein
the second device is configured to:
receive, from the first device, a first obtaining request that requests to obtain an image feature from the second device;
create, in response to the first obtaining request, a first window having a same size as a size of a display of the second device, with the first window being a global transparent window located over all applications displayed on the display of the second device;
obtain a first image in a first closed area determined based on a first screen capture operation by a stylus on the first window;
analyze the first image in the first closed area to obtain a first feature of a detected color of the first image;
close the first window after the second device obtains the first image; and
send the first feature of the detected color of the first image to the first device via a data exchange channel between the first device and the second device; and
the first device is configured to:
receive the first feature of the detected color of the first image via the data exchange channel; and perform an image editing operation based on the first feature of the detected color of the first image and an operation by the stylus on a display of the first device.
12 . The system of claim 11 , wherein the first obtaining request indicates a texture type and a color type; and
the analyze the first image in the first closed area is further configured to:
analyze the first image in the first closed area to obtain the first feature of the detected color of the first image and a text feature of the first image, the text feature of the first image and the first feature of the detected color of the first image being sent to the first device for an image-text editing operation of an image-text application on the first device.
13 . The system of claim 11 , wherein
the image editing operation comprises a drawing operation by the stylus, and the first device is further configured to:
bind a color feature to the stylus; and
display a drawn track in response to the drawing operation of the stylus, wherein a color of the drawn track is a color indicated by the color feature.