Detecting Length of Segmented Image in EmguCV C# -
the requirement measure distance of canny edged images on program. specific images i'm working on human feet. have done program via matlab. wanted make standalone program via c# have link measurements in database.
to this, i'm using matlab codes algorithm emgucv c# code on vs2013.
image segmentation codes converted c# codes. on matlab "boundingbox" equivalent drawing rectangles in emgucv. got stuck.
hard-coding more complex quite straightforward. there anyway measure length of segmented image via drawing rectangle or measuring endpoints of feet itself.
here's matlab codes converted c#
= imread('feet1.jpg'); %// pre-processing. treshold image , dilate it. level = 0.9; b = im2bw(a,level); %// detect edges f = edge(b,'canny'); figure; imshow(f); hold on; c#
private void opentoolstripmenuitem_click(object sender, eventargs e) { openfiledialog ofd = new openfiledialog(); if (ofd.showdialog()==dialogresult.ok) { _imginput = new image<bgr, byte>(ofd.filename); imagebox1.image = _imginput; } } public void applycanny(double thresh=50.0, double threshlink = 20.0) { if (_imginput == null) { return; } image<gray, byte> _imgcanny = new image<gray, byte>(_imginput.width, _imginput.height, new gray(0)); _imgcanny = _imginput.canny(thresh, threshlink); imagebox1.image = _imgcanny; } the remaining codes i'm stuck on converting:
%draw boundaries on canny edged image k = 1:length(b), boundary = b{k}; plot(boundary(:,2),boundary(:,1),'b','linewidth',2); end %measure boundaries measurements = regionprops(f, 'centroid', 'boundingbox'); centroid = measurements(1).centroid; bb = measurements(1).boundingbox; y1 = bb(2); % top of bounding box. y2 = bb(2)+bb(4); % bottom of bounding box. centroidtotoe = y2 - centroid(2); edit: adding codes
Comments
Post a Comment