PART 1
Use this - count_edge_pixels = nnz(bw)
This is a very efficient way to calculate true (1) values that are edge pixels in this case and thus, would give you count of edge/white pixels as calculated from edge.
PART 2
You can use edge
on each of Y, Cb, Cr separately or just use Y for edge detection on the luminance part. Use this to get YCbCr from RGB images.
Let's suppose you would like to get edge information on the luminance map of the image, do something like this -
YCBCR = rgb2ycbcr(imread('replay1.jpg'));
luminance_map = YCBCR(:,:,1);
bw = edge(luminance_map,'canny');
Hope this makes sense and works for you!