Clear Filters
Clear Filters

detecting ARtag in a video

1 view (last 30 days)
NASADUDE
NASADUDE on 28 Feb 2017
so I have a project where I need to detect an ARtag in a video, then decode it and determine what number it is (0,1, or 2) then use hemography to replace it with a different picture, then replace it with a 3d cube and have a video of the replaced 3d cube for 4 seconds, 30 frames per second, can someone help me with that this is how far I got
clc
clear all
clear all figures
s0= vid('Tag0.mp4');
s1= vid('Tag1.mp4');
s2= vid('Tag2.mp4');
T0 = (s0(448).cdata);
T1 = (s1(325).cdata);
T2 = (s2(495).cdata);
[TAG0,CRP0] = im(T0);
[TAG1,CRP1] = im(T1);
[TAG2,CRP2] = im(T2);
A0 = SS(CRP0);
A1 = SS(CRP1);
A2 = SS(CRP2);
NUM0 = CC(A0);
NUM1 = CC(A1);
NUM2 = CC(A2);
[TT,RR,QQ] = harris(CRP0,0.1,0.4);
function s = vid(video)
vidObj = VideoReader(video);
vidHeight = vidObj.Height;
vidWidth = vidObj.Width;
s = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'));
k = 1;
while hasFrame(vidObj)
s(k).cdata = readFrame(vidObj);
k = k+1;
end
end
function [BW,CROP] = im(image)
T_Gaus= imgaussfilt(image);
BW = im2bw(T_Gaus,0.9);
BB = regionprops(~BW,'BoundingBox');
CROP = imcrop (BW, [BB(2).BoundingBox]);
end
function [ARRAY] = SS(image)
[R,C] = size(image);
L=floor(R/8);
W=floor(C/8);
for m = 1:8
for n = 1:8
ARRAY(m,n) = image(round(L/2+(m-1)*L),round(W/2+(n-1)*W));
end
end
end
function [NUM] = CC(array)
D = array;
if D(4,5)==1&&D(5,4)==1
NUM =0
else
if D(4,5)==0
NUM = 2
else
NUM =1
end
end
end
the function harris is from Peter Corke's Machine Vision Toolbox and Peter Kovesi's MATLAB functions can someone tell me where to go from there I attached the actual project and I am not looking for someone to solve it for me I am just looking for guidance on how to finish it.

Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!