How to convert black and white image to a matrix 100 x 100 ?

Dear all, I have a black and white image that I want to read it as a matrix of size 100 x 100, I need the elements of the matrix to be 1 for black pixels and -1 for the white pixels, could any one help me in how to have the size of the matrix to be 100 x 100 and its elements 1 and -1? thank you

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2015년 10월 16일
c = [1 0 0 1 1 1 0 1 0 0]
out = ~c*2-1

댓글 수: 1

sali
sali 2015년 10월 16일
편집: Andrei Bobrov 2015년 10월 17일
Thanks Andrei for your answer, I could use this after reading the image and convert it to 100x 100 matrix which I did not yet figure it out!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2015년 10월 16일

편집:

2015년 10월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by