2

I am new to opencv and I have a data array for a binary image, like [1,0,0,1,1,0,0,1...]. My goal is to read it in opencv and manipulate it with opencv functions, so how to create a binary image from raw data array with opencv?

1

1 Answer 1

4

you can easily create a Mat from that data :

unsigned char bits[] = {1,0,0,1,1,0,0,1,1};
Mat m( 3,3, CV_8UC1, bits );

if your bits were an int[] you'd have to use CV_32SC1.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.