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 回表示 (過去 30 日間)
古いコメントを表示
%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);
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Import, Export, and Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!