I want to get a simple python list from the pixel colors from an image the output list should be monodimensional ordered as:
output = [B1,G1,R1,B2,G2,R2,B3,G3,R3....]
to get the image data:
import cv2
image = cv2.imread('a.png')
image
array([[[ 0, 0, 255],
[ 0, 0, 255],
[ 0, 0, 255]],
[[ 0, 255, 0],
[ 0, 255, 0],
[ 0, 255, 0]],
[[255, 0, 0],
[255, 0, 0],
[255, 0, 0]]], dtype=uint8)
f = image.flatten()
f
[array([ 0, 0, 255, 0, 0, 255, 0, 0, 255, 0, 255, 0, 0,
255, 0, 0, 255, 0, 255, 0, 0, 255, 0, 0, 255, 0,
0], dtype=uint8)]
is there a way to get:
f = [0,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,0]