필터 지우기
필터 지우기

i have a "tif" image and i want to label it, i wrote a code but i cant reach what i need!!! i still have a noisy pic? can u help me get rid of this noice?

조회 수: 1 (최근 30일)
my code:
A = imread("ניסוי1 חתוך.tif","tif");
A=rgb2gray(A);
t = graythresh(A);
BW1 = imbinarize(A,t);
BW2 = bwareaopen(BW1,50);
BW3 = medfilt2(BW2);
figure; imshow(BW3); title("after");
I enclose my picture in the ZIP file and what I get after activating the code.
my question is how can i get rid of this noise and get a pic like "wanted pic" that appears in the ZIP file??
  댓글 수: 3
Sarah Nasra
Sarah Nasra 2021년 11월 5일
just one more question!!
i want to fill the cells so i used the function "imfill" but because the borders of the cells not completed 100%, not all the cells filled.
how can i do that?
A = imread("ניסוי1 חתוך.tif","tif");
A=rgb2gray(A);
t = 0.64;
BW1 = imbinarize(A,t);
BW2 = bwareaopen(BW1,50);
BW3 = medfilt2(BW2);
BW4 = imfill(BW3,'holes');
figure; imshow(BW4); title("after");

댓글을 달려면 로그인하십시오.

답변 (1개)

yanqi liu
yanqi liu 2021년 11월 6일
편집: yanqi liu 2021년 11월 6일
the image process as follows, the hard point is that segment
clc; clear all; close all;
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/791449/t.jpg');
jmg = rgb2lab(img);
jm = mat2gray(jmg(:,:,1));
bc = edge(jm, 'canny');
be = edge(jm, 'sobel');
be = bwareaopen(imfill(imclose(be, strel('disk', 5)), 'holes'),500);
bt = imerode(imopen(be, strel('disk', 30)), strel('disk', 10));
jm = mat2gray(jm .* double(bt));
bs = imbinarize(jm, 'adaptive');
figure; imshow(bs, []);
bs = imopen(bs, strel('line', 25, 0));
bs = bwareaopen(bs, 500);
[L,num] = bwlabel(bs);
stats = regionprops(L);
figure; imshow(bs, []);
figure; imshow(img, [])
hold on;
for i = 1 : num
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'r', 'LineWidth', 2)
end

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by