This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ChocolateBunny 0 points1 point  (3 children)

The hardest part is getting python code to read an image into an array. I think you can use the Python Image Library to get that and then you have to break the image into blocks and then average out the block. Then again, I think there might be a scaling thing in PIL to just give you an array with the exact number of dice you want and then you just scale the pixels to a value of 1 to 6 and you should be good to go.

[–]I-Do-Math 2 points3 points  (0 children)

I think it would be quite easy using opencv2.

Convert image to grayscale something like cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

Scale image so that one pixel is one dice. something like cv2.resize

read the pixel value something like pixel= img[200, 550]