Movatterモバイル変換


[0]ホーム

URL:


CN104851114B - A kind of method and terminal for realizing image local discoloration - Google Patents

A kind of method and terminal for realizing image local discoloration
Download PDF

Info

Publication number
CN104851114B
CN104851114BCN201510200800.2ACN201510200800ACN104851114BCN 104851114 BCN104851114 BCN 104851114BCN 201510200800 ACN201510200800 ACN 201510200800ACN 104851114 BCN104851114 BCN 104851114B
Authority
CN
China
Prior art keywords
image
target location
haar
rgb value
classifier
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related
Application number
CN201510200800.2A
Other languages
Chinese (zh)
Other versions
CN104851114A (en
Inventor
吴鸿儒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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
Application filed by Guangdong Oppo Mobile Telecommunications Corp LtdfiledCriticalGuangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201510200800.2ApriorityCriticalpatent/CN104851114B/en
Publication of CN104851114ApublicationCriticalpatent/CN104851114A/en
Application grantedgrantedCritical
Publication of CN104851114BpublicationCriticalpatent/CN104851114B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a kind of method and terminal for realizing image local discoloration.Method therein includes:Identify the target location that local discolouration is treated in the image of generation;Detect the rgb value for the target location identified;The rgb value of the target location is converted, obtains the colour switching of the target location into the image of pre-set color.Also disclose corresponding terminal.The target location of local discolouration is treated in image by identifying generation, colour switching then is carried out to the target location, the same target location in same image can be allow to take different colors, increase the interest of shooting.

Description

Translated fromChinese
一种实现图像局部变色的方法及终端A method and terminal for realizing partial color change of an image

技术领域technical field

本发明涉及图像成像技术领域,尤其涉及一种实现图像局部变色的方法及终端。The present invention relates to the field of image imaging technology, in particular to a method and terminal for realizing local color change of an image.

背景技术Background technique

目前的智能终端如手机、平板电脑等都具有照相功能,然而,使用现在的智能终端进行拍照,都是被拍摄物本身是什么颜色拍照出来就是什么颜色,即使是经过照片后处理,在色彩方面也只是增减饱和度等,且不能对被拍摄物的局部位置进行变色,即无法让拍出的照片对同一个目标位置拍出不同的颜色。The current smart terminals such as mobile phones and tablet computers all have camera functions. However, when using the current smart terminals to take pictures, the color of the subject itself is the color of the photographed object itself. Even after photo processing, in terms of color It is only to increase or decrease the saturation, etc., and cannot change the color of the local position of the subject, that is, it is impossible to make the photos taken have different colors for the same target position.

发明内容Contents of the invention

本发明提供了一种实现图像局部变色的方法及终端,以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性。The invention provides a method and a terminal for realizing local color change of an image, so that the same target position in the same image can be photographed in different colors, increasing the interest of photographing.

一方面,提供了一种实现图像局部变色的方法,包括:On the one hand, a method for realizing local discoloration of an image is provided, including:

识别生成的图像中待局部变色的目标位置;Identify the target position to be locally discolored in the generated image;

检测识别出的目标位置的RGB值;Detect the RGB value of the identified target position;

对所述目标位置的RGB值进行变换,得到所述目标位置的颜色变换成预设颜色的图像。The RGB value of the target position is converted to obtain an image in which the color of the target position is converted into a preset color.

另一方面,提供了一种终端,包括:In another aspect, a terminal is provided, comprising:

第一识别单元,用于识别生成的图像中待局部变色的目标位置;The first identification unit is used to identify the target position to be partially discolored in the generated image;

检测单元,用于检测识别出的目标位置的RGB值;a detection unit, configured to detect the RGB value of the identified target position;

第一变换单元,用于对所述目标位置的RGB值进行变换,得到所述目标位置的颜色变换成预设颜色的图像。The first transformation unit is configured to transform the RGB value of the target position to obtain an image in which the color of the target position is transformed into a preset color.

可见,根据本发明提供的一种实现图像局部变色的方法及终端,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性。It can be seen that, according to a method and terminal for realizing partial color change of an image provided by the present invention, by identifying the target position to be partially discolored in the generated image, and then performing color transformation on the target position, the same target in the same image can be Different colors can be photographed at the location, which increases the fun of shooting.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1为本发明实施例提供的一种实现图像局部变色的方法的流程示意图;FIG. 1 is a schematic flowchart of a method for realizing local discoloration of an image provided by an embodiment of the present invention;

图2为示例的待局部变色的图像;Fig. 2 is the image to be partially discolored of example;

图3为本发明实施例提供的另一种实现图像局部变色的方法的流程示意图;FIG. 3 is a schematic flowchart of another method for realizing local color change of an image provided by an embodiment of the present invention;

图4为示例的获取Haar-like特征的原始矩形特征的示意图;Fig. 4 is a schematic diagram of an example of obtaining the original rectangular feature of the Haar-like feature;

图5为本发明实施例提供的一种终端的结构示意图;FIG. 5 is a schematic structural diagram of a terminal provided by an embodiment of the present invention;

图6为本发明实施例提供的另一种终端的结构示意图。FIG. 6 is a schematic structural diagram of another terminal provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

如果用户在拍照后能使出现在同一位置的颜色不同的照片供用户选择存储,那将是一个有趣的体验。本发明提供一种实现图像局部变色的方法及终端,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性。It will be an interesting experience if the user can make photos of different colors that appear in the same location for the user to choose to store after taking a photo. The present invention provides a method and terminal for realizing partial color change of an image. By identifying the target position to be partially discolored in the generated image, and then performing color transformation on the target position, the same target position in the same image can be photographed. Different colors increase the fun of shooting.

下面结合图1-图4,对本发明实施例提供的实现图像局部变色的方法进行详细描述:The method for realizing partial discoloration of an image provided by the embodiment of the present invention is described in detail below in conjunction with FIGS. 1-4 :

请参阅图1,为本发明实施例提供的一种实现图像局部变色的方法的流程示意图,该方法包括以下步骤:Please refer to FIG. 1 , which is a schematic flowchart of a method for realizing local color change of an image provided by an embodiment of the present invention. The method includes the following steps:

步骤S101,识别生成的图像中待局部变色的目标位置。Step S101, identifying the target position to be partially discolored in the generated image.

本实施例是对生成的图像的局部位置进行变色,关键是要识别待局部变色的目标位置。如图2示例的待局部变色的图像,要进行局部变色的目标位置或目标物体是这棵树,而天空和草地的颜色都不改变。例如,可以应用Haar分类器算法对图像进行识别,获取待变色的目标位置。In this embodiment, the local position of the generated image is changed in color, and the key is to identify the target position to be locally changed in color. For the image to be partially discolored as shown in FIG. 2 , the target position or object to be locally discolored is the tree, and the colors of the sky and the grass do not change. For example, the Haar classifier algorithm can be applied to identify the image to obtain the target position to be discolored.

步骤S102,检测识别出的目标位置的RGB值。Step S102, detecting the RGB value of the identified target position.

颜色的变化即是对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的。在变换颜色之前,首先要检测识别出图像的目标位置原来的RGB值。The change of color is the change of the three color channels of red (R), green (G) and blue (B) and their mutual superposition to obtain various colors. Before transforming the color, it is first necessary to detect the original RGB value of the target position of the recognized image.

步骤S103,对所述目标位置的RGB值进行变换,得到所述目标位置的颜色变换成预设颜色的图像。Step S103, converting the RGB value of the target position to obtain an image in which the color of the target position is converted into a preset color.

根据想要得到的颜色,进行RGB值的计算,然后对目标位置的RGB值进行变换,即变换得到想要得到的颜色,而对该图像的目标位置之外的RGB值不进行改变,从而实现图像的局部变色。例如,可以将图2中的树变换成各种颜色,而不是图像中原本的绿色,而天空和草地的颜色不改变,用户可以选择保存其中的一张或多张树的颜色不同的照片,增加拍摄的趣味性。Calculate the RGB value according to the desired color, and then transform the RGB value of the target position, that is, transform to obtain the desired color, without changing the RGB value outside the target position of the image, so as to achieve Local discoloration of the image. For example, the tree in Figure 2 can be transformed into various colors instead of the original green in the image, while the colors of the sky and grass do not change, and the user can choose to save one or more photos with different colors of the trees, Increase the fun of shooting.

根据本发明实施例提供的一种实现图像局部变色的方法,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性。According to a method for realizing partial discoloration of an image provided by an embodiment of the present invention, by identifying the target position to be locally discolored in the generated image, and then performing color transformation on the target position, the same target position in the same image can be Shoot different colors to increase the fun of shooting.

请参阅图3,为本发明实施例提供的另一种实现图像局部变色的方法的流程示意图,该方法包括以下步骤:Please refer to FIG. 3 , which is a schematic flowchart of another method for realizing local color change of an image provided by an embodiment of the present invention. The method includes the following steps:

步骤S201,应用AdaBoost算法训练样本的Haar特征后得到区分所述目标位置和非目标位置的强分类器,筛选级联所有强分类器为Haar分类器。Step S201, apply the AdaBoost algorithm to train the Haar feature of the sample to obtain a strong classifier for distinguishing the target location from the non-target location, and filter and cascade all the strong classifiers into a Haar classifier.

步骤S202,应用所述Haar分类器的Haar特征进行所述目标位置的识别。Step S202, applying the Haar feature of the Haar classifier to identify the target position.

步骤S203,在识别过程中,利用积分图算法对所述Haar分类器的Haar特征的计算进行加速。Step S203, during the recognition process, the integral graph algorithm is used to accelerate the calculation of the Haar features of the Haar classifier.

步骤S201-S203为应用Haar分类器算法对图像进行识别,获取待变色的目标位置的具体步骤。Steps S201-S203 are specific steps for applying the Haar classifier algorithm to identify the image and obtain the position of the target to be discolored.

HAAR特征法是通过使用在各种不同场景等外部条件下得到的局部特征数据样本做培养,得到的相应局部特征的分类器,在进行局部特征检测时,通过在分类器中查找匹配,判断是否为相应的特征,从而实现检测局部特征。整体的操作步骤如下:The HAAR feature method is to use the local feature data samples obtained under various external conditions such as various scenes for training, and obtain the classifier of the corresponding local features. When performing local feature detection, it is judged whether it is For the corresponding features, so as to realize the detection of local features. The overall operation steps are as follows:

Haar分类器=Haar-like特征+积分图方法+AdaBoost+级联。Haar classifier = Haar-like feature + integral graph method + AdaBoost + cascade.

1.Haar-like特征:1. Haar-like features:

将图4中的任意一个矩形放到检测物体的区域上,然后,将白色区域的像素和减去黑色区域的像素和,得到的值我们称之为物体特征值,你把这个矩形放到一个非检测物体区域,那么计算出的特征值应该和物体特征值是不一样的。Put any rectangle in Figure 4 on the detection object area, and then subtract the pixel sum of the black area from the sum of the pixels in the white area, and the obtained value is called the feature value of the object. You put this rectangle in a For non-detected object areas, the calculated eigenvalues should be different from the object eigenvalues.

2.积分图方法:2. Integral map method:

每遇到一个图片样本,每遇到一个子窗口图像,我们都面临着如何计算当前子图像特征值的问题,一个Haar-like特征在一个窗口中怎样排列能够更好的体现检测目标的特征,这是未知的,所以才要训练,而训练之前我们只能通过排列组合穷举所有这样的特征,仅以最基本四个特征为例,在一个24×24size的窗口中任意排列至少可以产生数以10万计的特征,对这些特征求值的计算量是非常大的。而积分图就是只遍历一次图像就可以求出图像中所有区域像素和的快速算法,大大的提高了图像特征值计算的效率。Every time we encounter a picture sample, every time we encounter a sub-window image, we are faced with the problem of how to calculate the feature value of the current sub-image. How to arrange a Haar-like feature in a window can better reflect the characteristics of the detection target. This is unknown, so it is necessary to train. Before training, we can only exhaustively enumerate all such features by permutation and combination. Taking the most basic four features as an example, any arrangement in a 24×24size window can at least generate a number of features. With 100,000 features, the amount of computation to evaluate these features is very large. The integral image is a fast algorithm that can calculate the sum of pixels in all regions in the image by traversing the image only once, which greatly improves the efficiency of image feature value calculation.

其中,步骤S203可包括以下步骤:Wherein, step S203 may include the following steps:

A:计算像素点行方向的累加;A: Calculate the accumulation of pixels in the row direction;

B:逐行扫描所述图像,递归计算每个所述像素点行方向的累加得到积分图像的值;B: scanning the image line by line, recursively calculating the accumulation of each pixel point in the line direction to obtain the value of the integral image;

C:根据所述积分图像的值扫描所述图像构造出积分图像;C: Scanning the image according to the value of the integral image to construct an integral image;

D:通过所述积分图像对所述Haar分类器的Haar特征进行计算。D: Calculate the Haar feature of the Haar classifier through the integral image.

3.AdaBoost:3. AdaBoost:

来确定什么样的矩形特征怎么样的组合到一块可以更好的区分出待检测目标和非目标。To determine what kind of rectangular features and how to combine them together can better distinguish the target to be detected from the non-target.

4.级联:4. Cascading:

就是将Adaboost组成的组合全部级联起来,提高准确率。It is to cascade all the combinations composed of Adaboost to improve the accuracy.

步骤S204,检测识别出的目标位置的RGB值。Step S204, detecting the RGB value of the identified target position.

颜色的变化即是对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的。在变换颜色之前,首先要检测识别出图像的目标位置原来的RGB值。The change of color is the change of the three color channels of red (R), green (G) and blue (B) and their mutual superposition to obtain various colors. Before transforming the color, it is first necessary to detect the original RGB value of the target position of the recognized image.

步骤S205,对所述生成的图像的YUV数据中的目标位置对应的数据的RGB值变换为与预设颜色对应的RGB值,得到变换后的YUV数据。Step S205, converting the RGB value of the data corresponding to the target position in the YUV data of the generated image to the RGB value corresponding to the preset color to obtain the converted YUV data.

步骤S206,根据所述变换后的YUV数据,输出设定格式的图像。Step S206, outputting an image with a set format according to the converted YUV data.

在输出图片或图像之前,照相机的传感器输出的是YUV数据,变换目标位置的RGB值,即是对YUV数据中的目标位置对应的数据的RGB值进行变换。根据想要得到的颜色,进行RGB值的计算,然后对目标位置的RGB值进行变换,即变换得到想要得到的颜色,而对该图像的目标位置之外的RGB值不进行改变,从而实现图像的局部变色。例如,可以将图2中的树变换成各种颜色,而不是图像中原本的绿色,而天空和草地的颜色不改变,用户可以选择保存其中的一张或多张树的颜色不同的照片,增加拍摄的趣味性。在对目标位置的RGB进行变换后,得到变换RGB值后的YUV数据,将YUV数据压成设定格式的图像,输出到相册。Before outputting pictures or images, the sensor of the camera outputs YUV data, and converting the RGB value of the target position is to convert the RGB value of the data corresponding to the target position in the YUV data. Calculate the RGB value according to the desired color, and then transform the RGB value of the target position, that is, transform to obtain the desired color, without changing the RGB value outside the target position of the image, so as to achieve Local discoloration of the image. For example, the tree in Figure 2 can be transformed into various colors instead of the original green in the image, while the colors of the sky and grass do not change, and the user can choose to save one or more photos with different colors of the trees, Increase the fun of shooting. After converting the RGB value of the target position, the YUV data after the RGB value conversion is obtained, and the YUV data is compressed into an image with a set format and output to the photo album.

根据本发明实施例提供的一种实现图像局部变色的方法,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性;采用Haar分类器进行目标位置的识别,筛选式级联方式提高了分类器的准确率,积分图算法的使用加速了算法的速度。According to a method for realizing partial discoloration of an image provided by an embodiment of the present invention, by identifying the target position to be locally discolored in the generated image, and then performing color transformation on the target position, the same target position in the same image can be Different colors are shot to increase the fun of shooting; the Haar classifier is used to identify the target position, the screening cascade method improves the accuracy of the classifier, and the use of the integral map algorithm accelerates the speed of the algorithm.

下面结合图5-图6,对本发明实施例提供的实现图像局部变色的终端进行详细描述:The terminal for realizing partial color change of an image provided by the embodiment of the present invention is described in detail below in conjunction with FIGS. 5-6 :

请参阅图5,为本发明实施例提供的一种终端的结构示意图,该终端1000包括:Please refer to FIG. 5, which is a schematic structural diagram of a terminal provided by an embodiment of the present invention. The terminal 1000 includes:

第一识别单元11,用于识别生成的图像中待局部变色的目标位置。The first identification unit 11 is configured to identify the target position to be partially discolored in the generated image.

本实施例是对生成的图像的局部位置进行变色,关键是第一识别单元11要识别待局部变色的目标位置。如图2示例的待局部变色的图像,要进行局部变色的目标位置或目标物体是这棵树,而天空和草地的颜色都不改变。例如,可以应用Haar分类器算法对图像进行识别,获取待变色的目标位置。In this embodiment, the local position of the generated image is changed in color, and the key point is that the first identification unit 11 should identify the target position to be locally changed in color. For the image to be partially discolored as shown in FIG. 2 , the target position or object to be locally discolored is the tree, and the colors of the sky and the grass do not change. For example, the Haar classifier algorithm can be applied to identify the image to obtain the target position to be discolored.

检测单元12,检测识别出的目标位置的RGB值。The detection unit 12 detects the RGB value of the recognized target position.

颜色的变化即是对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的。在变换颜色之前,检测单元12首先要检测识别出图像的目标位置原来的RGB值。The change of color is the change of the three color channels of red (R), green (G) and blue (B) and their mutual superposition to obtain various colors. Before changing the color, the detection unit 12 first detects the original RGB value of the target position of the recognized image.

第一变换单元13,用于对所述目标位置的RGB值进行变换,得到所述目标位置的颜色变换成预设颜色的图像。The first transformation unit 13 is configured to transform the RGB value of the target position to obtain an image in which the color of the target position is transformed into a preset color.

第一变换单元13根据想要得到的颜色,进行RGB值的计算,然后对目标位置的RGB值进行变换,即变换得到想要得到的颜色,而对该图像的目标位置之外的RGB值不进行改变,从而实现图像的局部变色。例如,可以将图2中的树变换成各种颜色,而不是图像中原本的绿色,而天空和草地的颜色不改变,用户可以选择保存其中的一张或多张树的颜色不同的照片,增加拍摄的趣味性。The first conversion unit 13 calculates the RGB value according to the desired color, and then converts the RGB value of the target position, that is, transforms to obtain the desired color, and the RGB values outside the target position of the image are not Make changes to achieve localized discoloration of the image. For example, the tree in Figure 2 can be transformed into various colors instead of the original green in the image, while the colors of the sky and grass do not change, and the user can choose to save one or more photos with different colors of the trees, Increase the fun of shooting.

根据本发明实施例提供的一种终端,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性。According to a terminal provided by an embodiment of the present invention, by identifying the target position to be partially discolored in the generated image, and then performing color transformation on the target position, the same target position in the same image can be photographed in different colors , to increase the fun of shooting.

请参阅图6,为本发明实施例提供的另一种终端的结构示意图,该终端2000包括:Please refer to FIG. 6, which is a schematic structural diagram of another terminal provided by an embodiment of the present invention. The terminal 2000 includes:

第一识别单元21,用于应用Haar分类器算法对图像进行识别,获取待变色的目标位置。The first identification unit 21 is configured to apply the Haar classifier algorithm to identify the image, and obtain the target position to be discolored.

具体地,第一识别单元21包括Haar分类器训练单元211、第二识别单元212和加速识别单元213。Specifically, the first identification unit 21 includes a Haar classifier training unit 211 , a second identification unit 212 and an acceleration identification unit 213 .

Haar分类器训练单元211,用于应用AdaBoost算法训练样本的Haar特征后得到区分所述目标位置和非目标位置的强分类器,筛选级联所有强分类器为Haar分类器。The Haar classifier training unit 211 is used to apply the AdaBoost algorithm to train the Haar features of the sample to obtain a strong classifier for distinguishing the target position from the non-target position, and filter and cascade all the strong classifiers as Haar classifiers.

第二识别单元212,用于应用所述Haar分类器的Haar特征进行所述目标位置的识别。The second identification unit 212 is configured to apply the Haar feature of the Haar classifier to identify the target position.

加速识别单元213,用于在识别过程中,利用积分图算法对所述Haar分类器的Haar特征的计算进行加速。The accelerated recognition unit 213 is configured to accelerate the calculation of the Haar features of the Haar classifier by using the integral graph algorithm during the recognition process.

HAAR特征法是通过使用在各种不同场景等外部条件下得到的局部特征数据样本做培养,得到的相应局部特征的分类器,在进行局部特征检测时,通过在分类器中查找匹配,判断是否为相应的特征,从而实现检测局部特征。整体的操作如下:The HAAR feature method is to use the local feature data samples obtained under various external conditions such as various scenes for training, and obtain the classifier of the corresponding local features. When performing local feature detection, it is judged whether it is For the corresponding features, so as to realize the detection of local features. The overall operation is as follows:

Haar分类器=Haar-like特征+积分图方法+AdaBoost+级联。Haar classifier = Haar-like feature + integral graph method + AdaBoost + cascade.

1.Haar-like特征:1. Haar-like features:

将图4中的任意一个矩形放到检测物体的区域上,然后,将白色区域的像素和减去黑色区域的像素和,得到的值我们称之为物体特征值,你把这个矩形放到一个非检测物体区域,那么计算出的特征值应该和物体特征值是不一样的。Put any rectangle in Figure 4 on the detection object area, and then subtract the pixel sum of the black area from the sum of the pixels in the white area, and the obtained value is called the feature value of the object. You put this rectangle in a For non-detected object areas, the calculated eigenvalues should be different from the object eigenvalues.

2.积分图方法:2. Integral map method:

每遇到一个图片样本,每遇到一个子窗口图像,我们都面临着如何计算当前子图像特征值的问题,一个Haar-like特征在一个窗口中怎样排列能够更好的体现检测目标的特征,这是未知的,所以才要训练,而训练之前我们只能通过排列组合穷举所有这样的特征,仅以最基本四个特征为例,在一个24×24size的窗口中任意排列至少可以产生数以10万计的特征,对这些特征求值的计算量是非常大的。而积分图就是只遍历一次图像就可以求出图像中所有区域像素和的快速算法,大大的提高了图像特征值计算的效率。Every time we encounter a picture sample, every time we encounter a sub-window image, we are faced with the problem of how to calculate the feature value of the current sub-image. How to arrange a Haar-like feature in a window can better reflect the characteristics of the detection target. This is unknown, so it is necessary to train. Before training, we can only exhaustively enumerate all such features by permutation and combination. Taking the most basic four features as an example, any arrangement in a 24×24size window can at least generate a number of features. With 100,000 features, the amount of computation to evaluate these features is very large. The integral image is a fast algorithm that can calculate the sum of pixels in all regions in the image by traversing the image only once, which greatly improves the efficiency of image feature value calculation.

其中,加速识别单元213可包括第一计算单元、第二计算单元、积分图像构造单元和第三计算单元。其中:Wherein, the acceleration identification unit 213 may include a first calculation unit, a second calculation unit, an integral image construction unit and a third calculation unit. in:

第一计算单元:用于计算像素点行方向的累加;The first calculation unit: used to calculate the accumulation of pixel points in the row direction;

第二计算单元:用于逐行扫描所述图像,递归计算每个所述像素点行方向的累加得到积分图像的值;The second calculation unit: used to scan the image row by row, and recursively calculate the accumulation of each pixel in the row direction to obtain the value of the integral image;

积分图像构造单元,用于根据所述积分图像的值扫描所述图像构造出积分图像;an integral image construction unit, configured to scan the image according to the value of the integral image to construct an integral image;

第三计算单元,用于通过所述积分图像对所述Haar分类器的Haar特征进行计算。A third calculation unit, configured to calculate the Haar feature of the Haar classifier through the integral image.

3.AdaBoost:3. AdaBoost:

来确定什么样的矩形特征怎么样的组合到一块可以更好的区分出待检测目标和非目标。To determine what kind of rectangular features and how to combine them together can better distinguish the target to be detected from the non-target.

4.级联:4. Cascading:

就是将Adaboost组成的组合全部级联起来,提高准确率。It is to cascade all the combinations composed of Adaboost to improve the accuracy.

检测单元22,用于检测识别出的目标位置的RGB值。The detection unit 22 is configured to detect the RGB value of the recognized target position.

颜色的变化即是对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的。在变换颜色之前,首先要检测识别出图像的目标位置原来的RGB值。The change of color is the change of the three color channels of red (R), green (G) and blue (B) and their mutual superposition to obtain various colors. Before transforming the color, it is first necessary to detect the original RGB value of the target position of the recognized image.

第一变换单元23,用于对所述目标位置的RGB值进行变换,得到所述目标位置的颜色变换成预设颜色的图像。The first transformation unit 23 is configured to transform the RGB value of the target position to obtain an image in which the color of the target position is transformed into a preset color.

在本实施例中,第一变换单元23包括第二变换单元231和输出单元232。In this embodiment, the first transformation unit 23 includes a second transformation unit 231 and an output unit 232 .

第二变换单元231,用于对所述生成的图像的YUV数据中的目标位置对应的数据的RGB值变换为与预设颜色对应的RGB值,得到变换后的YUV数据。The second conversion unit 231 is configured to convert the RGB value of the data corresponding to the target position in the YUV data of the generated image into the RGB value corresponding to the preset color, and obtain the converted YUV data.

输出单元232,用于根据所述变换后的YUV数据,输出设定格式的图像。The output unit 232 is configured to output an image in a set format according to the converted YUV data.

在输出图片或图像之前,照相机的传感器输出的是YUV数据,变换目标位置的RGB值,即是对YUV数据中的目标位置对应的数据的RGB值进行变换。根据想要得到的颜色,进行RGB值的计算,然后对目标位置的RGB值进行变换,即变换得到想要得到的颜色,而对该图像的目标位置之外的RGB值不进行改变,从而实现图像的局部变色。例如,可以将图2中的树变换成各种颜色,而不是图像中原本的绿色,而天空和草地的颜色不改变,用户可以选择保存其中的一张或多张树的颜色不同的照片,增加拍摄的趣味性。在对目标位置的RGB进行变换后,得到变换RGB值后的YUV数据,将YUV数据压成设定格式的图像,输出到相册。Before outputting pictures or images, the sensor of the camera outputs YUV data, and converting the RGB value of the target position is to convert the RGB value of the data corresponding to the target position in the YUV data. Calculate the RGB value according to the desired color, and then transform the RGB value of the target position, that is, transform to obtain the desired color, without changing the RGB value outside the target position of the image, so as to achieve Local discoloration of the image. For example, the tree in Figure 2 can be transformed into various colors instead of the original green in the image, while the colors of the sky and grass do not change, and the user can choose to save one or more photos with different colors of the trees, Increase the fun of shooting. After converting the RGB of the target position, the YUV data after the RGB value conversion is obtained, and the YUV data is compressed into an image with a set format and output to the photo album.

根据本发明实施例提供的一种终端,通过识别生成的图像中待局部变色的目标位置,然后对该目标位置进行颜色变换,可以使同一张图像中的同一个目标位置可以拍出不同的颜色,增加拍摄的趣味性;采用Haar分类器进行目标位置的识别,筛选式级联方式提高了分类器的准确率,积分图算法的使用加速了算法的速度。According to a terminal provided by an embodiment of the present invention, by identifying the target position to be partially discolored in the generated image, and then performing color transformation on the target position, the same target position in the same image can be photographed in different colors , to increase the fun of shooting; the Haar classifier is used to identify the target position, the screening cascade method improves the accuracy of the classifier, and the use of the integral map algorithm accelerates the speed of the algorithm.

需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为根据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. Because according to the present invention, certain steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本发明可以用硬件实现,或固件实现,或它们的组合方式来实现。当使用软件实现时,可以将上述功能存储在计算机可读介质中或作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是计算机能够存取的任何可用介质。以此为例但不限于:计算机可读介质可以包括随机存取存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、电可擦可编程只读存储器(ElectricallyErasableProgrammable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-OnlyMemory,CD-ROM)或其他光盘存储、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质。此外。任何连接可以适当的成为计算机可读介质。例如,如果软件是使用同轴电缆、光纤光缆、双绞线、数字用户线(Digital SubscriberLine,DSL)或者诸如红外线、无线电和微波之类的无线技术从网站、服务器或者其他远程源传输的,那么同轴电缆、光纤光缆、双绞线、DSL或者诸如红外线、无线和微波之类的无线技术包括在所属介质的定影中。如本发明所使用的,盘(Disk)和碟(disc)包括压缩光碟(CD)、激光碟、光碟、数字通用光碟(DVD)、软盘和蓝光光碟,其中盘通常磁性的复制数据,而碟则用激光来光学的复制数据。上面的组合也应当包括在计算机可读介质的保护范围之内。Through the above description of the implementation manners, those skilled in the art can clearly understand that the present invention can be implemented by hardware, firmware, or a combination thereof. When implemented in software, the functions described above may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a computer. Take this as an example but not limited to: computer-readable media may include Random Access Memory (Random Access Memory, RAM), Read-Only Memory (Read-Only Memory, ROM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory) Only Memory, EEPROM), CD-ROM (Compact Disc Read-OnlyMemory, CD-ROM) or other optical disk storage, magnetic disk storage medium or other magnetic storage devices, or can be used to carry or store desired information in the form of instructions or data structures program code and any other medium that can be accessed by a computer. also. Any connection can suitably be a computer-readable medium. For example, if the Software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair wire, Digital Subscriber Line (DSL), or wireless technology such as infrared, radio, and microwave, then Coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, wireless, and microwave are included in the fixation of the respective media. As used herein, Disk and disc include compact disc (CD), laser disc, compact disc, digital versatile disc (DVD), floppy disc, and Blu-ray disc, where discs usually reproduce data magnetically, and discs Lasers are used to optically reproduce the data. Combinations of the above should also be included within the scope of computer-readable media.

总之,以上所述仅为本发明技术方案的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。In a word, the above descriptions are only preferred embodiments of the technical solutions of the present invention, and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims (2)

CN201510200800.2A2015-04-242015-04-24A kind of method and terminal for realizing image local discolorationExpired - Fee RelatedCN104851114B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201510200800.2ACN104851114B (en)2015-04-242015-04-24A kind of method and terminal for realizing image local discoloration

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201510200800.2ACN104851114B (en)2015-04-242015-04-24A kind of method and terminal for realizing image local discoloration

Publications (2)

Publication NumberPublication Date
CN104851114A CN104851114A (en)2015-08-19
CN104851114Btrue CN104851114B (en)2018-05-01

Family

ID=53850741

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201510200800.2AExpired - Fee RelatedCN104851114B (en)2015-04-242015-04-24A kind of method and terminal for realizing image local discoloration

Country Status (1)

CountryLink
CN (1)CN104851114B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105488819B (en)*2015-12-042018-09-18小米科技有限责任公司Generation method, image processing method and the device of color template
CN106642003B (en)*2016-11-152019-04-12广州视源电子科技股份有限公司Method for automatically changing color of jewelry and jewelry
CN109166162A (en)*2018-10-082019-01-08苏州仙峰网络科技股份有限公司2D color changing method based on fixed form and aspect

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1181569A (en)*1996-10-081998-05-13夏普公司INformation processing apparatus
EP0852041A1 (en)*1995-09-141998-07-08Bently Mills, Inc.Method and systems for manipulation of images of floor coverings or other fabrics
CN101043578A (en)*2006-03-212007-09-26晨星半导体股份有限公司 Hue Adjustment System and Adjustment Method
CN102567974A (en)*2010-12-162012-07-11方正国际软件(北京)有限公司Method and system for adjusting local color of image
CN104519238A (en)*2013-09-262015-04-15天津书生软件技术有限公司Color correction method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP0852041A1 (en)*1995-09-141998-07-08Bently Mills, Inc.Method and systems for manipulation of images of floor coverings or other fabrics
CN1181569A (en)*1996-10-081998-05-13夏普公司INformation processing apparatus
CN101043578A (en)*2006-03-212007-09-26晨星半导体股份有限公司 Hue Adjustment System and Adjustment Method
CN102567974A (en)*2010-12-162012-07-11方正国际软件(北京)有限公司Method and system for adjusting local color of image
CN104519238A (en)*2013-09-262015-04-15天津书生软件技术有限公司Color correction method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
基于Adaboost算法的人脸检测分类器的设计与实现;兰胜坤;《电脑知识与技术》;20101105;第6卷(第31期);8828-8830*
基于类Haar特征与级联AdaBoost算法的防震锤识别;金立军 等;《系统仿真学报》;20120815;第24卷(第9期);1806-1809*
数码影像技术操作篇之六十三 图像色彩调整的基本方法(上);齐欣;《照相机》;20090301(第3期);60-63*

Also Published As

Publication numberPublication date
CN104851114A (en)2015-08-19

Similar Documents

PublicationPublication DateTitle
CN113012081B (en) Image processing method, device and electronic system
CN107424123B (en)Moire pattern removing method and device
CN107204034B (en)A kind of image processing method and terminal
JP7063039B2 (en) Target detection method, target detection device and image processing device
CN112348778A (en)Object identification method and device, terminal equipment and storage medium
CN110263621B (en)Image recognition method and device and readable storage medium
CN111275645A (en) Image defogging method, device, equipment and storage medium based on artificial intelligence
WO2013145295A1 (en)Color chart detection device, color chart detection method and color chart detection computer program
WO2019210707A1 (en)Image sharpness evaluation method, device and electronic device
CN111080683B (en)Image processing method, device, storage medium and electronic equipment
CN113658118B (en) Image noise level estimation method, device, electronic device and storage medium
CN116188808B (en)Image feature extraction method and system, storage medium and electronic device
CN112883762A (en)Living body detection method, device, system and storage medium
CN111311500A (en) A method and device for color restoration of an image
CN104851114B (en)A kind of method and terminal for realizing image local discoloration
CN118575484A (en)Multi-sensor imaging color correction
CN117094986A (en)Self-adaptive defect detection method based on small sample and terminal equipment
US12354248B2 (en)Image processing method and apparatus, model training method and apparatus, and storage medium
CN114881886A (en)Image processing method, image processing device, electronic equipment and storage medium
WO2025073268A1 (en)Digital watermark extraction method and apparatus, and electronic device and storage medium
CN111242087B (en)Object identification method and device
US20140307116A1 (en)Method and system for managing video recording and/or picture taking in a restricted environment
CN108805883A (en)Image segmentation method, image segmentation device and electronic equipment
CN108475338B (en) Panoramic image, video recognition method, classifier establishment method and electronic device
CN109977734B (en) Image processing method and device

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
EXSBDecision made by sipo to initiate substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CP01Change in the name or title of a patent holder

Address after:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CP01Change in the name or title of a patent holder
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20180501

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp