Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lab_rule_1 = L >= L_mean
- lab_rule_2 = a >= a_mean
- lab_rule_3 = b >= b_mean
- lab_rule_4 = b >= a_mean
- lab_satisfied = lab_rule_1 & lab_rule_2 & lab_rule_3 & lab_rule_4
- rgb_rule_1 = (R > G) & (G > B) # No chaining in numpy
- rgb_rule_2 = R >= R_mean
- rgb_satisfied = rgb_rule_1 & rgb_rule_2
- ycbcr_rule_1 = (R >= G) & (G > B)
- ycbcr_rule_2 = (R > 190) & (G > 100) & (B < 140)
- ycbcr_rule_3 = Y >= Cb
- ycbcr_rule_4 = Cr >= Cb
- ycbcr_satisfied = (ycbcr_rule_1 & ycbcr_rule_2) | (ycbcr_rule_3 & ycbcr_rule_4)
- lab_convert = np.uint8(lab_satisfied) * 255
- rgb_convert = np.uint8(rgb_satisfied) * 255
- ycbcr_convert = np.uint8(ycbcr_satisfied) * 255
- combined = lab_convert | rgb_convert | ycbcr_convert
- frame_copy = np.repeat(combined[:, :, np.newaxis], 3, axis=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement