Effacer les filtres
Effacer les filtres

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 vue (au cours des 30 derniers jours)
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 commentaires
Sarah Nasra
Sarah Nasra le 5 Nov 2021
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");

Connectez-vous pour commenter.

Réponses (1)

yanqi liu
yanqi liu le 6 Nov 2021
Modifié(e) : yanqi liu le 6 Nov 2021
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

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by