From: PinkLab on 8 Apr 2010 04:05 I am trying to convert the color image into black and white without using the rgb2gray function. i understand the grayscale image M pixels tall and N pixels wide is represented as a matrix of double datatype of size M×N and denote the pixel grayscale intensities in [0,1] with 0=black and 1=white but not sure how to implement this after reading my image I = imread('image.jpg'); please help
From: Oliver Woodford on 8 Apr 2010 05:34 "PinkLab " wrote: > I am trying to convert the color image into black and white without using the rgb2gray function. > > i understand the grayscale image M pixels tall and N pixels wide is represented as a matrix of double datatype of size M×N and denote the pixel grayscale intensities in [0,1] with 0=black and 1=white > > but not sure how to implement this after reading my image > > I = imread('image.jpg'); > > please help function B = rgb2gray(A) [h w c] = size(A); if c ~= 3 error('RGB image expected'); end if ~isfloat(A) A = double(A) / 255; end B = reshape(reshape(A, h*w, c) * [0.299; 0.587; 0.114], h, w);
|
Pages: 1 Prev: xpc target for pc104: specific setup? Next: problem with fmincon |