Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Image analysis Part 1
- function [board] = AnalyzeScreenshotFunction()
- clc; clear;
- % Read in image file
- pixels = imread('Screenshot_Alpha.png');
- [height, width, colors] = size(pixels);
- % Initilize empty board
- board = zeros(4, 4);
- binaryIm = false(height, width);
- % Read through pixels
- for row = 1:1:height
- for col = 1:1:width
- r = pixels(row, col, 1);
- g = pixels(row, col, 2);
- b = pixels(row, col, 3);
- value = GetTileColor(r, g, b);
- if (value > -1)
- binaryIm(row, col) = 1;
- end
- end
- end
- %imshow(pixels);
- imshow(binaryIm);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement