Effacer les filtres
Effacer les filtres

I am trying to perform template matching on a carbon fiber filament. I extracted a template from the image. My o/p is only highlighting the extracted image and not all the fibers. I also want to count the number of fibers detected.

1 vue (au cours des 30 derniers jours)
%Test code to perform template matching
%Date:Nov-13-2018
clear all
close all
clc
R=zeros();
%Importing Original Image
I=imread('filament.jpg');
%Converting the original image to grayscale
%Getting the size of the original image
[Ir, Ic] =size(I);
%Displaying the orignal image
figure (1)
imshow(I);
%Importing the template image
CROP=imread('carbon_fiber.jpg');
%Converting the cropped image into grayscale
T=rgb2gray(CROP);
%Getting the size of the matrix of the template
[Tr, Tc]=size(T);
figure (2)
imshow(T);
R=normxcorr2(T,I);
R=imcrop(R,[Tc Tr Ic Ir]);
[r, c, v]= find (R==max(max(R)));
RGB= insertShape(I,'rectangle',[c r Tc Tr],'LineWidth',3);
figure(3)
imshow(RGB);
carbon_fiber.JPG

Réponses (0)

Catégories

En savoir plus sur Import, Export, and Conversion dans Help Center et File Exchange

Produits


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by