How to obtain threshold image separating two colors using same approach for all different kind of attached images.
조회 수: 5 (최근 30일)
이전 댓글 표시
I am working on an industrial project where my task is to automatically generate two paths that can connect the conduction wire from left to right sides as shown in attached Figure 1. I have successsfuly achieved the target and obtained the lines automatically. But I want to run my code on all images. So, I got stuck on one part to make it applicable on all images without manually changing any input values.
I want to separte two colors (as shown in cropped figures). I have automatically generated cropped images so that i will be left with only two colors to separte. And I can separte these two colors using RGB based thresholding, HSV segmentation, LAB, color difference, otsu method, thresholding based approaches. In the below mentioned code I have done RGB based thresholding to obtain the threshold image. But the problem I am facing is that I need to threshold all images using same approach and same value. And these approaches gives desired result only by changing different values for different images. And I am having sround 1000s of images.
As I can observe and checked that background (Brown in color) is having different values than green part. But I am not able to remove that part and only extract green boundaries. As I am learning Matlab programming step by step. So, I am not able to achieve this task. I have attached few original and cropped images for your reference.
Can anyone please help me to achieve my task. As I am not able to think any of the methods and got badly stuck in this part and rest is all done.
Thank you for your time and support!!
OriginalPicture = imread('D:\test\14H17\18.jpg'); %input image
CroppedPicture=imreda('cropped')% Input cropped picture with only two colors
binaryImage = R > 130 & R < 150 & G > 150 & G < 180 & B > 110 & B < 150; % seprate gray color from green to get boundaries
댓글 수: 2
Image Analyst
2021년 7월 7일
"I have automatically generated cropped images so that i will be left with only two colors to separte." How is that true? From what I see in the tiny little sub images, there are more than 2 colors. Why do you say that you generated cropped images with only 2 colors?
답변 (1개)
kanika bhalla
2021년 7월 7일
편집: kanika bhalla
2021년 7월 8일
댓글 수: 12
Doug Hull
2021년 7월 8일
OK, I have a much clearer idea what you are trying to do.
>>With the help of great people present here in forum. I have already achieved my task.
And with this it looks like you have done this.
What is unclear to me now, is where are the images where this is going wrong?
You are using terminology like "green glass" many if us are not subjuect matter experts in your field. So, this does not mean anything to me.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!