MATLAB Answers

How to binarize this image with removing some noises with smooth surface and getting red laser line in the binary image

1 ビュー (過去 30 日間)
Prashant
Prashant 2020 年 8 月 19 日
回答済み: jonas 2020 年 8 月 19 日
Hello
here is my image and i want to binarize the image but i need also red line called laser in the image in the form of binary, which is important for me. i did binarize my image but i did not get beeter output. also i want to remove blue fringes in my image upto black mark.
if anyone know then try to figure this out.
I have also written my code and i attched as Three_plane.m

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

jonas
jonas 2020 年 8 月 19 日
I had some difficulty obtaining a solid black line by thresholding only. Since its a simple straight line, you could try something like this:
RGB = imread('image.png');
[R,G,B] = imsplit(RGB);
%threshold to get some points along line + some noise
BW = (R > 100) & (G < 100) & (B < 100);
%remove noise
BW = bwareaopen(BW,5);
%find line indices
[y,x] = find(BW == true);
%fit line
xv = 1:size(BW,2);
ft = polyfit(x,y,1)
yv = polyval(ft,xv)
figure;
imshow(BW);hold on
plot(xv,yv,'r')
You could then use insertShape (CV toolbox) to "paint" the line coordinates into the image, if needed.

  0 件のコメント

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by