hello i have the following code that i saw in an example i tried to understand it and apply it to my code but i don't find a solution to my issue if someone can help thanks i want to have the washer at the end
%% image processing detection
clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool.
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.
%% read an image
I = im2double(imread('washer.png'));
subplot(3,3,1)
imshow(I);
title('Original Image');
%% Step 2: Detect Entire washer
[~,threshold] = edge(I,'sobel');
fudgeFactor = 0.7;
BWs = edge(I,'sobel',threshold * fudgeFactor);
% Display the resulting binary gradient mask.
subplot(3,3,2)
imshow(BWs);
title('Binary Gradient Mask');
%% Step 3: Dilate the Image
se90 = strel('line',3,90);
se0 = strel('line',3,0);
% Display the resulting dilated gradient mask.
BWsdil = imdilate(BWs,[se90 se0]);
subplot(3,3,3)
imshow(BWsdil)
title('Dilated Gradient Mask')
%% Step 4: Fill Interior Gaps
BWdfill = imfill(BWsdil,'holes');
subplot(3,3,4)
imshow(BWdfill)
title('Binary Image with Filled Holes')
%% Step 5: Remove Connected Objects on Border
BWnobord = imclearborder(BWdfill,4);
subplot(3,3,5)
imshow(BWnobord)
title('Cleared Border Image')
%% Step 6: Smooth the Object
seD = strel('disk',1);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);
subplot(3,3,6)
imshow(BWfinal)
title('Segmented Image');
%% Step 7: Visualize the Segmentation
subplot(3,3,7)
imshow(labeloverlay(I,BWfinal))
title('Mask Over Original Image')

댓글 수: 8

Image Analyst
Image Analyst 2020년 4월 21일
You forgot to attach 'washer.png', and you forgot to say why that code is not a solution for you. Please read this link.
BERG
BERG 2020년 4월 21일
Thanks for the reply it's a solution but not the whole solution i have a picture of the object i want to recognize but not all of it just a part of it and i tried to adjust it but i didn't find a good answer i'll post the picture i have as an answer i attached the final image and the original
Image Analyst
Image Analyst 2020년 4월 21일
It looks like that is the roadway under a wheeled vehicle. What is your definition of what kind of objects you want to find? Bright things?
BERG
BERG 2020년 4월 21일
yes in the final image I sent you this is the object I would like to have at the end not brights objects. I would like to write a program that recognizes the objects I will send images of several objects to identify so that you can see a little bit the difference for example. here is my goal: an Automated object recognition within thermographic images for process monitoring of CFRP lay-up processes i have differents images and i want to recognise the objects in this different images (the image file that i sent )
Image Analyst
Image Analyst 2020년 4월 21일
So you want things that are unusual in an otherwise-uniform-ish image? Try running stdfilt() on it. That will highlight things that very a lot within the window.
BERG
BERG 2020년 4월 21일
yes ok i will try it
Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 4월 26일
Hello BERG,
Are you expecting something like this?
BERG
BERG 2020년 4월 28일
Hello thanks it's something like that can i know How you have done it ? I tried to have the same Image but it has not worked

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

 채택된 답변

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 4월 28일

0 개 추천

Hello BERG,
here is code, you code only bit modified .
Use the attached 'mask.bmp' image.
clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool.
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.
%% read an image
imgOrg = im2double(imread('Tow.png'));
figure, imshow(imgOrg);
title('Original Image');
% ROI Region to avoid unwanted disturbance [170, 145, 300, 235]
imgCrop = imcrop(imgOrg, [170, 145, 300, 235]);
figure, imshow(imgCrop);
level = graythresh(imgCrop);
imgBW = im2bw(imgCrop, level-0.01);
figure, imshow(~imgBW);
% Mask Image - Create according to your Specific Application
imgMask = imread('mask.bmp');
figure, imshow(imgMask);
imgROI = imgMask .* (~imgBW);
figure, imshow(imgROI);
imwrite(imgROI, 'Tow.jpg');

댓글 수: 4

BERG
BERG 2020년 4월 28일
hello many thanks i will try it just another question is it the same for all image or the position is different ? i mean the coordinate
Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 4월 28일
Its same, for the shared images.
BERG
BERG 2020년 4월 28일
ok many thanks after i come back i will try it again
BERG
BERG 2020년 5월 7일
Hello i'm here again i did not ask you last time first thks you for your help i tried and it worked i just have a question how does the attached mask.bmp help me?

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

추가 답변 (0개)

카테고리

질문:

2020년 4월 21일

댓글:

2020년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by