フィルターのクリア

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);
carbon_fiber.JPG

回答 (0 件)

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by