Azzera filtri
Azzera filtri

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 visualizzazione (ultimi 30 giorni)
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 Commenti
Sarah Nasra
Sarah Nasra il 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");

Accedi per commentare.

Risposte (1)

yanqi liu
yanqi liu il 6 Nov 2021
Modificato: yanqi liu il 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

Categorie

Scopri di più su Images in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by