NURBS curve extraction from an image
5 views (last 30 days)
Show older comments
I am trying to extract the edge of an image and convert it to a NURBS curve. But it ended in vain. I am using NURBS toolbox for matlab. I am attaching the code i used below. The image i used is a simple circle image. Please help me out.
Code:
close all; clear all;
im=imread('im\1.bmp');
%imshow(im);
imBW=im2bw(im,.8);
%figure; imshow(imBW);
imE=edge(imBW);
imE=not(imE);
%figure; imshow(imE);
imSIZE=size(imE);
%NURB Curve Formation
imNRB=[];
KNT=[];
n=1;
tmp=[];
cnt=1;
Kcnt=1;
for i=1:imSIZE(1)
for j=1:imSIZE(2)
if imE(i,j) == 0
tmp=[tmp;i j];
if cnt == 2
imNRB(:,:,n)=tmp;
KNT{1,Kcnt}=[0 0 1 1];
n=n+1;
tmp=[];
cnt=0;
Kcnt=Kcnt+1;
end
cnt=cnt+1;
end
end
end
NRB=nrbmak(imNRB,KNT);
clear n;
nrbplot(NRB,[600 -600]);
And i have to attach this note. I am not well versed in NURBS.
Thank you :)
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!