how can we change particular part of binary image which is in white color to black color
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Walter Roberson
2017-3-30
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 个评论
Image Analyst
2017-4-7
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 个评论
Walter Roberson
2017-4-7
The tree shadow appears to have a larger area than the patches. You could do a bwareafilt()
Image Analyst
2017-4-8
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!