Comparing images of the same on MATLAB and selecting particular features.

T
teamp_we · May 20, 2021 · 1.9K views
Question
How do I match multiple coloured images to other images of the same but that is in black and white and eliminate everything that matches with the black part and keep only the parts of the image that match with the white on MATLAB as part of a CNN?  
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 12, 2026
As per my understanding, you have an image that has only black and white colors. You have other colored images, from which you would like to remove parts, where the corresponding pixel in the b/w image is black.
 
Depending on your use case, you could load the images as matrices. Then create a binary mask based on b/w image, as follows
 
bwimage = imread(image_path)
flag = [bwimage == value] % where value is value of white
colorimage(flag) = 0 % or another appropriate value
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!