[Users-fr] Problèmes d'affichage xrects, problème setbpt
Stef
stephane.franiatte at gmail.com
Mar 26 Fév 16:38:46 CET 2013
Et au fait, j'essaye d'afficher mes rectangles sur une image. Voici le code :
function [inspectedScene,Colors,Rects] = inspect(sceneImg, model, scene,
toleranceRadius)
inspectedScene = scene;
// Rects will contain scene blob bounding boxes
Rects = zeros(4,size(scene));
Colors = zeros(size(scene),1);
Colors(1:$,1) = -255;
// Iterate through the model
for i=1:size(model)
// For each scene object in the toleranceRadius around the current
model object
for j=1:size(scene)
if euclideanDst(model(i).centroid,scene(j).centroid) <
toleranceRadius then
// distance between feature points
distance =
euclideanDst(model(i).featurePoint,scene(j).featurePoint);
if inspectedScene(j).distance_model > distance then
// Keep distance to model blob
inspectedScene(j).distance_model = distance;
// Assign new label
inspectedScene(j).alocated_label = model(i).label;
// Keep the model feature point
inspectedScene(j).featurePointModel =
model(i).featurePoint;
// Create rect
Rects(1,j) = model(i).bounding_box(1);
Rects(2,j) = model(i).bounding_box(2);
Rects(3,j) = model(i).boundingBox_width;
Rects(4,j) = model(i).boundingBox_height;
// Allocate color
if distance < 0.5 then
Colors(j,1) = -20;
else
Colors(j,1) = -32;
end
end
end
end
end
// Draw results on sceneImg
sceneImgFigure = ShowImage(sceneImg, 'Results');
xrects(Rects,Colors);
endfunction
function d = euclideanDst(Q,D)
d = sqrt (sum(Q - D).^2);
endfunction
--
View this message in context: http://mailinglists.scilab.org/Users-fr-Problemes-d-affichage-xrects-probleme-setbpt-tp4026036p4026037.html
Sent from the Liste utilisateur (en français) mailing list archive at Nabble.com.
Plus d'informations sur la liste de diffusion users-fr