how to convert array to double

4 views (last 30 days)
saeed ahmed
saeed ahmed on 18 Apr 2019
Commented: Jan on 21 Apr 2019
i had made extract to image feature to compare by a snapshot by a webcam but i cant make if statement for this array
660×1 SURFPoints array with properties:
Scale: [660×1 single]
SignOfLaplacian: [660×1 int8]
Orientation: [660×1 single]
Location: [660×2 single]
Metric: [660×1 single]
Count: 660
so i can make if there subtraction = to zero make the if statement else do other statement
  3 Comments
saeed ahmed
saeed ahmed on 19 Apr 2019
ok this is an image i extracted is features and i capture photo by a webcam and get the similar between the two pics if they are the same or not as illustrated in the attactment the left pic is the input image and the right is captured by cam now i wanna put a condition that if they are similiar to each other or have common points it will make a rectangle around this object and here is my code also
clear all
clc
box=imread('Box3.jpg');
c=rgb2gray(box);
boxPoints = detectSURFFeatures(c);
[boxFeatures, box_Points] = extractFeatures(c, boxPoints);
figure,imshow(c);
a=webcam;
a.resolution= '640x480';
Obj=snapshot(a);
b=rgb2gray(Obj)
figure,imshow(b);
scenePoints = detectSURFFeatures(b);
[sceneFeatures, scenePoints] = extractFeatures(b, scenePoints);
%if(x==0)
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
[tform, inlierBoxPoints, inlierScenePoints] = ...
estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
figure;
showMatchedFeatures(c, b, inlierBoxPoints, ...
inlierScenePoints, 'montage');
diff_im=imsubtract(Obj(:,:,1),rgb2gray(Obj));
diff_im=medfilt2(diff_im,[3,3]);
diff_im=im2bw(diff_im,0.18);
diff_im=bwareaopen(diff_im,300);
bw=bwlabel(diff_im,8);
props = regionprops(bw, 'Centroid','Orientation','BoundingBox');
figure, imshow(Obj)
hold on
center=props(1).Centroid;
plot(center(1), center(2), '-m+')
angle = props(1).Orientation
Rec= props(1).BoundingBox
rectangle('Position',Rec,'EdgeColor','r','LineWidth',2)
text(round(center(1))-50, round(center(2))+20, ['The Cenroid','(',...
num2str(round(center(1))), ',' , num2str(round(center(2))), ')'], 'BackgroundColor', [0 1 1]);
text(round(center(1))-50, round(center(2))+45, ['Rotation Angle from right horizontal',' ', num2str(angle)], 'BackgroundColor', [0 1 1]);
%end
x=box_Points
untitled3.jpg
Jan
Jan on 21 Apr 2019
"between the two pics" - there is one image only.
I do not understand the rest of the text. Please use the standard commas and dots to make it easier to read it.
I still do not see, how your code and the explanatipons are related to "how to convert array to double". Please read: TUTORIAL: how to ask a question (on Answers) and get a fast answer

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!