Only 8-bit (or 16-bit unsigned) single-channel or 3-channel images can be saved by imwrite.

matlab,image-processing,geometry,pixel,binary-image

Matlab is great for working with images thanks to the matrix syntax. It does also work with indices so most time you can avoid "iterating through pixels" (although sometimes you'll still have to). Instead of checking all the pixels within each circle, and having to detect how many pixels were...

python,image-processing,lookup-tables,binary-image

The filters defined in scipy.ndimage may be of use to you. If none of the pre-defined filters match your intent, you can apply a custom filter using scipy.ndimage.generic_filter. For example, you can reproduce the result shown on the Mathworks applylut doc page with: import numpy as np import scipy.ndimage as...

matlab,matrix,binary,binary-matrix,binary-image

Here is one alternative without bin2dec or dec2bin conversion out = arrayfun(@(x,y) strcat(num2str(x),num2str(y)),A1,A2,'Uni',0); Input: A1 = [1 0 0; 0 1 1; 1 0 1]; A2 = [0 1 0; 1 1 0; 0 0 1]; output: >> out out = '10' '01' '00' '01' '11' '10' '10' '00' '11'...