matlab - Smooth and fit edge of binary images -


i working on research swimming of fishes using analysis of videos, need images (obtained video frames) emphasis in tail.

the images in high-resolution , software customize works binary images, because easy use maths operations on this.

for obten binary images use 2 methods:

1)convert image gray, invert colors,later bw , binary treshold give me images this, nothing of noise. images loss bit of area , doesn't tail(now need more acurracy determinate amplitude of tail moves) image 1

2)i use code, cut border increase threshold, give me image of edge, dont know joint these point , smooth image, or fitting binary images, app fitting of matlab 2012rb doesn't give me graph , don't have access toolboxs of matlab.

s4 = imread('arecorte.bmp'); a=[90 90 1110 550] s5=imcrop(s4,a) e = edge(s5,'canny',0.59); 

image2

my question

how can fit binary image or joint points , smooth without disturb tail?

or how can use edge of image 2 increase acurracy of image 1?

i upload image in comments give me idea of method 2), because can't post more links, please remember working iterations , can't work frame frame.

note: if ask because in dead point , don't have resources pay this, until moment able write code in final problem can't alone.

i think should use connected component labling , discard small labels , extract labels boundary pixels of each part

the code:

clear  % read image = imread('fish.jpg');  % don't need haef allready bw image ibw = rgb2gray(i);  ibw(ibw < 100) = 0;  % find size of image [row,col] = size(ibw);  % find connceted components cc = bwconncomp(ibw,8);  % find area of compoennts stats = regionprops(cc,'area','pixelidxlist'); areas = [stats.area];  % sort areas [val,index] = sort(areas,'descend');  % take 2 largest comonents ids , create filterd image ibwfilterd = zeros(row,col); ibwfilterd(stats(index(1,1)).pixelidxlist) = 1; ibwfilterd(stats(index(1,2)).pixelidxlist) = 1; imshow(ibwfilterd);  % find pixels of border of main component , tail boundries = bwboundaries(ibwfilterd);  ycorrdainteofmainfishbody = boundries{1}(:,1); xcorrdainteofmainfishbody = boundries{1}(:,2); linearcorrdmainfishbody = sub2ind([row,col],ycorrdainteofmainfishbody,xcorrdainteofmainfishbody);  ycorrdainteoftailfishbody = boundries{2}(:,1); xcorrdainteoftailfishbody = boundries{2}(:,2); linearcorrdtailfishbody = sub2ind([row,col],ycorrdainteoftailfishbody,xcorrdainteoftailfishbody);  % visoulaztion put color boundries ifinal = zeros(row,col,3); ifinalchannel = zeros(row,col);  ifinal(:,:,1) = ifinalchannel;  ifinalchannel(linearcorrdmainfishbody) = 255; ifinal(:,:,2) = ifinalchannel;  ifinalchannel = zeros(row,col); ifinalchannel(linearcorrdtailfishbody) = 125; ifinal(:,:,3) = ifinalchannel; imshow(ifinal); 

the final image: enter image description here


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -