rgbImage=imread('C:\Users\KeerthiDev\Desktop\tomato_dataset\Tomato_late_blight_water_mold\late130.jpg');%figure,imshow(rgbImage, []);
rgbImage = imadjust(rgbImage,stretchlim(rgbImage),[]);rgbImage = imreducehaze(rgbImage);figure,imshow(rgbImage);grayImage = rgb2gray(rgbImage);figure,imshow(grayImage, []);hFH = imfreehand();binaryImage = hFH.createMask();xy = hFH.getPosition;blackMaskedImage = grayImage;blackMaskedImage(~binaryImage) = 0;maskedRgbImage = bsxfun(@times,rgbImage,cast(binaryImage, 'like',rgbImage));figure,imshow(maskedRgbImage);
after runing this code to i got the image as shown below
I want to only change this black background to white color (without any other change.)
Best Answer