Python cv2.COLOR_BGR2LUV Examples
The following are 2
code examples of cv2.COLOR_BGR2LUV().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cv2
, or try the search function
.
Example #1
Source File: neural_style.py From neural-style-tf with GNU General Public License v3.0 | 7 votes |
def convert_to_original_colors(content_img, stylized_img): content_img = postprocess(content_img) stylized_img = postprocess(stylized_img) if args.color_convert_type == 'yuv': cvt_type = cv2.COLOR_BGR2YUV inv_cvt_type = cv2.COLOR_YUV2BGR elif args.color_convert_type == 'ycrcb': cvt_type = cv2.COLOR_BGR2YCR_CB inv_cvt_type = cv2.COLOR_YCR_CB2BGR elif args.color_convert_type == 'luv': cvt_type = cv2.COLOR_BGR2LUV inv_cvt_type = cv2.COLOR_LUV2BGR elif args.color_convert_type == 'lab': cvt_type = cv2.COLOR_BGR2LAB inv_cvt_type = cv2.COLOR_LAB2BGR content_cvt = cv2.cvtColor(content_img, cvt_type) stylized_cvt = cv2.cvtColor(stylized_img, cvt_type) c1, _, _ = cv2.split(stylized_cvt) _, c2, c3 = cv2.split(content_cvt) merged = cv2.merge((c1, c2, c3)) dst = cv2.cvtColor(merged, inv_cvt_type).astype(np.float32) dst = preprocess(dst) return dst
Example #2
Source File: liveness.py From libfaceid with MIT License | 5 votes |
def get_embeddings(self, frame, face): (x, y, w, h) = face img = frame[y:y+h, x:x+w] img_ycrcb = cv2.cvtColor(img, cv2.COLOR_BGR2YCR_CB) img_luv = cv2.cvtColor(img, cv2.COLOR_BGR2LUV) hist_ycrcb = self.calc_hist(img_ycrcb) hist_luv = self.calc_hist(img_luv) feature_vector = np.append(hist_ycrcb.ravel(), hist_luv.ravel()) return feature_vector.reshape(1, len(feature_vector)) # private function