node.js - Converting an image to rows of grayscale pixel values -


i'd use node indico api. need convert image grayscale , arrays containing arrays/rows of pixel values. start?

these tools take specific format images, list of lists, each sub-list containing 'row' of values corresponding n pixels in image.

e.g. [[float, float, float ... *n ], [float, float, float ... *n ], ... *n] 

since pixels tend represented rgba values, can use following formula convert grayscale.

y = (0.2126 * r + 0.7152 * g + 0.0722 * b) * 

we're working on automatically scaling images, moment it's provide square image

it looks node's image manipulation tools sadly little lacking, there solution.

get-pixels allows reading in images either url or local path , convert ndarray should work excellently api.

the api accept rgb images in format get-pixels produces them, if you're still interested in converting images grayscale, can helpful other applications it's little strange.

in standard rgb image there's luminence score given each color, how bright color appears. based on luminance, conversion grayscale each pixel happens follows:

grayscale = 0.2126*r + 0.7152*g + 0.0722*b 

soon api support direct use of urls, stay tuned on front.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -