WO2016101767A1 - Picture cropping method and device and image detecting method and device - Google Patents

Picture cropping method and device and image detecting method and device Download PDF

Info

Publication number
WO2016101767A1
WO2016101767A1 PCT/CN2015/095862 CN2015095862W WO2016101767A1 WO 2016101767 A1 WO2016101767 A1 WO 2016101767A1 CN 2015095862 W CN2015095862 W CN 2015095862W WO 2016101767 A1 WO2016101767 A1 WO 2016101767A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
original
face
cropping
image
Prior art date
Application number
PCT/CN2015/095862
Other languages
French (fr)
Chinese (zh)
Inventor
张刚
胡金辉
韩玉刚
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201410818268.6A external-priority patent/CN104484853A/en
Priority claimed from CN201410818281.1A external-priority patent/CN104484854A/en
Priority claimed from CN201410820195.4A external-priority patent/CN104484855B/en
Priority claimed from CN201410815644.6A external-priority patent/CN104463176B/en
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2016101767A1 publication Critical patent/WO2016101767A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a method and apparatus for picture cropping, and a picture detecting method and apparatus.
  • the method of cropping by using the three-part composition and the golden ratio composition is to cut the fixed position in the picture, so that it is difficult to ensure that the cropped picture is satisfactory.
  • some pictures containing characters using the prior art cutting methods often make the cropped characters incomplete or incomplete, so that the pictures can not be used, or have to be manually cut, low efficiency, and not widely used.
  • the present invention has been made in order to provide a method and apparatus for picture cropping and a picture detecting method and apparatus that overcome the above problems or at least partially solve the above problems.
  • a method for cropping a picture includes: detecting an original picture to be cropped, detecting a feature element included in the original picture; and selecting, according to the feature element, a The cropping mode of the original image is performed; the original image is cropped according to the cropping manner to obtain a target image.
  • an apparatus for image cropping comprising: a feature element detecting module, configured to detect a cut original image, and detect a feature element included in the original image; And a selection module, configured to: according to the feature element, select a cropping manner for cropping the original image; and a cropping module, configured to crop the original image according to the cropping manner to obtain a target image.
  • a person picture cropping method comprising:
  • the original picture is cropped to obtain a target picture, and at least the face is retained in the target picture.
  • a character picture cropping apparatus comprising:
  • a face detection module configured to detect a cut original image having a character to detect a face of the character
  • a cropping module configured to crop the original image to obtain a target image, wherein at least the human face remains in the target image.
  • a method of cropping a picture including a graphic mark comprising:
  • the original picture is cropped to obtain a target picture, and at least one or all of the features of the graphic mark are retained in the target picture.
  • an apparatus for cropping a picture including a graphical logo comprising:
  • a graphic mark detecting module configured to detect the original picture to be cropped, and detect some or all features of the one or more graphic marks included in the original picture
  • a cropping module configured to crop the original image to obtain a target image, and retain at least one or all of the features of the graphic identifier in the target image.
  • a method for detecting a picture mark picture which includes:
  • a graphic mark picture detecting apparatus comprising:
  • An area selection module configured to select an area of the color to be extracted from the picture based on an edge position of the picture to be detected
  • a color extraction module for extracting colors in the area
  • the graphic mark determining module is configured to determine, according to the extracted color in the area, whether the graphic includes a graphic mark.
  • a computer program comprising computer readable code that, when executed on a computing device, causes the computing device to perform the method described above.
  • a computer readable medium wherein the computer program described above is stored.
  • the original picture is first detected before the picture is cropped, and the feature elements contained therein are detected, and the different clipping methods are used according to the difference of the feature elements to ensure that the different pictures can be timely adopted.
  • the cutting method makes the target image obtained by the cropping meet the requirements.
  • FIG. 1 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention
  • FIG. 2 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention
  • FIG. 3 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention
  • Figure 4 shows a block diagram of an apparatus for picture cropping in accordance with one embodiment of the present invention
  • FIG. 5 is a flow chart showing a method for cropping a character picture according to an embodiment of the present invention.
  • FIG. 6 is a flow chart showing a method for cropping a person's picture according to an embodiment of the present invention
  • FIG. 7 is a flow chart showing a method for cropping a character picture according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram showing the cropping of a character picture cropping method according to an embodiment of the present invention.
  • FIG. 9 is a flow chart showing a method for cropping a person's picture according to an embodiment of the present invention.
  • FIG. 10 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention.
  • Figure 11 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention.
  • FIG. 12 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention.
  • FIG. 13 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 14 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 15 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 16 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 17 illustrates an original picture cropped by a method of cropping a picture containing a graphic mark, in accordance with one embodiment of the present invention
  • FIG. 18 illustrates a target picture cropped by a method of cropping a picture including a graphic mark according to an embodiment of the present invention
  • FIG. 19 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention.
  • FIG. 20 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 21 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • FIG. 22 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention
  • Figure 23 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention.
  • Figure 24 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention.
  • Figure 25 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention.
  • Figure 26 is a flow chart showing a method of detecting a pattern mark in accordance with one embodiment of the present invention.
  • Figure 27 is a flow chart showing a method of detecting a pattern mark in accordance with one embodiment of the present invention.
  • FIG. 28 is a diagram showing the operation of a method of detecting a pattern mark according to an embodiment of the present invention.
  • Figure 29 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention.
  • Figure 30 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention.
  • Figure 31 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention.
  • Figure 32 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention.
  • Figure 33 is a schematic block diagram showing a computing device for performing the method according to the present invention.
  • Fig. 34 schematically shows a storage unit for holding or carrying program code implementing the method according to the invention.
  • an embodiment of the present invention provides a method for cropping a picture, including:
  • Step 110 The original picture to be cropped is detected, and the feature elements included in the original picture are detected.
  • the type of the feature element is not limited, and includes, but is not limited to, a person's face and a graphic mark, for example, a mark of a commodity or a company.
  • Step 120 Select a cropping method for cropping the original image according to the feature element.
  • the clipping mode is not limited.
  • the feature element in the photo of the person is the face
  • the corresponding clipping mode is the picture containing the face under the cropping
  • the feature element in the product logo image is the graphic function of the marking.
  • the background color copy the entire content of the image into a certain area for cropping, and fill the remaining area when copying the picture with the background color.
  • step 130 the original image is cropped in a cropping manner to obtain a target image.
  • the original image is first detected before the image is cropped, and the feature elements included therein are detected, and the different cropping manners are used for cropping according to different feature elements, thereby ensuring timely adoption of different images.
  • the appropriate cutting method makes the target image obtained by the cropping meet the demand.
  • feature elements are retained in the target image. This is because the usual feature elements are important parts of the original picture, such as the face in the picture of the person, the graphic or background color in the graphic logo picture, and it is necessary to keep it.
  • the news photo of the character A is detected, and based on the face recognition technology, the face of the character A can be detected; when the photo is cropped, the area of the face of the character A is cropped from the photo, and the rest is discarded;
  • the cropped image has the face of the character A, which is good for indicating the identity of the character A, and matches the news of the character A.
  • an embodiment of the present invention provides a method for cropping a picture, including:
  • Step 210 Detect whether a human face is included in the original picture.
  • Step 220 When the original picture includes a human face, select a clipping mode for cropping the original picture according to the face.
  • Step 230 When the original picture does not include a human face, it is detected whether the original picture contains a graphic mark.
  • the face has a higher detection priority than the graphic mark. This is because the picture with the face and the graphic mark at the same time is usually the main face, so the face is preferentially detected. Cropped.
  • Step 240 When the original picture includes the graphic mark, select a cutting mode for cropping the original picture according to the graphic mark.
  • Step 250 When the original picture does not include the face and the graphic mark, the preset universal cutting mode is selected as the cutting mode for cutting the original picture.
  • the general clipping mode is not limited.
  • a clipping mode that can adapt to more types of pictures is provided: the original image is compressed by a minimum compression ratio, and the minimum scaling ratio is calculated as follows:
  • Min_scale MIN(width src /width dst ,height src /height dst )
  • width and height of the uncompressed original image be width src , height src ; the width and height of the target image are width dst and height dst respectively .
  • the pixels in the scaled image that are more than the target image range are cropped to obtain the target image.
  • This clipping method is useful for cropping the non-critical edge portion of the original image.
  • step 260 the original image is cropped in a cropping manner to obtain a target image.
  • a star gets on and off the vehicle, and the vehicle has a car logo.
  • the focus of the photo is a star; at this time, the face detection technology is first used for face detection and detection.
  • the face of the star can be cropped when cropping, and the star can be identified in the cropped image, which is compatible with the news report.
  • an embodiment of the present invention provides a method for cropping a picture, including:
  • Step 310 Detect whether a human face is included in the original picture.
  • Step 320 counting the number of faces when detecting a face from the original picture.
  • step 330 when the number of faces in the original picture is 1, the corresponding clipping mode is selected according to the face.
  • Step 340 When the number of faces in the original picture is greater than 1, the preset universal cutting mode is selected as the cutting mode for cropping the original picture.
  • the personal face is usually not the main content, for example, in the case of multi-person photos, so it is not necessary to crop each person's face.
  • Step 350 When the original picture does not include a human face, it is detected whether the original picture contains a graphic mark.
  • Step 360 When the original picture includes the graphic mark, select a cutting mode for cutting the original picture according to the graphic mark.
  • step 340 the preset universal cutting mode is selected as the cutting mode for cropping the original picture.
  • step 370 the original image is cropped in a cropping manner to obtain a target image.
  • the general cropping strategy of the foregoing embodiment is used for cropping, and the whole body part of 20 people in the cropped picture is basically retained. .
  • an embodiment of the present invention provides an apparatus for cropping pictures, including:
  • the feature element detecting module 410 detects the original image to be cropped, and detects the feature element included in the original image.
  • the type of the feature element is not limited, and includes, but is not limited to, a person's face and a graphic mark, for example, a mark of a commodity or a company.
  • the cropping mode selection module 420 selects a cropping method for cropping the original image according to the feature element.
  • the clipping mode is not limited. For example, if the feature element in the photo of the person is the face, the corresponding clipping mode is the picture containing the face under the cropping; the feature element in the product logo image is the graphic function of the marking. Or the background color, copy the entire content of the image into a certain area for cropping, and fill the remaining area when copying the picture with the background color.
  • the cropping module 430 crops the original image in a cropping manner to obtain a target image.
  • the original image is first detected before the image is cropped, and the feature elements included therein are detected, and the different cropping manners are used for cropping according to different feature elements, thereby ensuring timely adoption of different images.
  • the appropriate cutting method makes the target image obtained by the cropping meet the demand.
  • feature elements are retained in the target image. This is because the usual feature elements are important parts of the original picture, such as the face in the picture of the person, the graphic or background color in the graphic logo picture, and it is necessary to keep it.
  • the news photo of the character A is detected, and based on the face recognition technology, the face of the character A can be detected; when the photo is cropped, the area of the face of the character A is cropped from the photo, and the rest is discarded;
  • the cropped image has the face of the character A, which is good for indicating the identity of the character A, and matches the news of the character A.
  • An embodiment of the present invention provides a device for cropping a picture, comprising:
  • the feature element detecting module 410 detects whether a face is included in the original picture.
  • the cropping mode selection module 420 selects a cropping method for cropping the original image according to the face when the original image includes the human face.
  • the feature element detecting module 410 detects whether a graphic flag is included in the original image when the original image does not include a human face.
  • the face has a higher detection priority than the graphic mark. This is because the picture with the face and the graphic mark at the same time is usually the main face, so the face is preferentially detected. Cropped.
  • the crop mode selection module 420 selects a crop mode for cropping the original image according to the graphic flag when the original picture includes the graphic mark.
  • the cropping mode selection module 420 selects a preset general cropping mode as a cropping manner for cropping the original image when the original image does not include a face and a graphic logo.
  • the general clipping mode is not limited.
  • a clipping mode that can adapt to more types of pictures is provided: the original image is compressed by a minimum compression ratio, and the minimum scaling ratio is calculated as follows:
  • Min_scale MIN(width src /width dst ,height src /height dst )
  • width and height of the uncompressed original image be width src , height src ; the width and height of the target image are width dst and height dst respectively .
  • the pixels in the scaled image that are more than the target image range are cropped to obtain the target image.
  • This clipping method is useful for cropping the non-critical edge portion of the original image.
  • the cropping module 430 crops the original image in a cropping manner to obtain a target image.
  • a star gets on and off the vehicle, and the vehicle has a car logo.
  • the focus of the photo is a star; at this time, the face detection technology is first used for face detection and detection.
  • the face of the star can be cropped when cropping, and the star can be identified in the cropped image, which is compatible with the news report.
  • An embodiment of the present invention provides a device for cropping a picture, comprising:
  • the feature element detecting module 410 detects whether a face is included in the original picture, and counts the number of faces when the face is detected from the original picture.
  • the cropping mode selection module 420 selects a corresponding cropping mode according to the face when the number of faces in the original picture is 1.
  • the cutting mode selection module 420 selects a preset universal cutting mode as the original picture.
  • the cutting method for cropping when the number of faces is greater than 1, the personal face is usually not the main content, for example, in the case of multi-person photos, so it is not necessary to crop each person's face.
  • the feature element detecting module 410 detects whether a graphic flag is included in the original image when the original image does not include a human face.
  • the crop mode selection module 420 selects a crop mode for cropping the original image according to the graphic flag when the original picture includes the graphic mark.
  • the cropping mode selection module 420 selects a preset general cropping mode as a cropping manner for cropping the original image when the original image does not include a face and a graphic logo.
  • the cropping module 430 crops the original image in a cropping manner to obtain a target image.
  • the general cropping strategy of the foregoing embodiment is used for cropping, and the whole body part of 20 people in the cropped picture is basically retained. .
  • the prior art generally adopts a three-part composition and a golden ratio composition for cropping, and uniformly adopts a method of cutting a fixed position in a picture.
  • the cutting method using the prior art often causes the cropped character to be incomplete or incomplete, and thus It is difficult to ensure that the cropped image is satisfactory, so that the cropped image is often unusable, or it has to be manually cropped, which is inefficient and not widely used.
  • the present invention provides the following scheme.
  • an embodiment of the present invention provides a method for cropping a character image, including:
  • step 510 the original picture of the person to be cropped is detected to detect the face of the person.
  • a human face can be recognized based on the existing face recognition technology.
  • the original image is cropped to obtain a target image, and at least a human face is retained in the target image.
  • the human face is a key part for recognizing the character, so the target image under the cropping can still accurately reflect the user's identity; through the face detection, the image can be accurately positioned regardless of the size and position of the character in the original image.
  • the face can be cropped as long as the face is determined, and the cropping effect is not affected by the size and position of the person in the original picture.
  • the original picture is a full-body picture of a person, based on the face recognition technology, the face position can be recognized from the photo; the full-length picture is cropped, and the target picture including the face area is cropped.
  • an embodiment of the present invention provides a method for cropping a character image, which includes:
  • step 610 the original picture with the character to be cropped is detected to detect the face of the person.
  • Step 620 Obtain a size of the target image, and obtain a size of the face in the target image.
  • Step 630 The original image is scaled according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
  • step 640 according to the size of the target picture, the area where the original picture is cropped is selected, and cropped to obtain the target picture. According to the technical solution of the embodiment, whether the face in the original picture is too large or too small, it can be presented in the target picture in an appropriate size.
  • the original picture is a full-body photo of a person, based on the face recognition technology, the face position can be recognized from the photo; the whole body photo is scaled according to the required face size; and then the whole body photo is taken Crop, crop the target image containing the face area.
  • an embodiment of the present invention provides a method for cropping a character image, including:
  • step 710 the original picture of the person to be cropped is detected to detect the face of the person.
  • Step 720 detecting the size of the face in the original picture.
  • Step 730 Obtain a size of the target image, and calculate a size of the face in the target image according to a proportional relationship between the preset target image and the face thereof, and a size of the target image.
  • Step 740 Calculate the scale of scaling the original image according to the size of the face in the original picture and the size of the face in the target picture, and scale according to the scale.
  • Step 750 Select an area to be cropped by the original picture according to the size of the target picture, and perform cropping to obtain the target picture.
  • the original picture is recorded as image src , and its width and height are respectively width src and height src .
  • the target picture to be obtained by clipping is image dst , and its width and height are width dst and heigth dst , respectively.
  • Pixel. Let the width and height of the face in the original image detected are face_wdith src and face_height src , and the image is scaled proportionally.
  • an embodiment of the present invention provides a method for cropping a character image, including:
  • step 910 the original picture of the person to be cropped is detected to detect the face of the person.
  • Step 920 Obtain a size of the target image, and obtain a size of the face in the target image.
  • Step 930 The original image is scaled according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
  • Step 940 determining the position of the cropped area according to the size of the target picture, the size of the face in the target picture, and the positional relationship of the face in the preset target picture, and cutting according to the determined position.
  • the face can be limited to a desired position in the target picture.
  • the positional relationship is not limited, and may include: along the width direction of the face, the distance between the two sides of the face and the two sides of the target picture are equal; along the height direction of the face, The distance between the top edge of the face and the top edge of the target image is less than the distance between the bottom edge of the face and the bottom edge of the target image.
  • the position defined by the face is adapted to better display the face.
  • the compressed picture is cropped so that in the cropped picture, the face is horizontally centered on the picture, and the vertical position is calculated from top to bottom (heigth dst -face_height)/3. Specifically, as shown in Figure 8.
  • an embodiment of the present invention provides a person picture cropping apparatus, including:
  • the face detection module 1010 detects the original picture of the person to be cropped to detect the face of the person.
  • a human face can be recognized based on the existing face recognition technology.
  • the cropping module 1020 crops the original image to obtain a target image, and at least a human face is retained in the target image.
  • the human face is a key part for recognizing the character, so the target image under the cropping can still accurately reflect the user's identity; through the face detection, the image can be accurately positioned regardless of the size and position of the character in the original image.
  • the face can be cropped as long as the face is determined, and the cropping effect is not affected by the size and position of the person in the original picture.
  • the original picture is a full-body picture of a person, based on the face recognition technology, the face position can be recognized from the photo; the full-length picture is cropped, and the target picture including the face area is cropped.
  • an embodiment of the present invention provides a person picture cropping apparatus, which includes:
  • the face detection module 1110 detects the original picture of the person to be cropped to detect the face of the person.
  • the size obtaining module 1120 acquires the size of the target image and acquires the size of the face in the target image.
  • the scaling module 1130 scales the original image according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
  • the cropping module 1140 selects an area for cropping the original image according to the size of the target image, and performs cropping to obtain the target image. According to the technical solution of the embodiment, whether the face in the original picture is too large or too small, it can be presented in the target picture in an appropriate size.
  • the original picture is a full-body photo of a person, based on the face recognition technology, the face position can be recognized from the photo; the whole body photo is scaled according to the required face size; and then the whole body photo is taken Crop, crop the target image containing the face area.
  • an embodiment of the present invention provides a person picture cropping apparatus, including:
  • the face detection module 1210 detects the original picture of the person to be cropped to detect the face of the person.
  • the size detecting module 1220 detects the size of the face in the original picture.
  • the size obtaining module 1230 obtains the size of the target image, and calculates the size of the face in the target image according to the proportional relationship between the preset target image and the face thereof and the size of the target image.
  • the scaling module 1240 calculates a scale for scaling the original image according to the size of the face in the original image and the size of the face in the target image, and scales according to the scale.
  • the cropping module 1250 selects an area for cropping the original image according to the size of the target image, and performs cropping to obtain the target image.
  • the original picture is recorded as image src , and its width and height are respectively width src and height src .
  • the target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel.
  • the width and height of the face in the original image detected are face_wdith src and face_height src , and the image is scaled proportionally.
  • An embodiment of the present invention provides a person picture cropping apparatus, including:
  • the face detection module 1110 detects the original picture of the person to be cropped to detect the face of the person.
  • the size obtaining module 1120 acquires the size of the target image and acquires the size of the face in the target image.
  • the scaling module 1130 scales the original image according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
  • the cropping module 1140 determines the position of the cropped region according to the size of the target image, the size of the face in the target image, and the positional relationship of the face in the preset target image, and performs cropping according to the determined position.
  • the face can be limited to a desired position in the target picture.
  • the positional relationship is not limited, and may include: along the width direction of the face, the distance between the two sides of the face and the two sides of the target picture are equal; along the height direction of the face, The distance between the top edge of the face and the top edge of the target image is less than the distance between the bottom edge of the face and the bottom edge of the target image.
  • the position defined by the face is adapted to better display the face.
  • the compressed picture is cropped so that in the cropped picture, the face is horizontally centered on the picture, and the vertical position is calculated from top to bottom (heigth dst -face_height)/3. Specifically, as shown in Figure 8.
  • the content that needs to be cropped in the image is different because the content displayed in the image is different.
  • the image containing the graphic logo how to crop the image so that the target image after cropping still plays Marking is a problem.
  • the method of cutting with a three-part composition and a golden ratio composition is to cut the fixed position in the picture, and the damage to the graphic mark is great, so that it is difficult to ensure that the cut picture is satisfactory, or Manually re-cutting is not efficient.
  • the present invention provides the following scheme.
  • an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
  • Step 1310 The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
  • the features of the graphic mark are not limited, and include, but are not limited to, the color and shape of the graphic mark itself, and the background color of the graphic mark.
  • the original picture is cropped to obtain a target picture, and some or all of the features of the at least one graphic mark are retained in the target picture.
  • the retained features may not be the same as the detected features.
  • the cut target picture when detecting that the original picture is a picture including a graphic mark, the cut target picture is required to include some or all of the technical features of at least one graphic mark; the graphic mark generally indicates a specific meaning, for example, Indicates the brand of the product, etc., so retaining the characteristics of the graphic mark can make the target image obtained by the crop still reflect a specific meaning.
  • Fig. 13 on the picture of a trademark (graphic mark); after the mark is identified, when the picture of the mark is cut, the area where the mark is located (all features) is cut, or the outline shape of the mark is extracted (partially Feature); further, when there are multiple similar trademarks in the picture, it can be tailored only according to the trademark of one of the products.
  • an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
  • Step 1410 The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
  • step 1420 the size of the target picture is obtained.
  • the original image is scaled according to the size of the target image, so that the size of the original image does not exceed the size of the target image.
  • the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
  • step 1440 the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • all the images of the original image can be retained, that is, all the features of the graphic logo can be saved, which is beneficial to the complete reflection of the meaning of the graphic logo after the cropping.
  • the image of the original image cannot fill the cropping area, the image of the original image is centered in the cropping area, which is beneficial to ensure that the cropped image exhibits a symmetrical effect.
  • an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
  • Step 1510 The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
  • step 1520 the height and width of the original picture are detected.
  • Step 1530 includes the height and width of the original picture.
  • Step 1540 calculating a ratio of the height of the original picture to the height of the target picture, and calculating a ratio of the width of the original picture to the width of the target picture, and using the maximum value of the obtained ratio as a ratio of scaling the original picture, and Scale the original image proportionally.
  • the scaling is actually performed according to the maximum compression ratio. This method can ensure that the size of the original image is smaller than the size of the target image, and the original image size is the largest, thereby facilitating the clear display of the target image.
  • the characteristics of the logo can ensure that the size of the original image is smaller than the size of the target image, and the original image size is the largest, thereby facilitating the clear display of the target image. The characteristics of the logo.
  • step 1550 the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • the original picture is recorded as image src , and its width and height are respectively width src and height src .
  • the target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel.
  • a method for cropping a picture including a graphic mark which includes:
  • Step 1610 The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
  • step 1620 the size of the target picture is obtained.
  • the original image is scaled according to the size of the target image, so that the size of the original image does not exceed the size of the target image.
  • the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
  • step 1640 the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • step 1650 when the image of the original image cannot be filled with the cropping area, the area where the background color is to be extracted is selected from the original image and the color is extracted according to the edge position of the original image.
  • the original picture edge that usually contains the graphic mark is the background of the graphic mark.
  • Step 1660 Filling a portion of the cropped area that is not filled by the image of the original image according to the background color of the graphic mark retained in the target picture.
  • the background color is selected for filling, so that the color of the filling is substantially consistent with the color of the edge of the copied image, and the overall effect is very good.
  • the image resize pixel value when the image resize pixel value is copied to the middle of the image dst , if the image resize size is smaller than the image dst , that is, the width resize ⁇ width dst or the height resize ⁇ heigth dst , the missing The pixels are filled with the background color.
  • an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
  • the graphic mark detection module 1910 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
  • the features of the graphic mark are not limited, and include, but are not limited to, the color and shape of the graphic mark itself, and the background color of the graphic mark.
  • the cropping module 1920 crops the original image to obtain a target image, and retains some or all of the features of the at least one graphic identifier in the target image.
  • the retained features may not be the same as the detected features.
  • the cut target picture when detecting that the original picture is a picture including a graphic mark, the cut target picture is required to include some or all of the technical features of at least one graphic mark; the graphic mark generally indicates a specific meaning, for example, Indicates the brand of the product, etc., so retaining the characteristics of the graphic mark can make the target image obtained by the crop still reflect a specific meaning.
  • Fig. 19 on the picture of a trademark (graphic mark); after the mark is identified, when the picture of the mark is cut, the area where the mark is located (all features) is cut, or the outline shape of the mark is extracted (partially Feature); further, when there are multiple similar trademarks in the picture, it can be tailored only according to the trademark of one of the products.
  • an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
  • the graphic mark detection module 2010 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
  • the size obtaining module 2020 acquires the size of the target picture.
  • the scaling module 2030 scales the original image according to the size of the target image so that the size of the original image does not exceed the size of the target image.
  • the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
  • the cropping module 2040 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • all the images of the original image can be retained, that is, all the features of the graphic logo can be saved, which is beneficial to the complete reflection of the meaning of the graphic logo after the cropping.
  • the image of the original image cannot fill the cropping area, the image of the original image is centered in the cropping area, which is beneficial to ensure that the cropped image exhibits a symmetrical effect.
  • an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
  • the graphic mark detecting module 2110 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
  • the size detecting module 2120 detects the height and width of the original picture.
  • the size acquisition module 2130 includes the height and width of the original picture.
  • the scaling module 2140 calculates a ratio of the height of the original picture to the height of the target picture, and calculates a ratio of the width of the original picture to the width of the target picture, and uses the maximum value of the obtained ratio as a ratio of scaling the original picture. And scale the original image proportionally. In this embodiment, the scaling is actually performed according to the maximum compression ratio. This method can ensure that the size of the original image is smaller than the size of the target image, and the original image size is the largest, thereby facilitating the clear display of the target image. The characteristics of the logo.
  • the cropping module 2150 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • the original picture is recorded as image src , and its width and height are respectively width src and height src .
  • the target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel.
  • an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
  • the graphic mark detection module 2210 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
  • the size obtaining module 2220 acquires the size of the target picture.
  • the scaling module 2230 scales the original image according to the size of the target image so that the size of the original image does not exceed the size of the target image.
  • the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
  • the cropping module 2240 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
  • the color filling module 2250 selects an area where the background color to be extracted is selected from the original picture and performs color extraction when the image of the original picture cannot fill the cropping area, according to the edge position of the original picture.
  • the original picture edge that usually contains the graphic mark is the background of the graphic mark.
  • the color fill module 2250 fills a portion of the crop region that is not filled with the image of the original image according to the background color of the graphic mark retained in the target image.
  • the background color is selected for filling, so that the color of the filling is substantially consistent with the color of the edge of the copied image, and the overall effect is very good.
  • the missing when the image resize pixel value is copied to the middle of the image dst , if the image resize size is smaller than the image dst , that is, the width resize ⁇ width dst or the height resize ⁇ heigth dst , the missing will be The pixels are filled with the background color.
  • the present invention provides the following scheme.
  • an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
  • Step 2310 Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • the color of the edge position of the graphic mark picture is generally the background color.
  • the background color of the edge position area is extracted. .
  • step 2320 the colors in the area are extracted.
  • Step 2330 determining whether the graphic flag is included in the picture according to the color in the extracted area.
  • the middle part of the picture is a graphic mark, in order to highlight the graphic mark, in addition to the graphic in the general picture
  • the color of the background portion other than the logo is relatively single and lacks change.
  • the technical solution of the embodiment is based on the feature of the image including the graphic mark, and the color is detected according to the edge position of the image to effectively identify whether the extracted color is the background color, and then judge Whether the picture contains a graphic logo.
  • a white vehicle logo is centered in the picture, and the background portion of the non-vehicle logo is black; the color is extracted at the edge position of the picture, and the extracted colors are all black, which is consistent with Contains the characteristics of the background color of the graphic mark, so it is judged that the picture contains the graphic mark.
  • an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
  • Step 2410 Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • Step 2420 extracting luminance values of each pixel in the region under one or more color channels.
  • the one or more color channels include at least one of the following: a red channel, a green channel, and a blue channel.
  • Step 2430 Determine, according to the color in the extracted area, whether the graphic flag is included in the picture.
  • an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
  • Step 2510 Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • Step 2520 extracting luminance values of each pixel in the region under one or more color channels.
  • Step 2530 counting the number of pixels having the same brightness value under each color channel.
  • Step 2540 calculating the variance of the number of pixels under each color channel according to the number of pixels of each brightness value under each color channel.
  • Step 2550 Determine whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels.
  • the variance of the number of pixels is a value that can reflect the change in the color difference, and based on the change of the value, it can be accurately determined whether the extracted color is the background color.
  • an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
  • Step 2610 Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • Step 2620 extracting luminance values of each pixel in the region under one or more color channels.
  • step 2630 the number of pixels having the same brightness value under each color channel is counted.
  • Step 2640 calculating the proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel.
  • Step 2650 Calculate an average proportion of the number of pixels of all the brightness values under each color channel according to the proportion of the number of pixels of each brightness value under each color channel.
  • Step 2660 Calculate the variance of the number of pixels in each color channel according to the proportion of the number of pixels of each brightness value in each color channel and the average proportion of the number of pixels of all the brightness values in each color channel. .
  • Step 2670 Determine whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels. When the determination result is YES, the picture includes the graphic mark. According to the technical solution of the embodiment, a detailed technical solution for calculating the variance is provided.
  • Count the number of brightness values of each channel for the three channels R, G, and B, count the number of pixels from 0 to 255 for each brightness value, and record it as a 0 , a 1 , a 2 ,... , a 255 , the highest number of brightness values is recorded as the brightness value of the color of the channel.
  • Threshold Recall rate Accuracy D>1000 69.50% 98.40% D>500 85.90% 96.40% D>300 95.70% 95.20%
  • the variance > 300 is used as a criterion for judging whether or not a picture contains a graphic mark.
  • an embodiment of the present invention provides a method for detecting a picture of a graphic mark, which includes:
  • Step 2710 Calculate a distance between an outer edge and an inner edge of the area according to the size of the picture.
  • an area that may be the background of the graphic mark may be estimated based on the overall calculation of the picture.
  • Step 2720 selecting an area from the picture according to a distance between an outer edge and an inner edge of the area.
  • the area is hollow, and an outer edge of the area is coincident with an edge of the picture.
  • the area around the picture is actually selected. If the picture contains a graphic mark, the area is most likely the background of the graphic mark.
  • Step 2730 extract the color in the area.
  • Step 2740 judging whether the graphic flag is included in the picture according to the color in the extracted area.
  • an area of pixels occupying 1/5 of the original picture width and height may be selected, and a color is extracted therefrom for use in judging, as shown in FIG.
  • the area is the selected area.
  • an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
  • the area selection module 2910 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected. In this embodiment, by observing a large number of pictures including graphic marks, it can be concluded that the color of the edge position of the graphic mark picture is generally the background color. In order to reduce the interference of the middle color of the picture with the background color, only the background color of the edge position area is extracted. .
  • a color extraction module 2920 extracts colors in the region.
  • the graphic flag determining module 2930 determines whether the graphic flag is included in the image according to the color in the extracted region.
  • the middle part of the picture is a graphic mark.
  • the color of the background part other than the graphic mark in the general picture is relatively single and lacks change.
  • the technical solution of the example is based on the feature of the picture containing the graphic mark, and the color is extracted according to the position of the edge of the picture for detecting, which can effectively determine whether the extracted color is the background color, and thereby identify the picture containing the graphic mark.
  • a white vehicle logo is centered in the picture, and the background portion of the non-vehicle logo is black; the color is extracted at the edge position of the picture, and the extracted colors are all black, which is consistent with Contains the characteristics of the background color of the graphic mark, so it is judged that the picture contains the graphic mark.
  • An embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
  • the area selection module 2910 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • the color extraction module 2920 extracts luminance values of each pixel in the region under one or more color channels.
  • the one or more color channels include at least one of the following: a red channel, a green channel, and a blue channel.
  • the graphic flag determining module 2930 determines whether the graphic flag is included in the image according to the color in the extracted region.
  • an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
  • the area selection module 3010 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • the color extraction module 3020 extracts luminance values of each pixel in the region under one or more color channels.
  • the pixel statistics module 3030 counts the number of pixels having the same brightness value under each color channel.
  • the variance calculation module 3040 calculates the variance of the number of pixels under each color channel based on the number of pixels of each luminance value under each color channel.
  • the graphic flag determining module 3050 determines whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels. When the determination result is YES, the graphic includes the graphic mark.
  • the variance of the number of pixels is a value that can reflect the change in the color difference, and based on the change of the value, it can be accurately determined whether the extracted color is the background color.
  • an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
  • the area selection module 3110 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
  • the color extraction module 3120 extracts luminance values of each pixel in the region under one or more color channels.
  • the pixel statistics module 3130 counts the number of pixels having the same brightness value under each color channel.
  • the ratio calculation module 3140 calculates the proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel.
  • the average ratio calculation module 3150 calculates an average proportion of the number of pixels of all the luminance values under each color channel according to the proportion of the number of pixels of each luminance value under each color channel.
  • the variance calculation module 3160 calculates the number of pixels under each color channel according to the proportion of the number of pixels of each brightness value under each color channel and the average proportion of the number of pixels of all the brightness values under each color channel. Variance.
  • the graphic mark determining module 3170 determines whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels, and when the determination result is YES, the graphic includes the graphic mark. According to the technical solution of the embodiment, a detailed technical solution for calculating the variance is provided.
  • Count the number of brightness values of each channel for the three channels R, G, and B, count the number of pixels from 0 to 255 for each brightness value, and record it as a 0 , a 1 , a 2 ,... , a 255 , the highest number of brightness values is recorded as the brightness value of the color of the channel.
  • Threshold Recall rate Accuracy D>1000 69.50% 98.40% D>500 85.90% 96.40% D>300 95.70% 95.20%
  • the variance > 300 is used as a criterion for judging whether or not a picture contains a graphic mark.
  • an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
  • the distance calculation module 3210 calculates a distance between an outer edge and an inner edge of the region according to the size of the picture.
  • an area that may be the background of the graphic mark may be estimated based on the overall calculation of the picture.
  • the region selection module 3220 selects an area from the picture by the distance between the outer edge and the inner edge of the area.
  • the area is hollow, and an outer edge of the area is coincident with an edge of the picture.
  • the area around the picture is actually selected. If the picture contains a graphic mark, the area is most likely the background of the graphic mark.
  • the color extraction module 3230 extracts colors in the area.
  • the graphic flag determining module 3240 determines whether the graphic flag is included in the image according to the color in the extracted region.
  • an area of pixels occupying 1/5 of the original picture width and height may be selected, and a color is extracted therefrom for use in determining, as shown in FIG.
  • the area is the selected area.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor DSP
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals.
  • signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 33 schematically illustrates a block diagram of a computing device for performing the method in accordance with the present invention.
  • the computing device conventionally includes a processor 3310 and a computer program product or computer readable medium in the form of a memory 3320.
  • the memory 3320 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 3320 has a storage space 3330 for program code 3331 for performing any of the method steps described above.
  • the storage space 3330 for program code may include respective program codes 3331 for respectively implementing various steps in the above method.
  • the program code can be read from or written to one or more computer program products.
  • Such computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG.
  • the storage unit may have a storage segment, a storage space, and the like arranged similarly to the storage 3320 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit comprises computer readable code 3331' for performing the steps of the method according to the invention, ie code that can be read by a processor such as, for example, 3310, which when executed by the computing device causes the calculation The device performs the various steps in the methods described above.
  • the present invention is applicable to computer systems/servers that can operate with numerous other general purpose or special purpose computing system environments or configurations.
  • Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to, personal computer systems, Server computer system, thin client, thick client, handheld or laptop device, microprocessor based system, set top box, programmable consumer electronics, network personal computer, small computer system, mainframe computer system, and any system including any of the above Distributed cloud computing technology environments, and more.
  • the computer system/server can be described in the general context of computer system executable instructions (such as program modules) being executed by a computer system.
  • program modules may include routines, programs, target programs, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the computer system/server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communication network.
  • program modules may be located on a local or remote computing system storage medium including storage devices.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The present invention mainly relates to the technical field of Internet, and a main aim is to adopt a proper cropping method in a timely manner for different pictures, and provided are a picture cropping method and device and image detecting method and device, the method comprising: detecting an original picture to be cropped, and detecting a characteristic element comprised in the original picture; selecting a cropping method for cropping the original picture according to the characteristic element; and cropping the original picture in the cropping method to acquire a target picture. According to the present invention, detecting the original picture before cropping the picture and detecting the characteristics element comprised in the picture, and adapting different cropping methods to crop according to a difference of characteristic elements, so as to ensure that proper cropping methods can be adopted in a timely manner for different pictures, so that the target picture acquired from cropping meets requirements.

Description

图片裁剪的方法和装置以及图片检测方法和装置Picture cutting method and device, and image detecting method and device 技术领域Technical field
本发明涉及互联网技术领域,具体而言,涉及图片裁剪的方法和装置以及图片检测方法和装置。The present invention relates to the field of Internet technologies, and in particular, to a method and apparatus for picture cropping, and a picture detecting method and apparatus.
背景技术Background technique
在互联网领域,通常需要对互联网上的大量图片进行抓取。由于互联网上的图片大小各异,会导致抓取到的图片尺寸很难符合需求,此时就需要计算机自动完成对图片的裁剪,使得图片的尺寸符合需求。In the Internet world, it is often necessary to crawl a large number of pictures on the Internet. Due to the different sizes of pictures on the Internet, it is difficult to meet the needs of the captured image size. In this case, the computer needs to automatically complete the cropping of the image, so that the size of the image meets the requirements.
对于不同的图片,由于图片中展示的内容是不同的,导致图片中需要裁剪的部分也是不同的。而目前的采用三等分构图、黄金比例构图进行裁剪的方式,统统是对图片中的固定位置进行裁剪,这样则很难保证裁剪后的图片效果令人满意。尤其有些包含人物的图片,利用现有技术的裁剪方法往往使得裁剪后的人物形象不全或残缺,使得图片无法利用,或还得通过人工的方式进行裁剪,效率低,应用不广泛。For different images, because the content displayed in the image is different, the parts of the image that need to be cropped are different. At present, the method of cropping by using the three-part composition and the golden ratio composition is to cut the fixed position in the picture, so that it is difficult to ensure that the cropped picture is satisfactory. In particular, some pictures containing characters, using the prior art cutting methods often make the cropped characters incomplete or incomplete, so that the pictures can not be used, or have to be manually cut, low efficiency, and not widely used.
发明内容Summary of the invention
鉴于上述问题,提出了本发明以便提供克服上述问题或者至少部分地解决上述问题的图片裁剪的方法和装置以及图片检测方法和装置。In view of the above problems, the present invention has been made in order to provide a method and apparatus for picture cropping and a picture detecting method and apparatus that overcome the above problems or at least partially solve the above problems.
依据本发明的一个方面,提供了一种图片裁剪的方法,其包括:对待裁剪的原始图片进行检测,检测出所述原始图片中包含的特征元素;根据所述特征元素,选择用于对所述原始图片进行裁剪的裁剪方式;按所述裁剪方式对所述原始图片进行裁剪,以得到目标图片。According to an aspect of the present invention, a method for cropping a picture includes: detecting an original picture to be cropped, detecting a feature element included in the original picture; and selecting, according to the feature element, a The cropping mode of the original image is performed; the original image is cropped according to the cropping manner to obtain a target image.
依据本发明的另一方面,还提供了一种图片裁剪的装置,其包括:特征元素检测模块,用于对待裁剪的原始图片进行检测,检测出所述原始图片中包含的特征元素;裁剪方式选择模块,用于据所述特征元素,选择用于对所述原始图片进行裁剪的裁剪方式;裁剪模块,用于按所述裁剪方式对所述原始图片进行裁剪,以得到目标图片。According to another aspect of the present invention, an apparatus for image cropping is provided, comprising: a feature element detecting module, configured to detect a cut original image, and detect a feature element included in the original image; And a selection module, configured to: according to the feature element, select a cropping manner for cropping the original image; and a cropping module, configured to crop the original image according to the cropping manner to obtain a target image.
依据本发明的一个方面,提供了一种人物图片裁剪方法,其包括:According to an aspect of the present invention, a person picture cropping method is provided, comprising:
对待裁剪的具有人物的原始图片进行检测,以检测出所述人物的人脸;Detecting the original picture of the person to be cropped to detect the face of the character;
对所述原始图片进行裁剪得到目标图片,所述目标图片中至少保留有所述人脸。The original picture is cropped to obtain a target picture, and at least the face is retained in the target picture.
依据本发明的另一个方面,提供了一种人物图片裁剪装置,其包括:According to another aspect of the present invention, a character picture cropping apparatus is provided, comprising:
人脸检测模块,用于对待裁剪的具有人物的原始图片进行检测,以检测出所述人物的人脸;a face detection module, configured to detect a cut original image having a character to detect a face of the character;
裁剪模块,用于对所述原始图片进行裁剪得到目标图片,所述目标图片中至少保留有所述人脸。And a cropping module, configured to crop the original image to obtain a target image, wherein at least the human face remains in the target image.
依据本发明的一个方面,提供了一种对包含图形标志的图片进行裁剪的方法,其包括:According to an aspect of the present invention, a method of cropping a picture including a graphic mark is provided, comprising:
对待裁剪的原始图片进行检测,检测出所述原始图片中包含的一个或多个图形标志的部分或全部特征;Detecting the cropped original image to detect some or all of the features of the one or more graphic markers included in the original image;
对所述原始图片进行裁剪得到目标图片,在所述目标图片中保留有至少一个所述图形标志的部分或全部特征。The original picture is cropped to obtain a target picture, and at least one or all of the features of the graphic mark are retained in the target picture.
依据本发明的另一个方面,提供了一种对包含图形标志的图片进行裁剪的装置,其包括:According to another aspect of the present invention, an apparatus for cropping a picture including a graphical logo is provided, comprising:
图形标志检测模块,用于对待裁剪的原始图片进行检测,检测出所述原始图片中包含的一个或多个图形标志的部分或全部特征;a graphic mark detecting module, configured to detect the original picture to be cropped, and detect some or all features of the one or more graphic marks included in the original picture;
裁剪模块,用于对所述原始图片进行裁剪得到目标图片,在所述目标图片中保留有至少一个所述图形标志的部分或全部特征。And a cropping module, configured to crop the original image to obtain a target image, and retain at least one or all of the features of the graphic identifier in the target image.
依据本发明的一个方面,提供了一种图形标志图片检测方法,其包括:According to an aspect of the present invention, a method for detecting a picture mark picture is provided, which includes:
基于待检测的图片的边缘位置,从所述图片上选择待提取颜色的区域;Selecting an area of the color to be extracted from the picture based on an edge position of the picture to be detected;
提取所述区域中的颜色;Extracting colors in the area;
根据所提取的所述区域中的颜色,判断所述图片中是否包含有图形标志。It is determined whether the graphic flag is included in the picture according to the extracted color in the area.
依据本发明的另一个方面,提供了一种图形标志图片检测装置,其包括:According to another aspect of the present invention, a graphic mark picture detecting apparatus is provided, comprising:
区域选择模块,用于基于待检测的图片的边缘位置,从所述图片上选择待提取颜色的区域;An area selection module, configured to select an area of the color to be extracted from the picture based on an edge position of the picture to be detected;
颜色提取模块,用于提取所述区域中的颜色; a color extraction module for extracting colors in the area;
图形标志判断模块,用于根据所提取的所述区域中的颜色,判断所述图片中是否包含有图形标志。The graphic mark determining module is configured to determine, according to the extracted color in the area, whether the graphic includes a graphic mark.
根据本发明的又一个方面,提出了一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行上文所述的方法。According to still another aspect of the present invention, a computer program is presented comprising computer readable code that, when executed on a computing device, causes the computing device to perform the method described above.
根据本发明的再一个方面,提出了一种计算机可读介质,其中存储了上述的计算机程序。According to still another aspect of the present invention, a computer readable medium is proposed, wherein the computer program described above is stored.
根据以上的技术方案,可知本发明的图片裁剪的方法和装置至少具有以下优点:According to the above technical solution, it is known that the method and apparatus for picture cropping of the present invention have at least the following advantages:
根据本发明的技术方案,在裁剪图片之前首先对原始图片进行检测,检测出其中包含的特征元素,并根据特征元素的不同来采用不同的裁剪方式进行裁剪,从而保证对于不同图片能够及时采用适宜的裁剪方式,使得裁剪得到的目标图片符合需求。According to the technical solution of the present invention, the original picture is first detected before the picture is cropped, and the feature elements contained therein are detected, and the different clipping methods are used according to the difference of the feature elements to ensure that the different pictures can be timely adopted. The cutting method makes the target image obtained by the cropping meet the requirements.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, and the above-described and other objects, features and advantages of the present invention can be more clearly understood. Specific embodiments of the invention are set forth below.
附图说明DRAWINGS
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those skilled in the art from a The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting. Throughout the drawings, the same reference numerals are used to refer to the same parts. In the drawing:
图1示出了根据本发明的一个实施例的图片裁剪的方法的流程图;1 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention;
图2示出了根据本发明的一个实施例的图片裁剪的方法的流程图;2 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention;
图3示出了根据本发明的一个实施例的图片裁剪的方法的流程图;3 shows a flow chart of a method of picture cropping in accordance with one embodiment of the present invention;
图4示出了根据本发明的一个实施例的图片裁剪的装置的框图;Figure 4 shows a block diagram of an apparatus for picture cropping in accordance with one embodiment of the present invention;
图5示出了根据本发明的一个实施例的人物图片裁剪方法的流程图;FIG. 5 is a flow chart showing a method for cropping a character picture according to an embodiment of the present invention; FIG.
图6示出了根据本发明的一个实施例的人物图片裁剪方法的流程图;FIG. 6 is a flow chart showing a method for cropping a person's picture according to an embodiment of the present invention; FIG.
图7示出了根据本发明的一个实施例的人物图片裁剪方法的流程图;FIG. 7 is a flow chart showing a method for cropping a character picture according to an embodiment of the present invention; FIG.
图8示出了根据本发明的一个实施例的人物图片裁剪方法的裁剪示意图;FIG. 8 is a schematic diagram showing the cropping of a character picture cropping method according to an embodiment of the present invention; FIG.
图9示出了根据本发明的一个实施例的人物图片裁剪方法的流程图;FIG. 9 is a flow chart showing a method for cropping a person's picture according to an embodiment of the present invention; FIG.
图10示出了根据本发明的一个实施例的人物图片裁剪装置的框图;FIG. 10 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention; FIG.
图11示出了根据本发明的一个实施例的人物图片裁剪装置的框图;Figure 11 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention;
图12示出了根据本发明的一个实施例的人物图片裁剪装置的框图;FIG. 12 is a block diagram showing a person picture cropping apparatus according to an embodiment of the present invention; FIG.
图13示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法的流程图;13 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图14示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法的流程图;14 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图15示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法的流程图;15 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图16示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法的流程图;16 shows a flow chart of a method of cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图17示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法裁剪的原始图片;17 illustrates an original picture cropped by a method of cropping a picture containing a graphic mark, in accordance with one embodiment of the present invention;
图18示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的方法裁剪的目标图片;FIG. 18 illustrates a target picture cropped by a method of cropping a picture including a graphic mark according to an embodiment of the present invention; FIG.
图19示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的装置的框图;19 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图20示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的装置的框图;20 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图21示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的装置的框图;21 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图22示出了根据本发明的一个实施例的对包含图形标志的图片进行裁剪的装置的框图;22 shows a block diagram of an apparatus for cropping a picture containing a graphical logo, in accordance with one embodiment of the present invention;
图23示出了根据本发明的一个实施例的图形标志检测方法的流程图;Figure 23 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention;
图24示出了根据本发明的一个实施例的图形标志检测方法的流程图;Figure 24 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention;
图25示出了根据本发明的一个实施例的图形标志检测方法的流程图;Figure 25 is a flow chart showing a method of detecting a graphic mark in accordance with one embodiment of the present invention;
图26示出了根据本发明的一个实施例的图形标志检测方法的流程图; Figure 26 is a flow chart showing a method of detecting a pattern mark in accordance with one embodiment of the present invention;
图27示出了根据本发明的一个实施例的图形标志检测方法的流程图;Figure 27 is a flow chart showing a method of detecting a pattern mark in accordance with one embodiment of the present invention;
图28示出了根据本发明的一个实施例的图形标志检测方法的工作示意图;28 is a diagram showing the operation of a method of detecting a pattern mark according to an embodiment of the present invention;
图29示出了根据本发明的一个实施例的图形标志检测装置的框图;Figure 29 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention;
图30示出了根据本发明的一个实施例的图形标志检测装置的框图;Figure 30 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention;
图31示出了根据本发明的一个实施例的图形标志检测装置的框图;Figure 31 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention;
图32示出了根据本发明的一个实施例的图形标志检测装置的框图Figure 32 is a block diagram showing a graphic mark detecting apparatus according to an embodiment of the present invention.
图33示意性地示出了用于执行根据本发明的方法的计算设备的框图;以及Figure 33 is a schematic block diagram showing a computing device for performing the method according to the present invention;
图34示意性地示出了用于保持或者携带实现根据本发明的方法的程序代码的存储单元。Fig. 34 schematically shows a storage unit for holding or carrying program code implementing the method according to the invention.
具体实施例Specific embodiment
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the embodiments of the present invention have been shown in the drawings, the embodiments Rather, these embodiments are provided so that this disclosure will be more fully understood and the scope of the disclosure will be fully disclosed.
如图1所示,本发明的一个实施例中提供了一种图片裁剪的方法,其包括:As shown in FIG. 1 , an embodiment of the present invention provides a method for cropping a picture, including:
步骤110,对待裁剪的原始图片进行检测,检测出原始图片中包含的特征元素。在本实施例中,对特征元素的类型不进行限制,其包括但不限于人物的人脸以及图形标志,例如,商品、企业的标志。Step 110: The original picture to be cropped is detected, and the feature elements included in the original picture are detected. In the present embodiment, the type of the feature element is not limited, and includes, but is not limited to, a person's face and a graphic mark, for example, a mark of a commodity or a company.
步骤120,根据特征元素,选择用于对原始图片进行裁剪的裁剪方式。在本实施例中,对裁剪方式不进行限制,例如,人物照片中特征元素为其脸部,则对应裁剪方式为裁剪下包含脸部的图片;商品标志图片中特征元素为起标示作用的图形或背景色,则将图片全部内容复制到一定区域中进行裁剪,并用背景色填充复制图片时剩余的区域。Step 120: Select a cropping method for cropping the original image according to the feature element. In this embodiment, the clipping mode is not limited. For example, if the feature element in the photo of the person is the face, the corresponding clipping mode is the picture containing the face under the cropping; the feature element in the product logo image is the graphic function of the marking. Or the background color, copy the entire content of the image into a certain area for cropping, and fill the remaining area when copying the picture with the background color.
步骤130,按裁剪方式对原始图片进行裁剪,以得到目标图片。根据本实施例的技术方案,在裁剪图片之前首先对原始图片进行检测,检测出其中包含的特征元素,并根据特征元素的不同来采用不同的裁剪方式进行裁剪,从而保证对于不同图片能够及时采用适宜的裁剪方式,使得裁剪得到的目标图片符合需求。In step 130, the original image is cropped in a cropping manner to obtain a target image. According to the technical solution of the embodiment, the original image is first detected before the image is cropped, and the feature elements included therein are detected, and the different cropping manners are used for cropping according to different feature elements, thereby ensuring timely adoption of different images. The appropriate cutting method makes the target image obtained by the cropping meet the demand.
进一步地,目标图片中保留有特征元素。这是因为通常特征元素是原始图片中的重要部分,例如人物图片中的人脸、图形标志图片中的起到标示作用的图形或背景色,都有必要进行保留。Further, feature elements are retained in the target image. This is because the usual feature elements are important parts of the original picture, such as the face in the picture of the person, the graphic or background color in the graphic logo picture, and it is necessary to keep it.
根据图1,对人物A的新闻照片进行检测,基于人脸识别技术,可以检测到人物A的脸部;则对照片裁剪时从照片上裁剪下人物A的脸部所在区域,其余部分放弃;裁剪后得到的图片中具有人物A的脸部,有利于指示人物A的身份,与人物A的新闻相配合。According to FIG. 1, the news photo of the character A is detected, and based on the face recognition technology, the face of the character A can be detected; when the photo is cropped, the area of the face of the character A is cropped from the photo, and the rest is discarded; The cropped image has the face of the character A, which is good for indicating the identity of the character A, and matches the news of the character A.
如图2所示,本发明的一个实施例中提供了一种图片裁剪的方法,其包括:As shown in FIG. 2, an embodiment of the present invention provides a method for cropping a picture, including:
步骤210,检测原始图片中是否包含人脸。Step 210: Detect whether a human face is included in the original picture.
步骤220,在原始图片包含人脸时,根据人脸选择用于对原始图片进行裁剪的裁剪方式。Step 220: When the original picture includes a human face, select a clipping mode for cropping the original picture according to the face.
步骤230,在原始图片中不包含人脸时,检测原始图片中是否包含图形标志。在本实施例中,人脸相比于图形标志具有更高的检测优先级,这是因为同时具有人脸和图形标志的图片,通常主要呈现的内容是人脸,所以优先检测人脸以进行裁剪。Step 230: When the original picture does not include a human face, it is detected whether the original picture contains a graphic mark. In this embodiment, the face has a higher detection priority than the graphic mark. This is because the picture with the face and the graphic mark at the same time is usually the main face, so the face is preferentially detected. Cropped.
步骤240,在原始图片包含图形标志时,根据图形标志选择用于对原始图片进行裁剪的裁剪方式。Step 240: When the original picture includes the graphic mark, select a cutting mode for cropping the original picture according to the graphic mark.
步骤250,在原始图片中不包含人脸和图形标志时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。在本实施例中,对通用裁剪方式不进行限制,在此提供一种能适应较多类别图片的裁剪方式:对原始图片按最小压缩比进行等比压缩,最小缩放比计算公式如下:Step 250: When the original picture does not include the face and the graphic mark, the preset universal cutting mode is selected as the cutting mode for cutting the original picture. In this embodiment, the general clipping mode is not limited. Here, a clipping mode that can adapt to more types of pictures is provided: the original image is compressed by a minimum compression ratio, and the minimum scaling ratio is calculated as follows:
min_scale=MIN(widthsrc/widthdst,heightsrc/heightdst)Min_scale=MIN(width src /width dst ,height src /height dst )
设未压缩的原始图片的宽和高分别为widthsrc,heightsrc;目标图片的宽和高分别为widthdst,heightdstLet the width and height of the uncompressed original image be width src , height src ; the width and height of the target image are width dst and height dst respectively .
将缩放后的图片中周围超过目标图片范围的像素裁剪掉以获得目标图片,这种裁剪方式有利于裁剪掉原始图片的非重要的边缘部分。The pixels in the scaled image that are more than the target image range are cropped to obtain the target image. This clipping method is useful for cropping the non-critical edge portion of the original image.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
步骤260,按裁剪方式对原始图片进行裁剪,以得到目标图片。In step 260, the original image is cropped in a cropping manner to obtain a target image.
根据图2,在一个明星新闻报道的照片中,一明星从车辆上下车,车辆上具有车标,明显地该张照片的重点是明星;此时首先基于人脸识别技术进行人脸检测,检测到明星的脸部,则进行裁剪时将明星的脸部裁剪下来即可,裁剪得到的图片中可以识别出该明星,与新闻报道相配合。According to Figure 2, in a photo of a star news report, a star gets on and off the vehicle, and the vehicle has a car logo. Obviously, the focus of the photo is a star; at this time, the face detection technology is first used for face detection and detection. To the face of the star, the face of the star can be cropped when cropping, and the star can be identified in the cropped image, which is compatible with the news report.
如图3所示,本发明的一个实施例中提供了一种图片裁剪的方法,其包括:As shown in FIG. 3, an embodiment of the present invention provides a method for cropping a picture, including:
步骤310,检测原始图片中是否包含人脸。Step 310: Detect whether a human face is included in the original picture.
步骤320,在从原始图片中检测到人脸时,统计人脸的数量。 Step 320, counting the number of faces when detecting a face from the original picture.
步骤330,在原始图片中人脸的数量为1时,根据人脸选择对应的裁剪方式。In step 330, when the number of faces in the original picture is 1, the corresponding clipping mode is selected according to the face.
步骤340,在原始图片中人脸的数量大于1时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。在本实施例中,在人脸数量大于1时,通常个人脸部并非主要内容,例如多人合照的情况,所以不必对每个人的脸部进行裁剪。Step 340: When the number of faces in the original picture is greater than 1, the preset universal cutting mode is selected as the cutting mode for cropping the original picture. In the present embodiment, when the number of faces is greater than 1, the personal face is usually not the main content, for example, in the case of multi-person photos, so it is not necessary to crop each person's face.
步骤350,在原始图片中不包含人脸时,检测原始图片中是否包含图形标志。Step 350: When the original picture does not include a human face, it is detected whether the original picture contains a graphic mark.
步骤360,在原始图片包含图形标志时,根据图形标志选择用于对原始图片进行裁剪的裁剪方式。Step 360: When the original picture includes the graphic mark, select a cutting mode for cutting the original picture according to the graphic mark.
在原始图片中不包含人脸和图形标志时,也进入步骤340:选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。When the face and the graphic mark are not included in the original picture, the process also proceeds to step 340: the preset universal cutting mode is selected as the cutting mode for cropping the original picture.
步骤370,按裁剪方式对原始图片进行裁剪,以得到目标图片。In step 370, the original image is cropped in a cropping manner to obtain a target image.
根据图3,对于某张班级合影,进行人脸检测后发现人脸数量为20个,则采用前述实施例的通用裁剪策略进行裁剪,则裁剪得到的图片中20人的全身部分基本全部得到保留。According to FIG. 3, for a certain group photo, after the face detection is performed and the number of faces is found to be 20, the general cropping strategy of the foregoing embodiment is used for cropping, and the whole body part of 20 people in the cropped picture is basically retained. .
如图4所示,本发明的一个实施例中提供了一种图片裁剪的装置,其包括:As shown in FIG. 4, an embodiment of the present invention provides an apparatus for cropping pictures, including:
特征元素检测模块410,对待裁剪的原始图片进行检测,检测出原始图片中包含的特征元素。在本实施例中,对特征元素的类型不进行限制,其包括但不限于人物的人脸以及图形标志,例如,商品、企业的标志。The feature element detecting module 410 detects the original image to be cropped, and detects the feature element included in the original image. In the present embodiment, the type of the feature element is not limited, and includes, but is not limited to, a person's face and a graphic mark, for example, a mark of a commodity or a company.
裁剪方式选择模块420,根据特征元素,选择用于对原始图片进行裁剪的裁剪方式。在本实施例中,对裁剪方式不进行限制,例如,人物照片中特征元素为其脸部,则对应裁剪方式为裁剪下包含脸部的图片;商品标志图片中特征元素为起标示作用的图形或背景色,则将图片全部内容复制到一定区域中进行裁剪,并用背景色填充复制图片时剩余的区域。The cropping mode selection module 420 selects a cropping method for cropping the original image according to the feature element. In this embodiment, the clipping mode is not limited. For example, if the feature element in the photo of the person is the face, the corresponding clipping mode is the picture containing the face under the cropping; the feature element in the product logo image is the graphic function of the marking. Or the background color, copy the entire content of the image into a certain area for cropping, and fill the remaining area when copying the picture with the background color.
裁剪模块430,按裁剪方式对原始图片进行裁剪,以得到目标图片。根据本实施例的技术方案,在裁剪图片之前首先对原始图片进行检测,检测出其中包含的特征元素,并根据特征元素的不同来采用不同的裁剪方式进行裁剪,从而保证对于不同图片能够及时采用适宜的裁剪方式,使得裁剪得到的目标图片符合需求。The cropping module 430 crops the original image in a cropping manner to obtain a target image. According to the technical solution of the embodiment, the original image is first detected before the image is cropped, and the feature elements included therein are detected, and the different cropping manners are used for cropping according to different feature elements, thereby ensuring timely adoption of different images. The appropriate cutting method makes the target image obtained by the cropping meet the demand.
进一步地,目标图片中保留有特征元素。这是因为通常特征元素是原始图片中的重要部分,例如人物图片中的人脸、图形标志图片中的起到标示作用的图形或背景色,都有必要进行保留。Further, feature elements are retained in the target image. This is because the usual feature elements are important parts of the original picture, such as the face in the picture of the person, the graphic or background color in the graphic logo picture, and it is necessary to keep it.
根据图4,对人物A的新闻照片进行检测,基于人脸识别技术,可以检测到人物A的脸部;则对照片裁剪时从照片上裁剪下人物A的脸部所在区域,其余部分放弃;裁剪后得到的图片中具有人物A的脸部,有利于指示人物A的身份,与人物A的新闻相配合。According to FIG. 4, the news photo of the character A is detected, and based on the face recognition technology, the face of the character A can be detected; when the photo is cropped, the area of the face of the character A is cropped from the photo, and the rest is discarded; The cropped image has the face of the character A, which is good for indicating the identity of the character A, and matches the news of the character A.
本发明的一个实施例中提供了一种图片裁剪的装置,其包括:An embodiment of the present invention provides a device for cropping a picture, comprising:
特征元素检测模块410,检测原始图片中是否包含人脸。The feature element detecting module 410 detects whether a face is included in the original picture.
裁剪方式选择模块420,在原始图片包含人脸时,根据人脸选择用于对原始图片进行裁剪的裁剪方式。The cropping mode selection module 420 selects a cropping method for cropping the original image according to the face when the original image includes the human face.
特征元素检测模块410在原始图片中不包含人脸时,检测原始图片中是否包含图形标志。在本实施例中,人脸相比于图形标志具有更高的检测优先级,这是因为同时具有人脸和图形标志的图片,通常主要呈现的内容是人脸,所以优先检测人脸以进行裁剪。The feature element detecting module 410 detects whether a graphic flag is included in the original image when the original image does not include a human face. In this embodiment, the face has a higher detection priority than the graphic mark. This is because the picture with the face and the graphic mark at the same time is usually the main face, so the face is preferentially detected. Cropped.
裁剪方式选择模块420在原始图片包含图形标志时,根据图形标志选择用于对原始图片进行裁剪的裁剪方式。The crop mode selection module 420 selects a crop mode for cropping the original image according to the graphic flag when the original picture includes the graphic mark.
裁剪方式选择模块420在原始图片中不包含人脸和图形标志时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。在本实施例中,对通用裁剪方式不进行限制,在此提供一种能适应较多类别图片的裁剪方式:对原始图片按最小压缩比进行等比压缩,最小缩放比计算公式如下:The cropping mode selection module 420 selects a preset general cropping mode as a cropping manner for cropping the original image when the original image does not include a face and a graphic logo. In this embodiment, the general clipping mode is not limited. Here, a clipping mode that can adapt to more types of pictures is provided: the original image is compressed by a minimum compression ratio, and the minimum scaling ratio is calculated as follows:
min_scale=MIN(widthsrc/widthdst,heightsrc/heightdst)Min_scale=MIN(width src /width dst ,height src /height dst )
设未压缩的原始图片的宽和高分别为widthsrc,heightsrc;目标图片的宽和高分别为widthdst,heightdstLet the width and height of the uncompressed original image be width src , height src ; the width and height of the target image are width dst and height dst respectively .
将缩放后的图片中周围超过目标图片范围的像素裁剪掉以获得目标图片,这种裁剪方式有利于裁剪掉原始图片的非重要的边缘部分。The pixels in the scaled image that are more than the target image range are cropped to obtain the target image. This clipping method is useful for cropping the non-critical edge portion of the original image.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
裁剪模块430按裁剪方式对原始图片进行裁剪,以得到目标图片。The cropping module 430 crops the original image in a cropping manner to obtain a target image.
根据图4,在一个明星新闻报道的照片中,一明星从车辆上下车,车辆上具有车标,明显地该张照片的重点是明星;此时首先基于人脸识别技术进行人脸检测,检测到明星的脸部,则进行裁剪时将明星的脸部裁剪下来即可,裁剪得到的图片中可以识别出该明星,与新闻报道相配合。According to Figure 4, in a photo of a star news report, a star gets on and off the vehicle, and the vehicle has a car logo. Obviously, the focus of the photo is a star; at this time, the face detection technology is first used for face detection and detection. To the face of the star, the face of the star can be cropped when cropping, and the star can be identified in the cropped image, which is compatible with the news report.
本发明的一个实施例中提供了一种图片裁剪的装置,其包括:An embodiment of the present invention provides a device for cropping a picture, comprising:
特征元素检测模块410,检测原始图片中是否包含人脸,并在从原始图片中检测到人脸时,统计人脸的数量。The feature element detecting module 410 detects whether a face is included in the original picture, and counts the number of faces when the face is detected from the original picture.
裁剪方式选择模块420,在原始图片中人脸的数量为1时,根据人脸选择对应的裁剪方式。The cropping mode selection module 420 selects a corresponding cropping mode according to the face when the number of faces in the original picture is 1.
裁剪方式选择模块420在原始图片中人脸的数量大于1时,选择预设的通用裁剪方式作为对所述原始图片 进行裁剪的裁剪方式。在本实施例中,在人脸数量大于1时,通常个人脸部并非主要内容,例如多人合照的情况,所以不必对每个人的脸部进行裁剪。When the number of faces in the original picture is greater than 1, the cutting mode selection module 420 selects a preset universal cutting mode as the original picture. The cutting method for cropping. In the present embodiment, when the number of faces is greater than 1, the personal face is usually not the main content, for example, in the case of multi-person photos, so it is not necessary to crop each person's face.
特征元素检测模块410,在原始图片中不包含人脸时,检测原始图片中是否包含图形标志。The feature element detecting module 410 detects whether a graphic flag is included in the original image when the original image does not include a human face.
裁剪方式选择模块420在原始图片包含图形标志时,根据图形标志选择用于对原始图片进行裁剪的裁剪方式。The crop mode selection module 420 selects a crop mode for cropping the original image according to the graphic flag when the original picture includes the graphic mark.
裁剪方式选择模块420在原始图片中不包含人脸和图形标志时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。The cropping mode selection module 420 selects a preset general cropping mode as a cropping manner for cropping the original image when the original image does not include a face and a graphic logo.
裁剪模块430,按裁剪方式对原始图片进行裁剪,以得到目标图片。The cropping module 430 crops the original image in a cropping manner to obtain a target image.
根据图4,对于某张班级合影,进行人脸检测后发现人脸数量为20个,则采用前述实施例的通用裁剪策略进行裁剪,则裁剪得到的图片中20人的全身部分基本全部得到保留。According to FIG. 4, for a certain group photo, after the face detection is performed and the number of faces is 20, the general cropping strategy of the foregoing embodiment is used for cropping, and the whole body part of 20 people in the cropped picture is basically retained. .
对于不同的图片,由于图片中展示的内容是不同的,导致图片中需要裁剪的部分也是不同的,例如,对于人物图片而言,由于不同图片中的人物大小、位置都有所不同。而目前现有技术普遍采用三等分构图、黄金比例构图进行裁剪的方式统一采用对图片中的固定位置进行裁剪,利用现有技术的裁剪方法往往使得裁剪后的人物形象不全或残缺,这样则很难保证裁剪后的图片效果令人满意,使得裁后的图片往往无法利用,或还得通过人工的方式进行重新裁剪,效率低下,应用也不广泛。对此,本发明提供了如下方案。For different images, the content that needs to be cropped in the image is different because the content displayed in the image is different. For example, for the character image, the size and position of the characters in different images are different. At present, the prior art generally adopts a three-part composition and a golden ratio composition for cropping, and uniformly adopts a method of cutting a fixed position in a picture. The cutting method using the prior art often causes the cropped character to be incomplete or incomplete, and thus It is difficult to ensure that the cropped image is satisfactory, so that the cropped image is often unusable, or it has to be manually cropped, which is inefficient and not widely used. In this regard, the present invention provides the following scheme.
如图5所示,本发明的一个实施例中提供了一种人物图片裁剪方法,其包括:As shown in FIG. 5, an embodiment of the present invention provides a method for cropping a character image, including:
步骤510,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。在本实施例中,基于现有的人脸识别技术即可以识别出人脸。In step 510, the original picture of the person to be cropped is detected to detect the face of the person. In the present embodiment, a human face can be recognized based on the existing face recognition technology.
步骤520,对原始图片进行裁剪得到目标图片,目标图片中至少保留有人脸。根据本实施例的技术方案,人脸是识别人物的关键部分,所以裁剪下的目标图片仍能够准确反映用户身份;通过人脸检测,无论原始图片中人物的大小、位置如何,都能够准确定位人脸,只要确定人脸就可以进行裁剪,裁剪效果不受到原始图片中人物的大小、位置的影响。In step 520, the original image is cropped to obtain a target image, and at least a human face is retained in the target image. According to the technical solution of the embodiment, the human face is a key part for recognizing the character, so the target image under the cropping can still accurately reflect the user's identity; through the face detection, the image can be accurately positioned regardless of the size and position of the character in the original image. The face can be cropped as long as the face is determined, and the cropping effect is not affected by the size and position of the person in the original picture.
根据图5,原始图片为某人的全身照,则基于人脸识别技术,可以从照片中识别出其脸部位置;对该全身照进行裁剪,裁剪下包含脸部区域的目标图片。According to FIG. 5, the original picture is a full-body picture of a person, based on the face recognition technology, the face position can be recognized from the photo; the full-length picture is cropped, and the target picture including the face area is cropped.
如图6所示,本发明的一个实施例中提供了一种人物图片裁剪方法,其包括:As shown in FIG. 6, an embodiment of the present invention provides a method for cropping a character image, which includes:
步骤610,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。In step 610, the original picture with the character to be cropped is detected to detect the face of the person.
步骤620,获取目标图片的尺寸,以及获取目标图片中人脸的尺寸。Step 620: Obtain a size of the target image, and obtain a size of the face in the target image.
步骤630,根据目标图片中人脸的尺寸,对原始图片进行缩放,以将原始图片中人脸的尺寸调整为目标图片中人脸的尺寸。Step 630: The original image is scaled according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
步骤640,按目标图片的尺寸,选取对原始图片进行裁剪的区域,并进行裁剪以得到目标图片。根据本实施例的技术方案,无论原始图片中的人脸过大还是过小,都能够将其以适宜的尺寸呈现在目标图片中。In step 640, according to the size of the target picture, the area where the original picture is cropped is selected, and cropped to obtain the target picture. According to the technical solution of the embodiment, whether the face in the original picture is too large or too small, it can be presented in the target picture in an appropriate size.
根据图6,原始图片为某人的全身照,则基于人脸识别技术,可以从照片中识别出其脸部位置;根据需求的人脸尺寸,对全身照进行缩放;然后对该全身照进行裁剪,裁剪下包含脸部区域的目标图片。According to FIG. 6, the original picture is a full-body photo of a person, based on the face recognition technology, the face position can be recognized from the photo; the whole body photo is scaled according to the required face size; and then the whole body photo is taken Crop, crop the target image containing the face area.
如图7所示,本发明的一个实施例中提供了一种人物图片裁剪方法,其包括:As shown in FIG. 7, an embodiment of the present invention provides a method for cropping a character image, including:
步骤710,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。In step 710, the original picture of the person to be cropped is detected to detect the face of the person.
步骤720,检测原始图片中人脸的尺寸。 Step 720, detecting the size of the face in the original picture.
步骤730,获取目标图片的尺寸,以及根据预设的目标图片与其中人脸之间的比例关系、目标图片的尺寸,计算目标图片中人脸的尺寸。Step 730: Obtain a size of the target image, and calculate a size of the face in the target image according to a proportional relationship between the preset target image and the face thereof, and a size of the target image.
步骤740,根据原始图片中人脸的尺寸、目标图片中人脸的尺寸,计算对原始图片进行缩放的比例,并按照比例进行缩放。Step 740: Calculate the scale of scaling the original image according to the size of the face in the original picture and the size of the face in the target picture, and scale according to the scale.
步骤750,按目标图片的尺寸,选取对原始图片进行裁剪的区域,并进行裁剪以得到目标图片。Step 750: Select an area to be cropped by the original picture according to the size of the target picture, and perform cropping to obtain the target picture.
根据图7,设原始图片记为imagesrc,其宽和高分别为widthsrc与heightsrc,裁剪要获得的目标图片记为imagedst,其宽和高分别为widthdst与heigthdst,单位都为像素。设检测出的原始图片中人脸的宽和高分别为face_wdithsrc,face_heightsrc,对图片进行等比例压缩,设压缩后图片中人脸的宽和高分别为face_width,face_height,则压缩后的图片满足:widthdst=3*face_width,则根据该关系可以计算出目标图片中人脸的尺寸,具体如图8所示,斜线部分为人脸所在区域。According to Figure 7, the original picture is recorded as image src , and its width and height are respectively width src and height src . The target picture to be obtained by clipping is image dst , and its width and height are width dst and heigth dst , respectively. Pixel. Let the width and height of the face in the original image detected are face_wdith src and face_height src , and the image is scaled proportionally. The width and height of the face in the compressed image are face_width, face_height, and the compressed image is compressed. Satisfaction: width dst = 3 * face_width, according to the relationship can calculate the size of the face in the target picture, as shown in Figure 8, the slash part is the area where the face is located.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图9所示,本发明的一个实施例中提供了一种人物图片裁剪方法,其包括:As shown in FIG. 9, an embodiment of the present invention provides a method for cropping a character image, including:
步骤910,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。 In step 910, the original picture of the person to be cropped is detected to detect the face of the person.
步骤920,获取目标图片的尺寸,以及获取目标图片中人脸的尺寸。Step 920: Obtain a size of the target image, and obtain a size of the face in the target image.
步骤930,根据目标图片中人脸的尺寸,对原始图片进行缩放,以将原始图片中人脸的尺寸调整为目标图片中人脸的尺寸。Step 930: The original image is scaled according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
步骤940,根据目标图片的尺寸、目标图片中人脸的尺寸、以及预设的目标图片中人脸的位置关系,确定进行裁剪的区域的位置,并按确定的位置进行裁剪。根据本实施例的技术方案,可以使得人脸限定在目标图片中的所需位置。 Step 940, determining the position of the cropped area according to the size of the target picture, the size of the face in the target picture, and the positional relationship of the face in the preset target picture, and cutting according to the determined position. According to the technical solution of the embodiment, the face can be limited to a desired position in the target picture.
在本实施例中,对于位置关系不进行限制,其可以包括:沿人脸的宽度方向,人脸的两侧边缘与目标图片的两侧边缘之间的距离相等;沿人脸的高度方向,人脸的顶边边缘与目标图片的顶边边缘之间的距离,小于人脸的底边边缘与目标图片的底边边缘之间的距离。根据本实施例的技术方案,所将人脸限定的位置适合较好地展现人脸。In this embodiment, the positional relationship is not limited, and may include: along the width direction of the face, the distance between the two sides of the face and the two sides of the target picture are equal; along the height direction of the face, The distance between the top edge of the face and the top edge of the target image is less than the distance between the bottom edge of the face and the bottom edge of the target image. According to the technical solution of the embodiment, the position defined by the face is adapted to better display the face.
根据图9,结合前述的实施例,对压缩后的图片进行裁剪,使得在裁剪后的图片中,人脸位于图片水平居中,垂直由上到下计算(heigthdst一face_height)/3开始的位置,具体如图8所示。According to FIG. 9, in combination with the foregoing embodiment, the compressed picture is cropped so that in the cropped picture, the face is horizontally centered on the picture, and the vertical position is calculated from top to bottom (heigth dst -face_height)/3. Specifically, as shown in Figure 8.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图10所示,本发明的一个实施例中提供了一种人物图片裁剪装置,其包括:As shown in FIG. 10, an embodiment of the present invention provides a person picture cropping apparatus, including:
人脸检测模块1010,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。在本实施例中,基于现有的人脸识别技术即可以识别出人脸。The face detection module 1010 detects the original picture of the person to be cropped to detect the face of the person. In the present embodiment, a human face can be recognized based on the existing face recognition technology.
裁剪模块1020,对原始图片进行裁剪得到目标图片,目标图片中至少保留有人脸。根据本实施例的技术方案,人脸是识别人物的关键部分,所以裁剪下的目标图片仍能够准确反映用户身份;通过人脸检测,无论原始图片中人物的大小、位置如何,都能够准确定位人脸,只要确定人脸就可以进行裁剪,裁剪效果不受到原始图片中人物的大小、位置的影响。The cropping module 1020 crops the original image to obtain a target image, and at least a human face is retained in the target image. According to the technical solution of the embodiment, the human face is a key part for recognizing the character, so the target image under the cropping can still accurately reflect the user's identity; through the face detection, the image can be accurately positioned regardless of the size and position of the character in the original image. The face can be cropped as long as the face is determined, and the cropping effect is not affected by the size and position of the person in the original picture.
根据图10,原始图片为某人的全身照,则基于人脸识别技术,可以从照片中识别出其脸部位置;对该全身照进行裁剪,裁剪下包含脸部区域的目标图片。According to FIG. 10, the original picture is a full-body picture of a person, based on the face recognition technology, the face position can be recognized from the photo; the full-length picture is cropped, and the target picture including the face area is cropped.
如图11所示,本发明的一个实施例中提供了一种人物图片裁剪装置,其包括:As shown in FIG. 11, an embodiment of the present invention provides a person picture cropping apparatus, which includes:
人脸检测模块1110,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。The face detection module 1110 detects the original picture of the person to be cropped to detect the face of the person.
尺寸获取模块1120,获取目标图片的尺寸,以及获取目标图片中人脸的尺寸。The size obtaining module 1120 acquires the size of the target image and acquires the size of the face in the target image.
缩放模块1130,根据目标图片中人脸的尺寸,对原始图片进行缩放,以将原始图片中人脸的尺寸调整为目标图片中人脸的尺寸。The scaling module 1130 scales the original image according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
裁剪模块1140,按目标图片的尺寸,选取对原始图片进行裁剪的区域,并进行裁剪以得到目标图片。根据本实施例的技术方案,无论原始图片中的人脸过大还是过小,都能够将其以适宜的尺寸呈现在目标图片中。The cropping module 1140 selects an area for cropping the original image according to the size of the target image, and performs cropping to obtain the target image. According to the technical solution of the embodiment, whether the face in the original picture is too large or too small, it can be presented in the target picture in an appropriate size.
根据图11,原始图片为某人的全身照,则基于人脸识别技术,可以从照片中识别出其脸部位置;根据需求的人脸尺寸,对全身照进行缩放;然后对该全身照进行裁剪,裁剪下包含脸部区域的目标图片。According to FIG. 11, the original picture is a full-body photo of a person, based on the face recognition technology, the face position can be recognized from the photo; the whole body photo is scaled according to the required face size; and then the whole body photo is taken Crop, crop the target image containing the face area.
如图12所示,本发明的一个实施例中提供了一种人物图片裁剪装置,其包括:As shown in FIG. 12, an embodiment of the present invention provides a person picture cropping apparatus, including:
人脸检测模块1210,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。The face detection module 1210 detects the original picture of the person to be cropped to detect the face of the person.
尺寸检测模块1220,检测原始图片中人脸的尺寸。The size detecting module 1220 detects the size of the face in the original picture.
尺寸获取模块1230,获取目标图片的尺寸,以及根据预设的目标图片与其中人脸之间的比例关系、目标图片的尺寸,计算目标图片中人脸的尺寸。The size obtaining module 1230 obtains the size of the target image, and calculates the size of the face in the target image according to the proportional relationship between the preset target image and the face thereof and the size of the target image.
缩放模块1240,根据原始图片中人脸的尺寸、目标图片中人脸的尺寸,计算对原始图片进行缩放的比例,并按照比例进行缩放。The scaling module 1240 calculates a scale for scaling the original image according to the size of the face in the original image and the size of the face in the target image, and scales according to the scale.
裁剪模块1250,按目标图片的尺寸,选取对原始图片进行裁剪的区域,并进行裁剪以得到目标图片。The cropping module 1250 selects an area for cropping the original image according to the size of the target image, and performs cropping to obtain the target image.
根据图12,设原始图片记为imagesrc,其宽和高分别为widthsrc与heightsrc,裁剪要获得的目标图片记为imagedst,其宽和高分别为widthdst与heigthdst,单位都为像素。设检测出的原始图片中人脸的宽和高分别为face_wdithsrc,face_heightsrc,对图片进行等比例压缩,设压缩后图片中人脸的宽和高分别为face_width,face_height,则压缩后的图片满足:widthdst=3*face_width,则根据该关系可以计算出目标图片中人脸的尺寸,具体如图8所示,斜线部分为人脸所在区域。According to Fig. 12, the original picture is recorded as image src , and its width and height are respectively width src and height src . The target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel. Let the width and height of the face in the original image detected are face_wdith src and face_height src , and the image is scaled proportionally. The width and height of the face in the compressed image are face_width, face_height, and the compressed image is compressed. Satisfaction: width dst = 3 * face_width, according to the relationship can calculate the size of the face in the target picture, as shown in Figure 8, the slash part is the area where the face is located.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
本发明的一个实施例中提供了一种人物图片裁剪装置,其包括:An embodiment of the present invention provides a person picture cropping apparatus, including:
人脸检测模块1110,对待裁剪的具有人物的原始图片进行检测,以检测出人物的人脸。The face detection module 1110 detects the original picture of the person to be cropped to detect the face of the person.
尺寸获取模块1120,获取目标图片的尺寸,以及获取目标图片中人脸的尺寸。 The size obtaining module 1120 acquires the size of the target image and acquires the size of the face in the target image.
缩放模块1130,根据目标图片中人脸的尺寸,对原始图片进行缩放,以将原始图片中人脸的尺寸调整为目标图片中人脸的尺寸。The scaling module 1130 scales the original image according to the size of the face in the target picture to adjust the size of the face in the original picture to the size of the face in the target picture.
裁剪模块1140,根据目标图片的尺寸、目标图片中人脸的尺寸、以及预设的目标图片中人脸的位置关系,确定进行裁剪的区域的位置,并按确定的位置进行裁剪。根据本实施例的技术方案,可以使得人脸限定在目标图片中的所需位置。The cropping module 1140 determines the position of the cropped region according to the size of the target image, the size of the face in the target image, and the positional relationship of the face in the preset target image, and performs cropping according to the determined position. According to the technical solution of the embodiment, the face can be limited to a desired position in the target picture.
在本实施例中,对于位置关系不进行限制,其可以包括:沿人脸的宽度方向,人脸的两侧边缘与目标图片的两侧边缘之间的距离相等;沿人脸的高度方向,人脸的顶边边缘与目标图片的顶边边缘之间的距离,小于人脸的底边边缘与目标图片的底边边缘之间的距离。根据本实施例的技术方案,所将人脸限定的位置适合较好地展现人脸。In this embodiment, the positional relationship is not limited, and may include: along the width direction of the face, the distance between the two sides of the face and the two sides of the target picture are equal; along the height direction of the face, The distance between the top edge of the face and the top edge of the target image is less than the distance between the bottom edge of the face and the bottom edge of the target image. According to the technical solution of the embodiment, the position defined by the face is adapted to better display the face.
根据图11,结合前述的实施例,对压缩后的图片进行裁剪,使得在裁剪后的图片中,人脸位于图片水平居中,垂直由上到下计算(heigthdst-face_height)/3开始的位置,具体如图8所示。According to FIG. 11, in combination with the foregoing embodiment, the compressed picture is cropped so that in the cropped picture, the face is horizontally centered on the picture, and the vertical position is calculated from top to bottom (heigth dst -face_height)/3. Specifically, as shown in Figure 8.
对于不同的图片,由于图片中展示的内容是不同的,导致图片中需要裁剪的部分也是不同的,例如,对于包含图形标志的图片而言,如何进行裁剪使得裁剪后得到的目标图片仍起到标示作用就是一个难题。目前的采用三等分构图、黄金比例构图进行裁剪的方式,统统是对图片中的固定位置进行裁剪,对图形标志的破坏很大,这样则很难保证裁剪后的图片效果令人满意,或采用人工方式重新裁剪,效率不高。对此,本发明提供了如下方案。For different images, the content that needs to be cropped in the image is different because the content displayed in the image is different. For example, for the image containing the graphic logo, how to crop the image so that the target image after cropping still plays Marking is a problem. At present, the method of cutting with a three-part composition and a golden ratio composition is to cut the fixed position in the picture, and the damage to the graphic mark is great, so that it is difficult to ensure that the cut picture is satisfactory, or Manually re-cutting is not efficient. In this regard, the present invention provides the following scheme.
如图13所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的方法,其包括:As shown in FIG. 13, an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
步骤1310,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。在本实施例中,对于图形标志的特征不进行限制,其包括但不限于图形标志自身的颜色、形状,以及图形标志的背景色。Step 1310: The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected. In the present embodiment, the features of the graphic mark are not limited, and include, but are not limited to, the color and shape of the graphic mark itself, and the background color of the graphic mark.
步骤1320,对原始图片进行裁剪得到目标图片,在目标图片中保留有至少一个图形标志的部分或全部特征。在本实施例中,保留的特征与检测到的特征可以不相同。根据本实施例的技术方案,在检测到原始图片为包含图形标志的图片时,则要求裁剪的目标图片中包含至少一个图形标志的部分或全部技术特征;图形标志一般表示特定的意义,例如,表示商品的品牌等,所以保留图形标志的特征可以使得裁剪得到的目标图片仍可以反映特定意义。In step 1320, the original picture is cropped to obtain a target picture, and some or all of the features of the at least one graphic mark are retained in the target picture. In this embodiment, the retained features may not be the same as the detected features. According to the technical solution of the present embodiment, when detecting that the original picture is a picture including a graphic mark, the cut target picture is required to include some or all of the technical features of at least one graphic mark; the graphic mark generally indicates a specific meaning, for example, Indicates the brand of the product, etc., so retaining the characteristics of the graphic mark can make the target image obtained by the crop still reflect a specific meaning.
根据图13,在某商标(图形标志)的图片上;在识别出该商标后,对该商标的图片进行裁剪时,裁剪下商标所在的区域(全部特征),或提取商标的轮廓形状(部分特征);进一步地,图片中有多个同类商标共存时,可以仅根据其中一个商品的商标进行裁剪。According to Fig. 13, on the picture of a trademark (graphic mark); after the mark is identified, when the picture of the mark is cut, the area where the mark is located (all features) is cut, or the outline shape of the mark is extracted (partially Feature); further, when there are multiple similar trademarks in the picture, it can be tailored only according to the trademark of one of the products.
如图14所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的方法,其包括:As shown in FIG. 14, an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
步骤1410,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。Step 1410: The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
步骤1420,获取目标图片的尺寸。In step 1420, the size of the target picture is obtained.
步骤1430,根据目标图片的尺寸,对原始图片进行缩放,使原始图片的尺寸不超过目标图片的尺寸。在本实施例中,使得原始图片的尺寸不超过目标图片的尺寸,有利于保留原始图片的全部特征。In step 1430, the original image is scaled according to the size of the target image, so that the size of the original image does not exceed the size of the target image. In this embodiment, the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
步骤1440,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。根据本实施例的技术方案,通过对原始图片进行缩放后再进行裁剪,可以保留原始图片的全部图像,也即可以保存图形标志的全部特征,有利于裁剪后图片完整反映图形标志的含义。进一步地,在原始图片的图像无法填充满裁剪区域时,将原始图片的图像居中放置在裁剪区域中,这样有利于保证裁剪得到的图片呈现对称式的效果。In step 1440, the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image. According to the technical solution of the embodiment, after the original image is scaled and then cropped, all the images of the original image can be retained, that is, all the features of the graphic logo can be saved, which is beneficial to the complete reflection of the meaning of the graphic logo after the cropping. Further, when the image of the original image cannot fill the cropping area, the image of the original image is centered in the cropping area, which is beneficial to ensure that the cropped image exhibits a symmetrical effect.
如图15所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的方法,其包括:As shown in FIG. 15, an embodiment of the present invention provides a method for cropping a picture including a graphic mark, which includes:
步骤1510,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。Step 1510: The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
步骤1520,检测原始图片的高度和宽度。In step 1520, the height and width of the original picture are detected.
步骤1530,包括原始图片的高度和宽度。 Step 1530 includes the height and width of the original picture.
步骤1540,计算原始图片的高度与目标图片的高度的比值,以及计算原始图片的宽度与目标图片的宽度的比值,并将所得到的比值中的最大值作为对原始图片进行缩放的比例,并按比例对原始图片进行缩放。在本实施例中,实际上是按照最大压缩比进行缩放,这种方式能够保证在原始图片压缩后的尺寸小于目标图片的尺寸的前提下,原始图片尺寸最大,从而有利于目标图片清晰展示图形标志的特征。 Step 1540, calculating a ratio of the height of the original picture to the height of the target picture, and calculating a ratio of the width of the original picture to the width of the target picture, and using the maximum value of the obtained ratio as a ratio of scaling the original picture, and Scale the original image proportionally. In this embodiment, the scaling is actually performed according to the maximum compression ratio. This method can ensure that the size of the original image is smaller than the size of the target image, and the original image size is the largest, thereby facilitating the clear display of the target image. The characteristics of the logo.
步骤1550,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。In step 1550, the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
根据图15,设原始图片记为imagesrc,其宽和高分别为widthsrc与heightsrc,裁剪要获得的目标图片 记为imagedst,其宽和高分别为widthdst与heigthdst,单位都为像素。则将原始图片按照最大压缩比进行压缩,最大压缩比计算公式为:max_scale=MAX(widthsrc/widthdst,heightsrc/heightdst)。According to Fig. 15, the original picture is recorded as image src , and its width and height are respectively width src and height src . The target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel. The original image is compressed according to the maximum compression ratio, and the maximum compression ratio is calculated as: max_scale=MAX(width src /width dst , height src /height dst ).
设压缩后得到的图片为imageresize,其宽和高分别为widthresize,heightresize,则:Let the image obtained after compression be image resize , and its width and height are width resize and height resize respectively:
widthresize=widthsrc/max_scale;heightresize=heightsrc/max_scale。Width resize =width src /max_scale;height resize =height src /max_scale.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图16所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的方法,其包括:As shown in FIG. 16, in an embodiment of the present invention, a method for cropping a picture including a graphic mark is provided, which includes:
步骤1610,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。Step 1610: The original picture to be cropped is detected, and some or all of the features of the one or more graphic marks included in the original picture are detected.
步骤1620,获取目标图片的尺寸。In step 1620, the size of the target picture is obtained.
步骤1630,根据目标图片的尺寸,对原始图片进行缩放,使原始图片的尺寸不超过目标图片的尺寸。在本实施例中,使得原始图片的尺寸不超过目标图片的尺寸,有利于保留原始图片的全部特征。In step 1630, the original image is scaled according to the size of the target image, so that the size of the original image does not exceed the size of the target image. In this embodiment, the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
步骤1640,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。In step 1640, the cropping area is drawn according to the size of the target image, and the image of the original image is copied into the cropping area, and the cropping area is cropped to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
步骤1650,在原始图片的图像无法填充满裁剪区域时,按原始图片的边缘位置,从原始图片上选择待提取背景色所在的区域并进行颜色提取。在本实施例中,通常包含图形标志的原始图片边缘即为图形标志的背景。In step 1650, when the image of the original image cannot be filled with the cropping area, the area where the background color is to be extracted is selected from the original image and the color is extracted according to the edge position of the original image. In this embodiment, the original picture edge that usually contains the graphic mark is the background of the graphic mark.
步骤1660,根据目标图片中保留的图形标志的背景色,对裁剪区域中未被原始图片的图像所填充的部分进行填充。根据本实施例的技术方案,选择背景色进行填充,可以使得填充的颜色与复制过去的图像边缘颜色基本一致,整体性效果非常好。Step 1660: Filling a portion of the cropped area that is not filled by the image of the original image according to the background color of the graphic mark retained in the target picture. According to the technical solution of the embodiment, the background color is selected for filling, so that the color of the filling is substantially consistent with the color of the edge of the copied image, and the overall effect is very good.
根据图16,结合前述的实施例,将imageresize的像素值拷贝到imagedst的中间时,如果imageresize的尺寸小于imagedst,即widthresize<widthdst或heightresize<heigthdst,则将缺失的像素用背景色填充。According to FIG. 16, in combination with the foregoing embodiment, when the image resize pixel value is copied to the middle of the image dst , if the image resize size is smaller than the image dst , that is, the width resize <width dst or the height resize <heigth dst , the missing The pixels are filled with the background color.
根据上述两个实施例,图17所示的logo图片,其原始尺寸为194x60。现在希望获得一张100x100的图片,则需要按以下过程处理:a)首先检测出该图片为logo图片,同时确定背景色为纯白色。b)计算最大压缩比,max_sacle=MAX(192/100,60/100)=1.92。c)按最大压缩比压缩图片,压缩后的图片的长和宽分别为100、31。d)将压缩后的图片像素居中拷贝到目标图片中,并将缺失的像素用背景色填充,得到如图18所示的图片。According to the above two embodiments, the logo image shown in Fig. 17 has an original size of 194 x 60. Now that you want to get a 100x100 image, you need to deal with it as follows: a) First detect the image as a logo image and make sure the background color is pure white. b) Calculate the maximum compression ratio, max_sacle=MAX(192/100, 60/100)=1.92. c) Compress the picture at the maximum compression ratio. The length and width of the compressed picture are 100 and 31 respectively. d) The compressed picture pixel is centered and copied into the target picture, and the missing pixels are filled with the background color to obtain a picture as shown in FIG.
如图19所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的装置,其包括:As shown in FIG. 19, an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
图形标志检测模块1910,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。在本实施例中,对于图形标志的特征不进行限制,其包括但不限于图形标志自身的颜色、形状,以及图形标志的背景色。The graphic mark detection module 1910 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture. In the present embodiment, the features of the graphic mark are not limited, and include, but are not limited to, the color and shape of the graphic mark itself, and the background color of the graphic mark.
裁剪模块1920,对原始图片进行裁剪得到目标图片,在目标图片中保留有至少一个图形标志的部分或全部特征。在本实施例中,保留的特征与检测到的特征可以不相同。根据本实施例的技术方案,在检测到原始图片为包含图形标志的图片时,则要求裁剪的目标图片中包含至少一个图形标志的部分或全部技术特征;图形标志一般表示特定的意义,例如,表示商品的品牌等,所以保留图形标志的特征可以使得裁剪得到的目标图片仍可以反映特定意义。The cropping module 1920 crops the original image to obtain a target image, and retains some or all of the features of the at least one graphic identifier in the target image. In this embodiment, the retained features may not be the same as the detected features. According to the technical solution of the present embodiment, when detecting that the original picture is a picture including a graphic mark, the cut target picture is required to include some or all of the technical features of at least one graphic mark; the graphic mark generally indicates a specific meaning, for example, Indicates the brand of the product, etc., so retaining the characteristics of the graphic mark can make the target image obtained by the crop still reflect a specific meaning.
根据图19,在某商标(图形标志)的图片上;在识别出该商标后,对该商标的图片进行裁剪时,裁剪下商标所在的区域(全部特征),或提取商标的轮廓形状(部分特征);进一步地,图片中有多个同类商标共存时,可以仅根据其中一个商品的商标进行裁剪。According to Fig. 19, on the picture of a trademark (graphic mark); after the mark is identified, when the picture of the mark is cut, the area where the mark is located (all features) is cut, or the outline shape of the mark is extracted (partially Feature); further, when there are multiple similar trademarks in the picture, it can be tailored only according to the trademark of one of the products.
如图20所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的装置,其包括:As shown in FIG. 20, an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
图形标志检测模块2010,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。The graphic mark detection module 2010 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
尺寸获取模块2020,获取目标图片的尺寸。The size obtaining module 2020 acquires the size of the target picture.
缩放模块2030,根据目标图片的尺寸,对原始图片进行缩放,使原始图片的尺寸不超过目标图片的尺寸。在本实施例中,使得原始图片的尺寸不超过目标图片的尺寸,有利于保留原始图片的全部特征。The scaling module 2030 scales the original image according to the size of the target image so that the size of the original image does not exceed the size of the target image. In this embodiment, the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
裁剪模块2040,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。根据本实施例的技术方案,通过对原始图片进行缩放后再进行裁剪,可以保留原始图片的全部图像,也即可以保存图形标志的全部特征,有利于裁剪后图片完整反映图形标志的含义。进一步地,在原始图片的图像无法填充满裁剪区域时,将原始图片的图像居中放置在裁剪区域中,这样有利于保证裁剪得到的图片呈现对称式的效果。The cropping module 2040 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image. According to the technical solution of the embodiment, after the original image is scaled and then cropped, all the images of the original image can be retained, that is, all the features of the graphic logo can be saved, which is beneficial to the complete reflection of the meaning of the graphic logo after the cropping. Further, when the image of the original image cannot fill the cropping area, the image of the original image is centered in the cropping area, which is beneficial to ensure that the cropped image exhibits a symmetrical effect.
如图21所述,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的装置,其包括: As shown in FIG. 21, an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
图形标志检测模块2110,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。The graphic mark detecting module 2110 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
尺寸检测模块2120,检测原始图片的高度和宽度。The size detecting module 2120 detects the height and width of the original picture.
尺寸获取模块2130,包括原始图片的高度和宽度。The size acquisition module 2130 includes the height and width of the original picture.
缩放模块2140,计算原始图片的高度与目标图片的高度的比值,以及计算原始图片的宽度与目标图片的宽度的比值,并将所得到的比值中的最大值作为对原始图片进行缩放的比例,并按比例对原始图片进行缩放。在本实施例中,实际上是按照最大压缩比进行缩放,这种方式能够保证在原始图片压缩后的尺寸小于目标图片的尺寸的前提下,原始图片尺寸最大,从而有利于目标图片清晰展示图形标志的特征。The scaling module 2140 calculates a ratio of the height of the original picture to the height of the target picture, and calculates a ratio of the width of the original picture to the width of the target picture, and uses the maximum value of the obtained ratio as a ratio of scaling the original picture. And scale the original image proportionally. In this embodiment, the scaling is actually performed according to the maximum compression ratio. This method can ensure that the size of the original image is smaller than the size of the target image, and the original image size is the largest, thereby facilitating the clear display of the target image. The characteristics of the logo.
裁剪模块2150,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。The cropping module 2150 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
根据图21,设原始图片记为imagesrc,其宽和高分别为widthsrc与heightsrc,裁剪要获得的目标图片记为imagedst,其宽和高分别为widthdst与heigthdst,单位都为像素。则将原始图片按照最大压缩比进行压缩,最大压缩比计算公式为:max_scale=MAX(widthsrc/widthdst,heightsrc/heightdst)。According to Fig. 21, the original picture is recorded as image src , and its width and height are respectively width src and height src . The target picture to be obtained by cropping is recorded as image dst , and its width and height are respectively width dst and heigth dst , and the units are Pixel. The original image is compressed according to the maximum compression ratio, and the maximum compression ratio is calculated as: max_scale=MAX(width src /width dst , height src /height dst ).
设压缩后得到的图片为imageresize,其宽和高分别为widthresize,heightresize,则:Let the image obtained after compression be image resize , and its width and height are width resize and height resize respectively:
widthresize=widthsrc/max_scale;heightresize=heightsrc/max_scale。Width resize =width src /max_scale;height resize =height src /max_scale.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图22所示,本发明的一个实施例中提供了一种对包含图形标志的图片进行裁剪的装置,其包括:As shown in FIG. 22, an embodiment of the present invention provides an apparatus for cropping a picture including a graphic mark, including:
图形标志检测模块2210,对待裁剪的原始图片进行检测,检测出原始图片中包含的一个或多个图形标志的部分或全部特征。The graphic mark detection module 2210 detects the original picture to be cropped, and detects some or all of the features of the one or more graphic marks included in the original picture.
尺寸获取模块2220,获取目标图片的尺寸。The size obtaining module 2220 acquires the size of the target picture.
缩放模块2230,根据目标图片的尺寸,对原始图片进行缩放,使原始图片的尺寸不超过目标图片的尺寸。在本实施例中,使得原始图片的尺寸不超过目标图片的尺寸,有利于保留原始图片的全部特征。The scaling module 2230 scales the original image according to the size of the target image so that the size of the original image does not exceed the size of the target image. In this embodiment, the size of the original picture is not more than the size of the target picture, which is advantageous for retaining all the features of the original picture.
裁剪模块2240,按目标图片的尺寸划出裁剪区域,并将原始图片的图像复制到裁剪区域中,对裁剪区域进行裁剪得到目标图片,以保留原始图片中所有图形标志的全部特征。The cropping module 2240 divides the cropping area according to the size of the target image, and copies the image of the original image into the cropping area, and crops the cropping area to obtain the target image, so as to retain all the features of all the graphic markers in the original image.
颜色填充模块2250,在原始图片的图像无法填充满裁剪区域时,按原始图片的边缘位置,从原始图片上选择待提取背景色所在的区域并进行颜色提取。在本实施例中,通常包含图形标志的原始图片边缘即为图形标志的背景。The color filling module 2250 selects an area where the background color to be extracted is selected from the original picture and performs color extraction when the image of the original picture cannot fill the cropping area, according to the edge position of the original picture. In this embodiment, the original picture edge that usually contains the graphic mark is the background of the graphic mark.
颜色填充模块2250根据目标图片中保留的图形标志的背景色,对裁剪区域中未被原始图片的图像所填充的部分进行填充。根据本实施例的技术方案,选择背景色进行填充,可以使得填充的颜色与复制过去的图像边缘颜色基本一致,整体性效果非常好。The color fill module 2250 fills a portion of the crop region that is not filled with the image of the original image according to the background color of the graphic mark retained in the target image. According to the technical solution of the embodiment, the background color is selected for filling, so that the color of the filling is substantially consistent with the color of the edge of the copied image, and the overall effect is very good.
根据图22,结合前述的实施例,将imageresize的像素值拷贝到imagedst的中间时,如果imageresize的尺寸小于imagedst,即widthresize<widthdst或heightresize<heigthdst,则将缺失的像素用背景色填充。According to FIG. 22, in combination with the foregoing embodiment, when the image resize pixel value is copied to the middle of the image dst , if the image resize size is smaller than the image dst , that is, the width resize <width dst or the height resize <heigth dst , the missing will be The pixels are filled with the background color.
根据上述两个实施例,图17所示的logo图片,其原始尺寸为194x60。现在希望获得一张100x100的图片,则需要按以下过程处理:a)首先检测出该图片为logo图片,同时确定背景色为纯白色。b)计算最大压缩比,max_sacle=MAX(192/100,60/100)=1.92。c)按最大压缩比压缩图片,压缩后的图片的长和宽分别为100、31。d)将压缩后的图片像素居中拷贝到目标图片中,并将缺失的像素用背景色填充,得到如图18所示的图片。According to the above two embodiments, the logo image shown in Fig. 17 has an original size of 194 x 60. Now that you want to get a 100x100 image, you need to deal with it as follows: a) First detect the image as a logo image and make sure the background color is pure white. b) Calculate the maximum compression ratio, max_sacle=MAX(192/100, 60/100)=1.92. c) Compress the picture at the maximum compression ratio. The length and width of the compressed picture are 100 and 31 respectively. d) The compressed picture pixel is centered and copied into the target picture, and the missing pixels are filled with the background color to obtain a picture as shown in FIG.
一般地,对图片进行何种方式的处理,取决于图片中包含了什么内容,因此需要对图片中包含的内容进行检测。例如,基本目前的人脸识别技术,可以检测出人物图片中所包含的人脸。但是,对于包含了图形标志的图片来说,例如,商品标志、logo图片等,目前尚且没有有效对其进行识别的技术方案,只能普遍采用人工选取的方式,效率不高。对此,本发明提供了如下方案。In general, how the image is processed depends on what is contained in the image, so the content contained in the image needs to be detected. For example, a basic current face recognition technology can detect a face included in a person's picture. However, for a picture containing a graphic mark, for example, a product mark, a logo picture, etc., there is currently no technical solution for effectively identifying it, and the method of manual selection can only be generally adopted, and the efficiency is not high. In this regard, the present invention provides the following scheme.
如图23所示,本发明的一个实施例提供了一种图形标志图片检测方法,其包括:As shown in FIG. 23, an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
步骤2310,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。在本实施例中,通过观察大量包含图形标志的图片,可以得出图形标志图片边缘位置的颜色一般为背景色,为了减少图片中间颜色对背景色的干扰,所以只提取边缘位置区域的背景色。Step 2310: Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected. In this embodiment, by observing a large number of pictures including graphic marks, it can be concluded that the color of the edge position of the graphic mark picture is generally the background color. In order to reduce the interference of the middle color of the picture with the background color, only the background color of the edge position area is extracted. .
步骤2320,提取区域中的颜色。In step 2320, the colors in the area are extracted.
步骤2330,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。根据本实施例的技术方案,对于包含图形标志的图片来说,通常图片的中部为图形标志,为了将图形标志凸显出来,一般图片中除了图形 标志以外的背景部分颜色比较单一缺乏变化,本实施例的技术方案基于包含图形标志的图片的这个特点,根据图片边缘位置提取颜色进行检测,可以有效地识别提取的颜色是不是背景色,进而判断图片是否包含图形标志。 Step 2330, determining whether the graphic flag is included in the picture according to the color in the extracted area. According to the technical solution of the embodiment, in the picture containing the graphic mark, usually the middle part of the picture is a graphic mark, in order to highlight the graphic mark, in addition to the graphic in the general picture The color of the background portion other than the logo is relatively single and lacks change. The technical solution of the embodiment is based on the feature of the image including the graphic mark, and the color is detected according to the edge position of the image to effectively identify whether the extracted color is the background color, and then judge Whether the picture contains a graphic logo.
根据图23,对于一张具有车辆标志的图片,图片内居中设置了白色的车辆标志,非车辆标志的背景部分为黑色;在图片的边缘位置提取颜色,发现提取的颜色全都是黑色,这符合包含图形标志的背景色的特点,因此判断图片中包含了图形标志。According to FIG. 23, for a picture with a vehicle logo, a white vehicle logo is centered in the picture, and the background portion of the non-vehicle logo is black; the color is extracted at the edge position of the picture, and the extracted colors are all black, which is consistent with Contains the characteristics of the background color of the graphic mark, so it is judged that the picture contains the graphic mark.
如图24所示,本发明的一个实施例提供了一种图形标志图片检测方法,其包括:As shown in FIG. 24, an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
步骤2410,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。Step 2410: Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
步骤2420,提取区域中的每个像素在一个或多个颜色通道下的亮度值。进一步地,一个或多个颜色通道包括以下至少一种:红色通道、绿色通道、蓝色通道。在本实施例中,通过提取多颜色通道亮度值的方式,有利于精确地判断所提取颜色的差异变化。 Step 2420, extracting luminance values of each pixel in the region under one or more color channels. Further, the one or more color channels include at least one of the following: a red channel, a green channel, and a blue channel. In the present embodiment, by extracting the brightness value of the multi-color channel, it is advantageous to accurately judge the difference in the difference of the extracted colors.
步骤2430,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。Step 2430: Determine, according to the color in the extracted area, whether the graphic flag is included in the picture.
如图25所示,本发明的一个实施例提供了一种图形标志图片检测方法,其包括:As shown in FIG. 25, an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
步骤2510,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。Step 2510: Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
步骤2520,提取区域中的每个像素在一个或多个颜色通道下的亮度值。 Step 2520, extracting luminance values of each pixel in the region under one or more color channels.
步骤2530,统计每个颜色通道下的具有相同亮度值的像素的数量。 Step 2530, counting the number of pixels having the same brightness value under each color channel.
步骤2540,根据每个颜色通道下的每种亮度值的像素的数量,计算每个颜色通道下的像素数量的方差。 Step 2540, calculating the variance of the number of pixels under each color channel according to the number of pixels of each brightness value under each color channel.
步骤2550,根据一个或多个通道的像素数量的方差,判断区域的颜色是否为图形标志的背景色,判断结果为是时表示图片中包含有图形标志。根据本实施例的技术方案,像素数量的方差是能够反映出颜色差异变化的数值,根据该数值的变化可以准确判断所提取的颜色是否为背景色。Step 2550: Determine whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels. When the determination result is YES, the picture includes the graphic mark. According to the technical solution of the embodiment, the variance of the number of pixels is a value that can reflect the change in the color difference, and based on the change of the value, it can be accurately determined whether the extracted color is the background color.
如图26所示,本发明的一个实施例提供了一种图形标志图片检测方法,其包括:As shown in FIG. 26, an embodiment of the present invention provides a method for detecting a graphic mark picture, which includes:
步骤2610,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。Step 2610: Select an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
步骤2620,提取区域中的每个像素在一个或多个颜色通道下的亮度值。 Step 2620, extracting luminance values of each pixel in the region under one or more color channels.
步骤2630,统计每个颜色通道下的具有相同亮度值的像素的数量。At step 2630, the number of pixels having the same brightness value under each color channel is counted.
步骤2640,根据每个颜色通道下的相同亮度值的像素的数量,计算每个颜色通道下的每种亮度值的像素数量的占比。 Step 2640, calculating the proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel.
步骤2650,根据每个颜色通道下的每种亮度值的像素数量的占比,计算每个颜色通道下的所有亮度值的像素数量的平均占比。Step 2650: Calculate an average proportion of the number of pixels of all the brightness values under each color channel according to the proportion of the number of pixels of each brightness value under each color channel.
步骤2660,根据每个颜色通道下的每种亮度值的像素数量的占比,以及每个颜色通道下的所有亮度值的像素数量的平均占比,计算每个颜色通道下的像素数量的方差。Step 2660: Calculate the variance of the number of pixels in each color channel according to the proportion of the number of pixels of each brightness value in each color channel and the average proportion of the number of pixels of all the brightness values in each color channel. .
步骤2670,根据一个或多个通道的像素数量的方差,判断区域的颜色是否为图形标志的背景色,判断结果为是时表示图片中包含有图形标志。根据本实施例的技术方案,提供一种详细的计算方差的技术方案。Step 2670: Determine whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels. When the determination result is YES, the picture includes the graphic mark. According to the technical solution of the embodiment, a detailed technical solution for calculating the variance is provided.
根据图26,对于某张待检测的图片,需要按照以下过程处理:According to Figure 26, for a picture to be detected, it needs to be processed as follows:
1、统计各个通道亮度值的数量:对R、G、B三个通道,分别统计从0~255每个亮度值的像素的个数,记为a0,a1,a2,...,a255,将数量最多的亮度值记为该通道的颜色的亮度值。1. Count the number of brightness values of each channel: for the three channels R, G, and B, count the number of pixels from 0 to 255 for each brightness value, and record it as a 0 , a 1 , a 2 ,... , a 255 , the highest number of brightness values is recorded as the brightness value of the color of the channel.
2、计算各个亮度值的占比。设每个通道的像素的总数为total,则:2. Calculate the proportion of each brightness value. Let the total number of pixels per channel be total, then:
Figure PCTCN2015095862-appb-000001
Figure PCTCN2015095862-appb-000001
计算各个像素值数量的占比,记为R0,R1,R2,...,R255,则:Calculate the proportion of the number of individual pixel values, denoted as R 0 , R 1 , R 2 ,..., R 255 , then:
Ri=(ai/total)*100R i = (a i /total)*100
3、计算方差。对每个通道,分别计算R0,R1,R2,...,R255的方差,分别记为DR,DG,DB。记各通道的平均占比为avg,最终的方差为Dfinall,则:3. Calculate the variance. For each channel, the variances of R 0 , R 1 , R 2 , ..., R 255 are calculated, respectively, as D R , D G , D B . Note that the average ratio of each channel is avg, and the final variance is D finall , then:
Figure PCTCN2015095862-appb-000002
Figure PCTCN2015095862-appb-000002
Figure PCTCN2015095862-appb-000003
Figure PCTCN2015095862-appb-000003
Dfinall=(DR+DG+DB)/3D finall =(D R +D G +D B )/3
4、确定图片是否包含图形标志。理论上方差越大,该图片包含图形标志的可能性越大,下面是在2000 张图片上的试验结果,通过设置不同的方差阈值得出的结果如下:4. Determine if the picture contains a graphic mark. The greater the difference above the theory, the more likely the picture contains graphical signs, the following is in 2000 The test results on the picture, the results obtained by setting different variance thresholds are as follows:
阈值Threshold 召回率Recall rate 准确率Accuracy
D>1000D>1000 69.50%69.50% 98.40%98.40%
D>500D>500 85.90%85.90% 96.40%96.40%
D>300D>300 95.70%95.70% 95.20%95.20%
因此,在本实施例中将方差>300作为判断一张图片是否包含图形标志的标准。Therefore, in the present embodiment, the variance > 300 is used as a criterion for judging whether or not a picture contains a graphic mark.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图27所示,本发明的一个实施例提供了一种图形标志图片检测方法,其包括:As shown in FIG. 27, an embodiment of the present invention provides a method for detecting a picture of a graphic mark, which includes:
步骤2710,根据所述图片的尺寸,计算所述区域的外边缘与内边缘之间的距离。在本实施例中,可以根据图片整体计算,估算可能是图形标志的背景的区域。Step 2710: Calculate a distance between an outer edge and an inner edge of the area according to the size of the picture. In this embodiment, an area that may be the background of the graphic mark may be estimated based on the overall calculation of the picture.
步骤2720,按所述区域的外边缘与内边缘之间的距离,从所述图片上选取区域。在本实施例中,所述区域呈中空状,所述区域的外边缘与所述图片的边缘一致。在本实施例中,实际上是选择图片四周的区域,如果图片中包含图形标志,则该区域最可能是图形标志的背景。 Step 2720, selecting an area from the picture according to a distance between an outer edge and an inner edge of the area. In this embodiment, the area is hollow, and an outer edge of the area is coincident with an edge of the picture. In this embodiment, the area around the picture is actually selected. If the picture contains a graphic mark, the area is most likely the background of the graphic mark.
步骤2730,提取区域中的颜色。 Step 2730, extract the color in the area.
步骤2740,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。 Step 2740, judging whether the graphic flag is included in the picture according to the color in the extracted area.
根据图27,对于待检测是否包含图形标志的图片,可以选取分别占原始图宽和高1/5的像素的区域,从中提取颜色以用于进行判断,具体如图28所示,其中斜线区域为选择的区域。According to FIG. 27, for a picture to be detected whether or not the graphic mark is included, an area of pixels occupying 1/5 of the original picture width and height may be selected, and a color is extracted therefrom for use in judging, as shown in FIG. The area is the selected area.
如图29所示,本发明的一个实施例提供了一种图形标志图片检测装置,其包括:As shown in FIG. 29, an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
区域选择模块2910,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。在本实施例中,通过观察大量包含图形标志的图片,可以得出图形标志图片边缘位置的颜色一般为背景色,为了减少图片中间颜色对背景色的干扰,所以只提取边缘位置区域的背景色。The area selection module 2910 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected. In this embodiment, by observing a large number of pictures including graphic marks, it can be concluded that the color of the edge position of the graphic mark picture is generally the background color. In order to reduce the interference of the middle color of the picture with the background color, only the background color of the edge position area is extracted. .
颜色提取模块2920,提取区域中的颜色。A color extraction module 2920 extracts colors in the region.
图形标志判断模块2930,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。根据本实施例的技术方案,对于包含图形标志的图片来说,通常图片的中部为图形标志,为了将图形标志凸显出来,一般图片中除了图形标志以外的背景部分颜色比较单一缺乏变化,本实施例的技术方案基于包含图形标志的图片的这个特点,根据图片边缘位置提取颜色进行检测,可以有效地判断提取颜色是不是背景色,进而识别包含图形标志的图片。The graphic flag determining module 2930 determines whether the graphic flag is included in the image according to the color in the extracted region. According to the technical solution of the embodiment, in the picture containing the graphic mark, usually, the middle part of the picture is a graphic mark. In order to highlight the graphic mark, the color of the background part other than the graphic mark in the general picture is relatively single and lacks change. The technical solution of the example is based on the feature of the picture containing the graphic mark, and the color is extracted according to the position of the edge of the picture for detecting, which can effectively determine whether the extracted color is the background color, and thereby identify the picture containing the graphic mark.
根据图29,对于一张具有车辆标志的图片,图片内居中设置了白色的车辆标志,非车辆标志的背景部分为黑色;在图片的边缘位置提取颜色,发现提取的颜色全都是黑色,这符合包含图形标志的背景色的特点,因此判断图片中包含了图形标志。According to FIG. 29, for a picture with a vehicle logo, a white vehicle logo is centered in the picture, and the background portion of the non-vehicle logo is black; the color is extracted at the edge position of the picture, and the extracted colors are all black, which is consistent with Contains the characteristics of the background color of the graphic mark, so it is judged that the picture contains the graphic mark.
本发明的一个实施例提供了一种图形标志图片检测装置,其包括:An embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
区域选择模块2910,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。The area selection module 2910 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
颜色提取模块2920,提取区域中的每个像素在一个或多个颜色通道下的亮度值。进一步地,一个或多个颜色通道包括以下至少一种:红色通道、绿色通道、蓝色通道。在本实施例中,通过提取多颜色通道亮度值的方式,有利于精确地判断所提取颜色的差异变化。The color extraction module 2920 extracts luminance values of each pixel in the region under one or more color channels. Further, the one or more color channels include at least one of the following: a red channel, a green channel, and a blue channel. In the present embodiment, by extracting the brightness value of the multi-color channel, it is advantageous to accurately judge the difference in the difference of the extracted colors.
图形标志判断模块2930,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。The graphic flag determining module 2930 determines whether the graphic flag is included in the image according to the color in the extracted region.
如图30所示,本发明的一个实施例提供了一种图形标志图片检测装置,其包括:As shown in FIG. 30, an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
区域选择模块3010,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。The area selection module 3010 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
颜色提取模块3020,提取区域中的每个像素在一个或多个颜色通道下的亮度值。The color extraction module 3020 extracts luminance values of each pixel in the region under one or more color channels.
像素统计模块3030,统计每个颜色通道下的具有相同亮度值的像素的数量。The pixel statistics module 3030 counts the number of pixels having the same brightness value under each color channel.
方差计算模块3040,根据每个颜色通道下的每种亮度值的像素的数量,计算每个颜色通道下的像素数量的方差。The variance calculation module 3040 calculates the variance of the number of pixels under each color channel based on the number of pixels of each luminance value under each color channel.
图形标志判断模块3050,根据一个或多个通道的像素数量的方差,判断区域的颜色是否为图形标志的背景色,判断结果为是时表示图片中包含有图形标志。根据本实施例的技术方案,像素数量的方差是能够反映出颜色差异变化的数值,根据该数值的变化可以准确判断所提取的颜色是否为背景色。The graphic flag determining module 3050 determines whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels. When the determination result is YES, the graphic includes the graphic mark. According to the technical solution of the embodiment, the variance of the number of pixels is a value that can reflect the change in the color difference, and based on the change of the value, it can be accurately determined whether the extracted color is the background color.
如图31所示,本发明的一个实施例提供了一种图形标志图片检测装置,其包括:As shown in FIG. 31, an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
区域选择模块3110,基于待检测的图片的边缘位置,从图片上选择待提取颜色的区域。The area selection module 3110 selects an area of the color to be extracted from the picture based on the edge position of the picture to be detected.
颜色提取模块3120,提取区域中的每个像素在一个或多个颜色通道下的亮度值。The color extraction module 3120 extracts luminance values of each pixel in the region under one or more color channels.
像素统计模块3130,统计每个颜色通道下的具有相同亮度值的像素的数量。 The pixel statistics module 3130 counts the number of pixels having the same brightness value under each color channel.
占比计算模块3140,根据每个颜色通道下的相同亮度值的像素的数量,计算每个颜色通道下的每种亮度值的像素数量的占比。The ratio calculation module 3140 calculates the proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel.
平均占比计算模块3150,根据每个颜色通道下的每种亮度值的像素数量的占比,计算每个颜色通道下的所有亮度值的像素数量的平均占比。The average ratio calculation module 3150 calculates an average proportion of the number of pixels of all the luminance values under each color channel according to the proportion of the number of pixels of each luminance value under each color channel.
方差计算模块3160,根据每个颜色通道下的每种亮度值的像素数量的占比,以及每个颜色通道下的所有亮度值的像素数量的平均占比,计算每个颜色通道下的像素数量的方差。The variance calculation module 3160 calculates the number of pixels under each color channel according to the proportion of the number of pixels of each brightness value under each color channel and the average proportion of the number of pixels of all the brightness values under each color channel. Variance.
图形标志判断模块3170,根据一个或多个通道的像素数量的方差,判断区域的颜色是否为图形标志的背景色,判断结果为是时表示图片中包含有图形标志。根据本实施例的技术方案,提供一种详细的计算方差的技术方案。The graphic mark determining module 3170 determines whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels, and when the determination result is YES, the graphic includes the graphic mark. According to the technical solution of the embodiment, a detailed technical solution for calculating the variance is provided.
根据图31,对于某张待检测的图片,需要按照以下过程处理:According to Figure 31, for a picture to be detected, it needs to be processed as follows:
1、统计各个通道亮度值的数量:对R、G、B三个通道,分别统计从0~255每个亮度值的像素的个数,记为a0,a1,a2,...,a255,将数量最多的亮度值记为该通道的颜色的亮度值。1. Count the number of brightness values of each channel: for the three channels R, G, and B, count the number of pixels from 0 to 255 for each brightness value, and record it as a 0 , a 1 , a 2 ,... , a 255 , the highest number of brightness values is recorded as the brightness value of the color of the channel.
2、计算各个亮度值的占比。设每个通道的像素的总数为total,则:2. Calculate the proportion of each brightness value. Let the total number of pixels per channel be total, then:
Figure PCTCN2015095862-appb-000004
Figure PCTCN2015095862-appb-000004
计算各个像素值数量的占比,记为R0,R1,R2,...,R255,则:Calculate the proportion of the number of individual pixel values, denoted as R 0 , R 1 , R 2 ,..., R 255 , then:
Ri=(ai/total)*100R i = (a i /total)*100
3、计算方差。对每个通道,分别计算R0,R1,R2,...,R255的方差,分别记为DR,DG,DB。记各通道的平均占比为avg,最终的方差为Dfinall,则:3. Calculate the variance. For each channel, the variances of R 0 , R 1 , R 2 , ..., R 255 are calculated, respectively, as D R , D G , D B . Note that the average ratio of each channel is avg, and the final variance is D finall , then:
Figure PCTCN2015095862-appb-000005
Figure PCTCN2015095862-appb-000005
Figure PCTCN2015095862-appb-000006
Figure PCTCN2015095862-appb-000006
Dfinall=(DR+DG+DB)/3D finall =(D R +D G +D B )/3
4、确定图片是否包含图形标志。理论上方差越大,该图片包含图形标志的可能性越大,下面是在2000张图片上的试验结果,通过设置不同的方差阈值得出的结果如下:4. Determine if the picture contains a graphic mark. The larger the theoretical difference is, the more likely the picture contains the graphic mark. The following is the test result on 2000 pictures. The results obtained by setting different variance thresholds are as follows:
阈值Threshold 召回率Recall rate 准确率Accuracy
D>1000D>1000 69.50%69.50% 98.40%98.40%
D>500D>500 85.90%85.90% 96.40%96.40%
D>300D>300 95.70%95.70% 95.20%95.20%
因此,在本实施例中将方差>300作为判断一张图片是否包含图形标志的标准。Therefore, in the present embodiment, the variance > 300 is used as a criterion for judging whether or not a picture contains a graphic mark.
需要说明的是,上述各个公式并不是实现本发明的唯一公式,仅作为实施例的一种实现方式。技术人员可以根据业务需要对公式做适当变形,例如增加常量或变量或系数等方式,依然落在本发明的保护范围之内。It should be noted that each of the above formulas is not the only formula for implementing the present invention, and is merely an implementation of the embodiment. It is still within the scope of the present invention that the skilled person can appropriately deform the formula according to the business needs, such as adding constants or variables or coefficients.
如图32所示,本发明的一个实施例提供了一种图形标志图片检测装置,其包括:As shown in FIG. 32, an embodiment of the present invention provides a graphic mark picture detecting apparatus, including:
距离计算模块3210,根据所述图片的尺寸,计算所述区域的外边缘与内边缘之间的距离。在本实施例中,可以根据图片整体计算,估算可能是图形标志的背景的区域。The distance calculation module 3210 calculates a distance between an outer edge and an inner edge of the region according to the size of the picture. In this embodiment, an area that may be the background of the graphic mark may be estimated based on the overall calculation of the picture.
区域选择模块3220,按所述区域的外边缘与内边缘之间的距离,从所述图片上选取区域。在本实施例中,所述区域呈中空状,所述区域的外边缘与所述图片的边缘一致。在本实施例中,实际上是选择图片四周的区域,如果图片中包含图形标志,则该区域最可能是图形标志的背景。The region selection module 3220 selects an area from the picture by the distance between the outer edge and the inner edge of the area. In this embodiment, the area is hollow, and an outer edge of the area is coincident with an edge of the picture. In this embodiment, the area around the picture is actually selected. If the picture contains a graphic mark, the area is most likely the background of the graphic mark.
颜色提取模块3230,提取区域中的颜色。The color extraction module 3230 extracts colors in the area.
图形标志判断模块3240,根据所提取的区域中的颜色,判断图片中是否包含有图形标志。The graphic flag determining module 3240 determines whether the graphic flag is included in the image according to the color in the extracted region.
根据图32,对于待检测是否包含图形标志的图片,可以选取分别占原始图宽和高1/5的像素的区域,从中提取颜色以用于进行判断,具体如图6所示,其中斜线区域为选择的区域。According to FIG. 32, for a picture to be detected whether or not the graphic mark is included, an area of pixels occupying 1/5 of the original picture width and height may be selected, and a color is extracted therefrom for use in determining, as shown in FIG. The area is the selected area.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。 The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general purpose systems can also be used with the teaching based on the teachings herein. The structure required to construct such a system is apparent from the above description. Moreover, the invention is not directed to any particular programming language. It is to be understood that the invention may be embodied in a variety of programming language, and the description of the specific language has been described above in order to disclose the preferred embodiments of the invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that the embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of the description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, the various features of the invention are sometimes grouped together into a single embodiment, in the above description of the exemplary embodiments of the invention, Figure, or a description of it. However, the method disclosed is not to be interpreted as reflecting the intention that the claimed invention requires more features than those recited in the claims. Rather, as the following claims reflect, inventive aspects reside in less than all features of the single embodiments disclosed herein. Therefore, the claims following the specific embodiments are hereby explicitly incorporated into the embodiments, and each of the claims as a separate embodiment of the invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will appreciate that the modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components. In addition to such features and/or at least some of the processes or units being mutually exclusive, any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined. Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features that are included in other embodiments and not in other features, combinations of features of different embodiments are intended to be within the scope of the present invention. Different embodiments are formed and formed. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的图片裁剪的装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functionality of some or all of the components of the apparatus for cropping pictures in accordance with embodiments of the present invention may be implemented in practice using a microprocessor or digital signal processor (DSP). The invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein. Such a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
例如,图33示意性地示出了用于执行根据本发明的方法的计算设备的框图。该计算设备传统上包括处理器3310和以存储器3320形式的计算机程序产品或者计算机可读介质。存储器3320可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器3320具有用于执行上述方法中的任何方法步骤的程序代码3331的存储空间3330。例如,用于程序代码的存储空间3330可以包括分别用于实现上面的方法中的各种步骤的各个程序代码3331。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图34所述的便携式或者固定存储单元。该存储单元可以具有与图33的计算设备中的存储器3320类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括用于执行根据本发明的方法步骤的计算机可读代码3331’,即可以由例如诸如3310之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。For example, Figure 33 schematically illustrates a block diagram of a computing device for performing the method in accordance with the present invention. The computing device conventionally includes a processor 3310 and a computer program product or computer readable medium in the form of a memory 3320. The memory 3320 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM. Memory 3320 has a storage space 3330 for program code 3331 for performing any of the method steps described above. For example, the storage space 3330 for program code may include respective program codes 3331 for respectively implementing various steps in the above method. The program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG. The storage unit may have a storage segment, a storage space, and the like arranged similarly to the storage 3320 in the computing device of FIG. The program code can be compressed, for example, in an appropriate form. Typically, the storage unit comprises computer readable code 3331' for performing the steps of the method according to the invention, ie code that can be read by a processor such as, for example, 3310, which when executed by the computing device causes the calculation The device performs the various steps in the methods described above.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It is to be noted that the above-described embodiments are illustrative of the invention and are not intended to be limiting, and that the invention may be devised without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as a limitation. The word "comprising" does not exclude the presence of the elements or steps that are not recited in the claims. The word "a" or "an" The invention can be implemented by means of hardware comprising several distinct elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means can be embodied by the same hardware item. The use of the words first, second, and third does not indicate any order. These words can be interpreted as names.
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。In addition, it should be noted that the language used in the specification has been selected for the purpose of readability and teaching, and is not intended to be construed or limited. Therefore, many modifications and changes will be apparent to those skilled in the art without departing from the scope of the invention. The disclosure of the present invention is intended to be illustrative, and not restrictive, and the scope of the invention is defined by the appended claims.
本发明可以应用于计算机系统/服务器,其可与众多其它通用或专用计算系统环境或配置一起操作。适于与计算机系统/服务器一起使用的众所周知的计算系统、环境和/或配置的例子包括但不限于:个人计算机系统、 服务器计算机系统、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的系统、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机系统、大型计算机系统和包括上述任何系统的分布式云计算技术环境,等等。The present invention is applicable to computer systems/servers that can operate with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to, personal computer systems, Server computer system, thin client, thick client, handheld or laptop device, microprocessor based system, set top box, programmable consumer electronics, network personal computer, small computer system, mainframe computer system, and any system including any of the above Distributed cloud computing technology environments, and more.
计算机系统/服务器可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机系统/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上。The computer system/server can be described in the general context of computer system executable instructions (such as program modules) being executed by a computer system. Generally, program modules may include routines, programs, target programs, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types. The computer system/server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communication network. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including storage devices.
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。 &quot;an embodiment,&quot; or &quot;an embodiment,&quot; or &quot;an embodiment,&quot; In addition, it is noted that the phrase "in one embodiment" is not necessarily referring to the same embodiment.

Claims (54)

  1. 一种图片裁剪的方法,其包括:A method of cropping a picture, comprising:
    对待裁剪的原始图片进行检测,检测出所述原始图片中包含的特征元素;Detecting the cropped original image and detecting the feature elements included in the original image;
    根据所述特征元素,选择用于对所述原始图片进行裁剪的裁剪方式;Selecting a cropping manner for cropping the original image according to the feature element;
    按所述裁剪方式对所述原始图片进行裁剪,以得到目标图片。The original picture is cropped according to the cropping manner to obtain a target picture.
  2. 根据权利要求1所述的方法,其中,所述特征元素包括人物的人脸和/或图形标志。The method of claim 1 wherein the feature element comprises a person's face and/or graphical indicia.
  3. 根据权利要求1-2任一项所述的方法,其中,对待裁剪的原始图片进行检测,检测出所述原始图片中包含的特征元素,具体包括:The method according to any one of claims 1-2, wherein the original image to be cropped is detected, and the feature elements included in the original image are detected, which specifically includes:
    检测所述原始图片中是否包含所述人脸;Detecting whether the face is included in the original picture;
    在所述原始图片中不包含所述人脸时,检测所述原始图片中是否包含所述图形标志。When the face is not included in the original picture, it is detected whether the graphic flag is included in the original picture.
  4. 根据权利要求1-3任一项所述的方法,其中,还包括:The method of any of claims 1-3, further comprising:
    在所述原始图片中不包含所述人脸和所述图形标志时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。When the face and the graphic mark are not included in the original picture, a preset universal cutting mode is selected as a cutting mode for cropping the original picture.
  5. 根据权利要求1-4任一项所述的方法,其中,在根据所述图片元素,选择用于对所述原始图片进行裁剪的裁剪方式之前,还包括:The method according to any one of claims 1 to 4, further comprising: before selecting a cropping manner for cropping the original image according to the picture element, further comprising:
    在从所述原始图片中检测到所述人脸时,统计所述人脸的数量;Counting the number of faces when the face is detected from the original picture;
    根据所述图片元素,选择用于对所述原始图片进行裁剪的裁剪方式,具体包括:And selecting, according to the picture element, a cutting manner for cutting the original image, specifically:
    在所述原始图片中所述人脸的数量为1时,根据所述人脸选择对应的裁剪方式。When the number of the faces in the original picture is 1, the corresponding clipping mode is selected according to the face.
  6. 根据权利要求1-5任一项所述的方法,其中,还包括:The method of any of claims 1-5, further comprising:
    在所述原始图片中所述人脸的数量大于1时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。When the number of the faces in the original picture is greater than 1, the preset universal cutting mode is selected as a cutting mode for cropping the original picture.
  7. 根据权利要求1-6中任一项所述的方法,其中,A method according to any one of claims 1 to 6, wherein
    所述目标图片中保留有所述特征元素。The feature element is retained in the target picture.
  8. 一种图片裁剪的装置,其包括:A picture cropping device, comprising:
    特征元素检测模块,用于对待裁剪的原始图片进行检测,检测出所述原始图片中包含的特征元素;a feature element detecting module, configured to detect the original picture to be cropped, and detect a feature element included in the original picture;
    裁剪方式选择模块,用于据所述特征元素,选择用于对所述原始图片进行裁剪的裁剪方式;a cutting mode selection module, configured to select a cutting mode for cutting the original image according to the feature element;
    裁剪模块,用于按所述裁剪方式对所述原始图片进行裁剪,以得到目标图片。And a cropping module, configured to crop the original image according to the cutting manner to obtain a target image.
  9. 根据权利要求8所述的装置,其中,所述特征元素包括人物的人脸和/或图形标志。The apparatus of claim 8 wherein the feature element comprises a person's face and/or a graphical logo.
  10. 根据权利要求8-9任一项所述的装置,其中,所述特征元素检测模块检测所述原始图片中是否包含所述人脸;并在所述原始图片中不包含所述人脸时,检测所述原始图片中是否包含所述图形标志。The apparatus according to any one of claims 8-9, wherein the feature element detecting module detects whether the face is included in the original picture; and when the face is not included in the original picture, Detecting whether the graphic flag is included in the original picture.
  11. 根据权利要求8-10任一项所述的装置,其中,所述裁剪方式选择模块在所述原始图片中不包含所述人脸和所述图形标志时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。The device according to any one of claims 8 to 10, wherein the cropping mode selection module selects a preset general clipping mode as a pair when the human face and the graphic logo are not included in the original picture. The original image is cropped in a cropped manner.
  12. 根据权利要求8-11任一项所述的装置,其中,所述特征元素检测模块还在从所述原始图片中检测到所述人脸时,统计所述人脸的数量;所述裁剪方式选择模块在所述原始图片中所述人脸的数量为1时,根据所述人脸选择对应的裁剪方式。The apparatus according to any one of claims 8 to 11, wherein the feature element detecting module further counts the number of the faces when the face is detected from the original picture; the cutting mode When the number of the faces in the original picture is 1, the selection module selects a corresponding clipping mode according to the face.
  13. 根据权利要求8-12任一项所述的装置,其中,所述裁剪方式选择模块在所述原始图片中所述人脸的数量大于1时,选择预设的通用裁剪方式作为对所述原始图片进行裁剪的裁剪方式。The apparatus according to any one of claims 8 to 12, wherein, when the number of the faces in the original picture is greater than 1, the cutting mode selection module selects a preset universal cutting mode as the original The way the image is cropped.
  14. 根据权利要求8-13任一项所述的装置,其中,所述目标图片中保留有所述特征元素。Apparatus according to any of claims 8-13, wherein said feature element is retained in said target picture.
  15. 一种人物图片裁剪方法,其包括:A character picture cropping method, comprising:
    对待裁剪的具有人物的原始图片进行检测,以检测出所述人物的人脸;Detecting the original picture of the person to be cropped to detect the face of the character;
    对所述原始图片进行裁剪得到目标图片,所述目标图片中至少保留有所述人脸。The original picture is cropped to obtain a target picture, and at least the face is retained in the target picture.
  16. 根据权利要求15所述的方法,其中,对所述原始图片进行裁剪得到目标图片,在所述目标图片中至少保留所述人脸,具体包括:The method according to claim 15, wherein the original picture is cropped to obtain a target picture, and at least the face is retained in the target picture, which specifically includes:
    获取所述目标图片的尺寸,以及获取所述目标图片中所述人脸的尺寸;Obtaining a size of the target picture, and acquiring a size of the face in the target picture;
    根据所述目标图片中所述人脸的尺寸,对所述原始图片进行缩放,以将所述原始图片中所述人脸的尺寸调整为所述目标图片中所述人脸的尺寸;And scaling the original image according to the size of the face in the target picture to adjust a size of the face in the original picture to a size of the face in the target picture;
    按所述目标图片的尺寸,选取对所述原始图片进行裁剪的区域,并进行裁剪以得到所述目标图片。According to the size of the target picture, an area for cropping the original picture is selected, and cropped to obtain the target picture.
  17. 根据权利要求16所述的方法,其中,对待裁剪的具有人物的原始图片进行检测,以检测出所述人物 的人脸,还包括:The method according to claim 16, wherein the original picture of the person to be cropped is detected to detect the person The face also includes:
    检测所述原始图片中所述人脸的尺寸;Detecting a size of the face in the original picture;
    根据所述目标图片中所述人脸的尺寸,对所述原始图片进行缩放,具体包括:And scaling the original image according to the size of the face in the target image, specifically:
    根据所述原始图片中所述人脸的尺寸、所述目标图片中所述人脸的尺寸,计算对所述原始图片进行缩放的比例,并按照所述比例进行缩放。Calculating a scale for scaling the original image according to a size of the face in the original picture and a size of the face in the target picture, and performing scaling according to the ratio.
  18. 根据权利要求16所述的方法,其中,获取所述目标图片中所述人脸的尺寸,具体包括:The method of claim 16, wherein the obtaining the size of the face in the target picture comprises:
    根据预设的所述目标图片与其中所述人脸之间的比例关系、所述目标图片的尺寸,计算所述目标图片中所述人脸的尺寸。Calculating a size of the face in the target picture according to a preset ratio relationship between the target picture and the face therein, and a size of the target picture.
  19. 根据权利要求16所述的方法,其中,按所述目标图片的尺寸,选取对所述原始图片进行裁剪的区域,并进行裁剪以得到所述目标图片,具体包括:The method according to claim 16, wherein the area of the original picture is selected according to the size of the target picture, and the area is cropped to obtain the target picture, which specifically includes:
    根据所述目标图片的尺寸、所述目标图片中所述人脸的尺寸、以及预设的所述目标图片中所述人脸的位置关系,确定所述进行裁剪的区域的位置,并按确定的位置进行裁剪。Determining a location of the cropped region according to a size of the target image, a size of the face in the target image, and a preset positional relationship of the face in the target image, and determining The position is cropped.
  20. 根据权利要求19所述的方法,其中,所述人脸与所述目标图片之间的位置关系包括:The method of claim 19, wherein the positional relationship between the face and the target picture comprises:
    沿所述人脸的宽度方向,所述人脸的两侧边缘与所述目标图片的两侧边缘之间的距离相等;A distance between two side edges of the human face and two side edges of the target picture is equal along a width direction of the face;
    沿所述人脸的高度方向,所述人脸的顶边边缘与所述目标图片的顶边边缘之间的距离,小于所述人脸的底边边缘与所述目标图片的底边边缘之间的距离。a distance between a top edge of the face and a top edge of the target image is smaller than a bottom edge of the face and a bottom edge of the target image along a height direction of the face The distance between them.
  21. 一种人物图片裁剪装置,其包括:A character picture cropping device includes:
    人脸检测模块,用于对待裁剪的具有人物的原始图片进行检测,以检测出所述人物的人脸;a face detection module, configured to detect a cut original image having a character to detect a face of the character;
    裁剪模块,用于对所述原始图片进行裁剪得到目标图片,所述目标图片中至少保留有所述人脸。And a cropping module, configured to crop the original image to obtain a target image, wherein at least the human face remains in the target image.
  22. 根据权利要求21所述的装置,其中,还包括:The device according to claim 21, further comprising:
    尺寸获取模块,用于获取所述目标图片的尺寸,以及获取所述目标图片中所述人脸的尺寸;a size obtaining module, configured to acquire a size of the target image, and obtain a size of the face in the target image;
    缩放模块,用于根据所述目标图片中所述人脸的尺寸,对所述原始图片进行缩放,以将所述原始图片中所述人脸的尺寸调整为所述目标图片中所述人脸的尺寸;a scaling module, configured to scale the original image according to a size of the face in the target picture to adjust a size of the face in the original picture to the face in the target picture size of;
    所述裁剪模块按所述目标图片的尺寸,选取对所述原始图片进行裁剪的区域,并进行裁剪以得到所述目标图片。The cropping module selects an area for cropping the original picture according to the size of the target picture, and performs cropping to obtain the target picture.
  23. 根据权利要求22所述的装置,其中,还包括:The apparatus of claim 22, further comprising:
    尺寸检测模块,用于检测所述原始图片中所述人脸的尺寸;a size detecting module, configured to detect a size of the face in the original picture;
    所述缩放模块根据所述原始图片中所述人脸的尺寸、所述目标图片中所述人脸的尺寸,计算对所述原始图片进行缩放的比例,并按照所述比例进行缩放。The scaling module calculates a scale for scaling the original image according to the size of the face in the original picture and the size of the face in the target picture, and performs scaling according to the ratio.
  24. 根据权利要求22所述的装置,其中,The device according to claim 22, wherein
    所述尺寸获取模块根据预设的所述目标图片与其中所述人脸之间的比例关系、所述目标图片的尺寸,计算所述目标图片中所述人脸的尺寸。The size obtaining module calculates a size of the face in the target picture according to a preset proportional relationship between the target picture and the face therein, and a size of the target picture.
  25. 根据权利要求22所述的装置,其中,The device according to claim 22, wherein
    所述裁剪模块根据所述目标图片的尺寸、所述目标图片中所述人脸的尺寸、以及预设的所述目标图片中所述人脸的位置关系,确定所述进行裁剪的区域的位置,并按确定的位置进行裁剪。The cropping module determines the location of the cropped region according to the size of the target image, the size of the face in the target image, and the preset positional relationship of the face in the target image. And crop according to the determined position.
  26. 根据权利要求25所述的装置,其中,所述人脸与所述目标图片之间的位置关系包括:The apparatus according to claim 25, wherein the positional relationship between the face and the target picture comprises:
    沿所述人脸的宽度方向,所述人脸的两侧边缘与所述目标图片的两侧边缘之间的距离相等;A distance between two side edges of the human face and two side edges of the target picture is equal along a width direction of the face;
    沿所述人脸的高度方向,所述人脸的顶边边缘与所述目标图片的顶边边缘之间的距离,小于所述人脸的底边边缘与所述目标图片的底边边缘之间的距离。a distance between a top edge of the face and a top edge of the target image is smaller than a bottom edge of the face and a bottom edge of the target image along a height direction of the face The distance between them.
  27. 一种对包含图形标志的图片进行裁剪的方法,其包括:A method of cropping a picture containing a graphic logo, comprising:
    对待裁剪的原始图片进行检测,检测出所述原始图片中包含的一个或多个图形标志的部分或全部特征;Detecting the cropped original image to detect some or all of the features of the one or more graphic markers included in the original image;
    对所述原始图片进行裁剪得到目标图片,在所述目标图片中保留有至少一个所述图形标志的部分或全部特征。The original picture is cropped to obtain a target picture, and at least one or all of the features of the graphic mark are retained in the target picture.
  28. 根据权利要求27所述的方法,其中,对所述原始图片进行裁剪得到目标图片,具体包括:The method of claim 27, wherein the cropping the original image to obtain a target image comprises:
    获取所述目标图片的尺寸;Obtaining a size of the target image;
    根据所述目标图片的尺寸,对所述原始图片进行缩放,使所述原始图片的尺寸不超过所述目标图片的尺寸;And scaling the original picture according to a size of the target picture, such that a size of the original picture does not exceed a size of the target picture;
    按所述目标图片的尺寸划出裁剪区域,并将所述原始图片的图像复制到所述裁剪区域中,对所述裁剪区域进行裁剪得到所述目标图片,以保留所述原始图片中所有所述图形标志的全部特征。And cropping the cropped area according to the size of the target picture, and copying the image of the original picture into the cropping area, and cropping the cropped area to obtain the target picture, to retain all the original pictures All the features of the graphic logo.
  29. 根据权利要求28所述的方法,其中,还包括:The method of claim 28, further comprising:
    检测所述原始图片的尺寸,包括所述原始图片的高度和宽度;Detecting a size of the original picture, including a height and a width of the original picture;
    获取所述目标图片的尺寸,具体包括: Obtaining the size of the target image, specifically including:
    获取所述目标图片的高度和宽度;Obtaining the height and width of the target image;
    根据所述目标图片的尺寸,对所述原始图片进行缩放,具体包括:And scaling the original image according to the size of the target image, specifically:
    计算所述原始图片的高度与所述目标图片的高度的比值,以及计算所述原始图片的宽度与所述目标图片的宽度的比值,并将所得到的比值中的最大值作为对所述原始图片进行缩放的比例,并按所述比例对所述原始图片进行缩放。Calculating a ratio of a height of the original picture to a height of the target picture, and calculating a ratio of a width of the original picture to a width of the target picture, and using a maximum value of the obtained ratio as the original The scale at which the picture is scaled, and the original picture is scaled by the scale.
  30. 根据权利要求28所述的方法,其中,还包括:The method of claim 28, further comprising:
    在所述原始图片的图像无法填充满所述裁剪区域时,根据所述目标图片中保留的图形标志的背景色,对所述裁剪区域中未被所述原始图片的图像所填充的部分进行填充。When the image of the original picture cannot fill the cropping area, the portion of the cropping area that is not filled by the image of the original image is filled according to the background color of the graphic mark retained in the target picture. .
  31. 根据权利要求30所述的方法,其中,在根据所述目标图片中保留的图形标志的背景色,对所述裁剪区域中未被所述原始图片的图像所填充的部分进行填充之前,还包括:The method according to claim 30, wherein before the filling of the portion of the cropped region that is not filled by the image of the original image, according to the background color of the graphic mark retained in the target image, :
    按所述原始图片的边缘位置,从所述原始图片上选择待提取所述背景色所在的区域并进行颜色提取。According to the edge position of the original picture, the area where the background color is to be extracted is selected from the original picture and color extraction is performed.
  32. 根据权利要求28至31中任一项所述的方法,其中,还包括:The method of any one of claims 28 to 31, further comprising:
    在所述原始图片的图像无法填充满所述裁剪区域时,将所述原始图片的图像居中放置在所述裁剪区域中。When the image of the original picture cannot fill the crop area, the image of the original picture is centered in the crop area.
  33. 一种对包含图形标志的图片进行裁剪的装置,其包括:An apparatus for cropping a picture containing a graphic logo, comprising:
    图形标志检测模块,用于对待裁剪的原始图片进行检测,检测出所述原始图片中包含的一个或多个图形标志的部分或全部特征;a graphic mark detecting module, configured to detect the original picture to be cropped, and detect some or all features of the one or more graphic marks included in the original picture;
    裁剪模块,用于对所述原始图片进行裁剪得到目标图片,在所述目标图片中保留有至少一个所述图形标志的部分或全部特征。And a cropping module, configured to crop the original image to obtain a target image, and retain at least one or all of the features of the graphic identifier in the target image.
  34. 根据权利要求33所述的装置,其中,还包括:The apparatus of claim 33, further comprising:
    尺寸获取模块,用于获取所述目标图片的尺寸;a size obtaining module, configured to acquire a size of the target image;
    缩放模块,用于根据所述目标图片的尺寸,对所述原始图片进行缩放,使所述原始图片的尺寸不超过所述目标图片的尺寸;a scaling module, configured to scale the original image according to a size of the target image, such that a size of the original image does not exceed a size of the target image;
    裁剪模块,用于按所述目标图片的尺寸划出裁剪区域,并将所述原始图片的图像复制到所述裁剪区域中,对所述裁剪区域进行裁剪得到所述目标图片,以保留所述原始图片中所有所述图形标志的全部特征。a cropping module, configured to draw a cropping area according to a size of the target image, and copy an image of the original image into the cropping area, and crop the cropping area to obtain the target image, to retain the All features of all of the graphic markers in the original image.
  35. 根据权利要求34所述的装置,其中,还包括:The device of claim 34, further comprising:
    尺寸检测模块,用于检测所述原始图片的尺寸,包括所述原始图片的高度和宽度;a size detecting module, configured to detect a size of the original picture, including a height and a width of the original picture;
    所述尺寸获取模块获取所述目标图片的高度和宽度;The size obtaining module acquires a height and a width of the target picture;
    所述缩放模块计算所述原始图片的高度与所述目标图片的高度的比值,以及计算所述原始图片的宽度与所述目标图片的宽度的比值,并将所得到的比值中的最大值作为对所述原始图片进行缩放的比例,并按所述比例对所述原始图片进行缩放。The scaling module calculates a ratio of a height of the original picture to a height of the target picture, and calculates a ratio of a width of the original picture to a width of the target picture, and uses a maximum value of the obtained ratio as The scale of the original picture is scaled, and the original picture is scaled according to the ratio.
  36. 根据权利要求34所述的装置,其中,还包括:The device of claim 34, further comprising:
    颜色填充模块,在所述原始图片的图像无法填充满所述裁剪区域时,根据所述目标图片中保留的图形标志的背景色,并按所提取的颜色对所述裁剪区域中未被所述原始图片的图像所填充的部分进行填充。a color filling module, when the image of the original picture cannot fill the cropping area, according to the background color of the graphic mark retained in the target picture, and the extracted color is not described in the cropping area The portion of the original image that is filled with the image is filled.
  37. 根据权利要求36所述的装置,其中,The device according to claim 36, wherein
    所述颜色填充模块按所述原始图片的边缘位置,从所述原始图片上选择待提取所述背景色所在的区域并进行颜色提取。The color filling module selects an area where the background color is to be extracted from the original picture according to an edge position of the original picture and performs color extraction.
  38. 根据权利要求34至37中任一项所述的装置,其中,A device according to any one of claims 34 to 37, wherein
    所述裁剪模块在所述原始图片的图像无法填充满所述裁剪区域时,将所述原始图片的图像居中放置在所述裁剪区域中。The cropping module centers the image of the original image in the cropping area when the image of the original picture cannot fill the cropping area.
  39. 一种图形标志图片检测方法,其包括:A graphic mark picture detecting method, comprising:
    基于待检测的图片的边缘位置,从所述图片上选择待提取颜色的区域;Selecting an area of the color to be extracted from the picture based on an edge position of the picture to be detected;
    提取所述区域中的颜色;Extracting colors in the area;
    根据所提取的所述区域中的颜色,判断所述图片中是否包含有图形标志。It is determined whether the graphic flag is included in the picture according to the extracted color in the area.
  40. 根据权利要求39所述的方法,其中,提取所述区域中的颜色,具体包括:The method of claim 39, wherein extracting colors in the area comprises:
    提取所述区域中的每个像素在一个或多个颜色通道下的亮度值。A luminance value for each pixel in the region under one or more color channels is extracted.
  41. 根据权利要求39-40任一项所述的方法,其中,所述一个或多个颜色通道包括以下至少一种:A method according to any of claims 39-40, wherein the one or more color channels comprise at least one of the following:
    红色通道、绿色通道、蓝色通道。Red channel, green channel, blue channel.
  42. 根据权利要求39-41任一项所述的方法,其中,根据所提取的所述区域中的颜色,判断所述图片中是否包含有图形标志,具体包括:The method according to any one of claims 39 to 41, wherein determining whether the picture is included in the picture according to the color in the extracted area comprises:
    统计每个颜色通道下的具有相同亮度值的像素的数量;Counting the number of pixels with the same brightness value under each color channel;
    根据每个颜色通道下的每种亮度值的像素的数量,计算每个颜色通道下的像素数量的方差; Calculating the variance of the number of pixels under each color channel according to the number of pixels of each brightness value under each color channel;
    根据所述一个或多个通道的像素数量的方差,判断所述区域的颜色是否为所述图形标志的背景色,判断结果为是时表示所述图片中包含有图形标志。Determining whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels, and determining that the result is YES means that the picture includes the graphic mark.
  43. 根据权利要求39-42任一项所述的方法,其中,根据每个颜色通道下的每种亮度值的像素的数量,计算每个颜色通道下的像素的方差,具体包括:The method according to any one of claims 39 to 42, wherein the variance of the pixels under each color channel is calculated according to the number of pixels of each brightness value under each color channel, and specifically includes:
    根据每个颜色通道下的相同亮度值的像素的数量,计算每个颜色通道下的每种亮度值的像素数量的占比;Calculating the proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel;
    根据每个颜色通道下的每种亮度值的像素数量的占比,计算每个颜色通道下的所有亮度值的像素数量的平均占比;Calculating the average proportion of the number of pixels of all luminance values under each color channel according to the proportion of the number of pixels of each brightness value under each color channel;
    根据每个颜色通道下的每种亮度值的像素数量的占比,以及每个颜色通道下的所有亮度值的像素数量的平均占比,计算每个颜色通道下的像素数量的方差。The variance of the number of pixels under each color channel is calculated based on the ratio of the number of pixels of each luminance value under each color channel and the average proportion of the number of pixels of all luminance values under each color channel.
  44. 根据权利要求39-43中任一项所述的方法,其中,A method according to any one of claims 39-43, wherein
    所述区域呈中空状,所述区域的外边缘与所述图片的边缘一致。The area is hollow and the outer edge of the area coincides with the edge of the picture.
  45. 根据权利要求39-44任一项的方法,其中,基于待检测的图片的边缘位置,从所述图片上选择待提取颜色的区域,具体包括:The method according to any one of claims 39 to 44, wherein selecting an area of the color to be extracted from the picture based on an edge position of the picture to be detected includes:
    根据所述图片的尺寸,计算所述区域的外边缘与内边缘之间的距离;Calculating a distance between an outer edge and an inner edge of the area according to a size of the picture;
    按所述区域的外边缘与内边缘之间的距离,从所述图片上选取区域。An area is selected from the picture by the distance between the outer edge and the inner edge of the area.
  46. 一种图形标志图片检测装置,其包括:A graphic mark picture detecting device comprising:
    区域选择模块,用于基于待检测的图片的边缘位置,从所述图片上选择待提取颜色的区域;An area selection module, configured to select an area of the color to be extracted from the picture based on an edge position of the picture to be detected;
    颜色提取模块,用于提取所述区域中的颜色;a color extraction module for extracting colors in the area;
    图形标志判断模块,用于根据所提取的所述区域中的颜色,判断所述图片中是否包含有图形标志。The graphic mark determining module is configured to determine, according to the extracted color in the area, whether the graphic includes a graphic mark.
  47. 根据权利要求46所述的装置,其中,The device according to claim 46, wherein
    所述颜色提取模块提取所述区域中的每个像素在一个或多个颜色通道下的亮度值。The color extraction module extracts luminance values for each pixel in the region under one or more color channels.
  48. 根据权利要求46-47任一项所述的装置,其中,所述一个或多个颜色通道包括以下至少一种:Apparatus according to any of claims 46-47, wherein the one or more color channels comprise at least one of the following:
    红色通道、绿色通道、蓝色通道。Red channel, green channel, blue channel.
  49. 根据权利要求46-48任一项所述的装置,其中,还包括:The apparatus of any of claims 46-48, further comprising:
    像素统计模块,用于统计每个颜色通道下的具有相同亮度值的像素的数量;a pixel statistics module, configured to count the number of pixels having the same brightness value under each color channel;
    方差计算模块,用于根据每个颜色通道下的每种亮度值的像素的数量,计算每个颜色通道下的像素数量的方差;a variance calculation module, configured to calculate a variance of the number of pixels under each color channel according to the number of pixels of each brightness value under each color channel;
    所述图形标志判断模块根据所述一个或多个通道的像素数量的方差,判断所述区域的颜色是否为所述图形标志的背景色,判断结果为是时表示所述图片中是否包含有图形标志。The graphic mark determining module determines whether the color of the area is the background color of the graphic mark according to the variance of the number of pixels of the one or more channels, and if the determination result is yes, whether the picture contains the graphic Sign.
  50. 根据权利要求46-49所述的装置,其中,还包括:The apparatus according to claims 46-49, further comprising:
    占比计算模块,用于根据每个颜色通道下的相同亮度值的像素的数量,计算每个颜色通道下的每种亮度值的像素数量的占比;a ratio calculation module, configured to calculate a proportion of the number of pixels of each brightness value under each color channel according to the number of pixels of the same brightness value under each color channel;
    平均占比计算模块,用于根据每个颜色通道下的每种亮度值的像素数量的占比,计算每个颜色通道下的所有亮度值的像素数量的平均占比;An average ratio calculation module for calculating an average proportion of the number of pixels of all luminance values under each color channel according to the proportion of the number of pixels of each luminance value in each color channel;
    所述方差计算模块根据每个颜色通道下的每种亮度值的像素数量的占比,以及每个颜色通道下的所有亮度值的像素数量的平均占比,计算每个颜色通道下的像素数量的方差。The variance calculation module calculates the number of pixels under each color channel according to the ratio of the number of pixels of each brightness value under each color channel and the average proportion of the number of pixels of all brightness values under each color channel. Variance.
  51. 根据权利要求46-50中任一项所述的装置,其中,A device according to any one of claims 46 to 50, wherein
    所述区域呈中空状,所述区域的外边缘与所述图片的边缘一致。The area is hollow and the outer edge of the area coincides with the edge of the picture.
  52. 根据权利要求46-51的装置,其中,还包括:The apparatus according to claims 46-51, further comprising:
    距离计算模块,用于根据所述图片的尺寸,计算所述区域的外边缘与内边缘之间的距离;a distance calculation module, configured to calculate a distance between an outer edge and an inner edge of the area according to a size of the picture;
    所述区域选择模块按所述区域的外边缘与内边缘之间的距离,从所述图片上选取区域。The area selection module selects an area from the picture according to a distance between an outer edge and an inner edge of the area.
  53. [根据细则91更正 15.12.2015] 
    一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1-7中的任一项所述的图片裁剪的方法,或者导致所述计算设备执行根据权利要求15-20中的任一项所述的人物图片裁剪方法,或者导致所述计算设备执行根据权利要求27-32中的任一项所述的对包含图形标志的图片进行裁剪的方法,或者导致所述计算设备执行根据权利要求39-45中的任一项所述的图形标志图片检测方法。
    [Corrected in accordance with Rule 91 15.12.2015]
    A computer program comprising computer readable code, when the computer readable code is run on a computing device, causing the computing device to perform the method of cropping a picture according to any one of claims 1-7, Or causing the computing device to perform the character picture cropping method according to any one of claims 15-20, or causing the computing device to perform the pair of containing graphics according to any one of claims 27-32 A method of cropping a picture of the logo or causing the computing device to perform the graphical logo picture detection method according to any one of claims 39-45.
  54. [根据细则91更正 15.12.2015] 
    一种计算机可读介质,其中存储了如权利要求53所述的计算机程序。
    [Corrected in accordance with Rule 91 15.12.2015]
    A computer readable medium storing the computer program of claim 53.
PCT/CN2015/095862 2014-12-24 2015-11-27 Picture cropping method and device and image detecting method and device WO2016101767A1 (en)

Applications Claiming Priority (8)

Application Number Priority Date Filing Date Title
CN201410818281.1 2014-12-24
CN201410818268.6A CN104484853A (en) 2014-12-24 2014-12-24 Method and device for clipping pictures containing graphical signs
CN201410818281.1A CN104484854A (en) 2014-12-24 2014-12-24 Cropping method and device for people pictures
CN201410820195.4A CN104484855B (en) 2014-12-24 2014-12-24 The method and apparatus that picture is cut
CN201410815644.6A CN104463176B (en) 2014-12-24 2014-12-24 Logotype picture detection method and device
CN201410820195.4 2014-12-24
CN201410815644.6 2014-12-24
CN201410818268.6 2014-12-24

Publications (1)

Publication Number Publication Date
WO2016101767A1 true WO2016101767A1 (en) 2016-06-30

Family

ID=56149212

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/095862 WO2016101767A1 (en) 2014-12-24 2015-11-27 Picture cropping method and device and image detecting method and device

Country Status (1)

Country Link
WO (1) WO2016101767A1 (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
CN110782392A (en) * 2019-07-12 2020-02-11 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN110853068A (en) * 2019-09-30 2020-02-28 华为技术有限公司 Picture processing method and device, electronic equipment and readable storage medium
CN110909638A (en) * 2019-11-11 2020-03-24 广东光速智能设备有限公司 Face recognition method and system based on ARM platform
CN110929732A (en) * 2019-11-27 2020-03-27 中国建设银行股份有限公司 Certificate image intercepting method, storage medium and certificate image intercepting device
CN111461965A (en) * 2020-04-01 2020-07-28 北京字节跳动网络技术有限公司 Picture processing method and device, electronic equipment and computer readable medium
CN111524145A (en) * 2020-04-13 2020-08-11 北京智慧章鱼科技有限公司 Intelligent picture clipping method and system, computer equipment and storage medium
CN111754487A (en) * 2020-06-24 2020-10-09 北京奇艺世纪科技有限公司 Black frame area clipping method and device and electronic equipment
CN112035196A (en) * 2020-08-04 2020-12-04 北京达佳互联信息技术有限公司 Video cover processing method and device, electronic equipment and storage medium
CN112633252A (en) * 2021-01-09 2021-04-09 浙江臻享网络科技有限公司 Certificate irradiation standardization processing method and device
CN113283436A (en) * 2021-06-11 2021-08-20 北京有竹居网络技术有限公司 Picture processing method and device and electronic equipment
CN113628229A (en) * 2021-08-04 2021-11-09 展讯通信(上海)有限公司 Image cropping method and related product
CN114666649A (en) * 2022-03-31 2022-06-24 北京奇艺世纪科技有限公司 Subtitle cut video identification method and device, electronic equipment and storage medium
CN114693518A (en) * 2022-02-15 2022-07-01 杭州印鸽科技有限公司 Picture printing-oriented intelligent picture cutting method

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030174869A1 (en) * 2002-03-12 2003-09-18 Suarez Anthony P. Image processing apparatus, image processing method, program and recording medium
CN101599122A (en) * 2009-07-02 2009-12-09 阿里巴巴集团控股有限公司 A kind of image-recognizing method and device
CN103824252A (en) * 2014-02-10 2014-05-28 安徽科大讯飞信息科技股份有限公司 Picture processing method and system
CN103854253A (en) * 2014-03-31 2014-06-11 深圳市金立通信设备有限公司 Picture processing method and terminal
CN103914689A (en) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 Picture cropping method and device based on face recognition
CN104463176A (en) * 2014-12-24 2015-03-25 北京奇虎科技有限公司 Graphical sign image detecting method and device
CN104484855A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Method and device for cropping pictures
CN104484853A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Method and device for clipping pictures containing graphical signs
CN104484854A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Cropping method and device for people pictures

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030174869A1 (en) * 2002-03-12 2003-09-18 Suarez Anthony P. Image processing apparatus, image processing method, program and recording medium
CN101599122A (en) * 2009-07-02 2009-12-09 阿里巴巴集团控股有限公司 A kind of image-recognizing method and device
CN103824252A (en) * 2014-02-10 2014-05-28 安徽科大讯飞信息科技股份有限公司 Picture processing method and system
CN103854253A (en) * 2014-03-31 2014-06-11 深圳市金立通信设备有限公司 Picture processing method and terminal
CN103914689A (en) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 Picture cropping method and device based on face recognition
CN104463176A (en) * 2014-12-24 2015-03-25 北京奇虎科技有限公司 Graphical sign image detecting method and device
CN104484855A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Method and device for cropping pictures
CN104484853A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Method and device for clipping pictures containing graphical signs
CN104484854A (en) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 Cropping method and device for people pictures

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110782392A (en) * 2019-07-12 2020-02-11 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN110782392B (en) * 2019-07-12 2023-11-14 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and storage medium
CN110580678B (en) * 2019-09-10 2023-06-20 北京百度网讯科技有限公司 Image processing method and device
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
CN110853068B (en) * 2019-09-30 2022-06-17 荣耀终端有限公司 Picture processing method and device, electronic equipment and readable storage medium
CN110853068A (en) * 2019-09-30 2020-02-28 华为技术有限公司 Picture processing method and device, electronic equipment and readable storage medium
CN110909638A (en) * 2019-11-11 2020-03-24 广东光速智能设备有限公司 Face recognition method and system based on ARM platform
CN110909638B (en) * 2019-11-11 2023-09-05 广东光速智能设备有限公司 Face recognition method and system based on ARM platform
CN110929732A (en) * 2019-11-27 2020-03-27 中国建设银行股份有限公司 Certificate image intercepting method, storage medium and certificate image intercepting device
CN111461965B (en) * 2020-04-01 2023-03-21 抖音视界有限公司 Picture processing method and device, electronic equipment and computer readable medium
CN111461965A (en) * 2020-04-01 2020-07-28 北京字节跳动网络技术有限公司 Picture processing method and device, electronic equipment and computer readable medium
CN111524145A (en) * 2020-04-13 2020-08-11 北京智慧章鱼科技有限公司 Intelligent picture clipping method and system, computer equipment and storage medium
CN111524145B (en) * 2020-04-13 2024-06-04 北京智慧章鱼科技有限公司 Intelligent picture cropping method, intelligent picture cropping system, computer equipment and storage medium
CN111754487A (en) * 2020-06-24 2020-10-09 北京奇艺世纪科技有限公司 Black frame area clipping method and device and electronic equipment
CN112035196A (en) * 2020-08-04 2020-12-04 北京达佳互联信息技术有限公司 Video cover processing method and device, electronic equipment and storage medium
CN112633252A (en) * 2021-01-09 2021-04-09 浙江臻享网络科技有限公司 Certificate irradiation standardization processing method and device
CN113283436A (en) * 2021-06-11 2021-08-20 北京有竹居网络技术有限公司 Picture processing method and device and electronic equipment
CN113283436B (en) * 2021-06-11 2024-01-23 北京有竹居网络技术有限公司 Picture processing method and device and electronic equipment
CN113628229A (en) * 2021-08-04 2021-11-09 展讯通信(上海)有限公司 Image cropping method and related product
CN114693518A (en) * 2022-02-15 2022-07-01 杭州印鸽科技有限公司 Picture printing-oriented intelligent picture cutting method
CN114666649A (en) * 2022-03-31 2022-06-24 北京奇艺世纪科技有限公司 Subtitle cut video identification method and device, electronic equipment and storage medium
CN114666649B (en) * 2022-03-31 2024-03-01 北京奇艺世纪科技有限公司 Identification method and device of subtitle cut video, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2016101767A1 (en) Picture cropping method and device and image detecting method and device
JP6719457B2 (en) Method and system for extracting main subject of image
CN110569699B (en) Method and device for carrying out target sampling on picture
EP2902941B1 (en) System and method for visually distinguishing faces in a digital image
US10620005B2 (en) Building height calculation method, device, and storage medium
CN110706150A (en) Image processing method, image processing device, electronic equipment and storage medium
WO2019096174A1 (en) Method and apparatus for garment color identification of figure images, and electronic device
WO2017000716A2 (en) Image management method and device, and terminal device
US20120288198A1 (en) Information processing apparatus, information processing method, and non-transitory computer-readable storage medium
US9916513B2 (en) Method for processing image and computer-readable non-transitory recording medium storing program
EP2977932B1 (en) Image processing apparatus, image processing method and image processing program
CN106228157B (en) Coloured image word paragraph segmentation and recognition methods based on image recognition technology
US10380452B1 (en) Systems and methods for identifying salient images
CN111753642B (en) Method and device for determining key frame
CN105678301B (en) method, system and device for automatically identifying and segmenting text image
CN110930384A (en) Crowd counting method, device, equipment and medium based on density information
CN110782392B (en) Image processing method, device, electronic equipment and storage medium
CN114119695A (en) Image annotation method and device and electronic equipment
CN110399886B (en) Screen image JND model construction method
CN110348353B (en) Image processing method and device
US20120275709A1 (en) Building texture extracting apparatus and method thereof
CN113947795A (en) Mask wearing detection method, device, equipment and storage medium
JP6354316B2 (en) Image detection apparatus and program
JP2013143594A5 (en)
US10140530B1 (en) Method and device for identifying path boundary for vehicle navigation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15871836

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15871836

Country of ref document: EP

Kind code of ref document: A1