Binary image type in C -
if want create , work on binary image in c, data type should set image pixels? since binary image pixel has 2 values assuming need 1 bit each pixel , have use bit wise c functions, correct (most efficient) way binary image processing in c?
if case, how can allocate space image? malloc
allocates space in units of bytes if not mistaking.
for clarification: have 32bit float image (with known size), apply threshold , save thresholding result binary can label separate components.
using single bit per pixel memory-efficient least time-efficient, since accessing pixels requires bitwise operations. if wanted this, have malloc((numpixels + 7)/8)
, i.e. round allocation size nearest byte.
it better balance of memory , space considerations store image char
s. internal representation thresholded images in opencv, example.
Comments
Post a Comment