how to convert array to double

조회 수: 2 (최근 30일)
saeed ahmed
saeed ahmed 2019년 4월 18일
댓글: Jan 2019년 4월 21일
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
saeed ahmed
saeed ahmed 2019년 4월 19일
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 2019년 4월 21일
"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

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by