how can we change particular part of binary image which is in white color to black color
1 view (last 30 days)
Show older comments
After converting the gray image to binary, How can we supervise a part of image which is in white to black color
I have attached image which is a binary image. I want to supervise the highlighted part image which is in red to the green line. I want to supervise by changing white color to black.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162378/image.jpeg)
0 Comments
Answers (2)
Walter Roberson
on 30 Mar 2017
If you have an ROI mask, then
newImage = oldImage;
newImage(ROI) = ~newImage(ROI); %if you want to change white to black and black to white
newImage(ROI) = 0; %if you want to change everything in the ROI to black
0 Comments
Image Analyst
on 7 Apr 2017
I don't know what this means: " which is in red to the green line." There is a green line, but there is red all around it, so which white pixels do you want to turn black? Regardless, once you turn those black, then EVERYTHING will be black. So to do that you simply do:
binaryImage(rectangleMask) = false;
3 Comments
Walter Roberson
on 7 Apr 2017
The tree shadow appears to have a larger area than the patches. You could do a bwareafilt()
Image Analyst
on 8 Apr 2017
Your segmentation algorithm leading to binarization is not good. Also, I don't think your image capture method is good either. The roadway/asphalt crack detection methods I have seem drive a truck over the pavement and look straight down, not way off into the distance like you're doing. Realize that will never reliably find cracks in the roadway 10 to 50 meters ahead.
Look into publications by Professor Bugao Xu at the University of Texas, who has done work on this. Also you can search VisionBibliography to find papers on the topic: http://www.visionbib.com/bibliography/contents.html I'd advise you to do that because trying to find cracks like you're doing now is doomed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!