MATLAB Answers


How to convert two rgb images into grayscale? and then subtract ?

Asked by swati mane on 18 Mar 2019
Latest activity Commented on by swati mane on 19 Mar 2019
Accepted Answer by Jan
I have two images in jpg format(one as reference image and other is captured image) . I want to convert them to grayscale and want to subtract them. How to do this?
Thanks in Advance.


@swati mane: Does this comment concern my answer? Is your problem solved?
Hello sir,
My problem resolved. thank you!!!

Sign in to comment.

1 Answer

Answer by Jan
on 18 Mar 2019
 Accepted Answer

img1 = imread('Image1.jpg');
img2 = imread('Image2.jpg');
D = rgb2gray(img1) - rgb2gray(img2)


Sign in to comment.