matlab and database connection
Show older comments
Im doing my final year project in image processing.In my code i have detected the face region and scrambled it by using a secret key.I need to allow only an authorised user to revert the scrambling process by using the secret key..Is it possible to store the scrambled output video in a database..how to export the scrambled output to a database .can someone suggest me a solution
clc;clear;close all
clear
readerobj = mmreader('vipcolorsegmentation.avi', 'tag', 'myreader1');
vidFrames = read(readerobj);
numFrames = get(readerobj, 'numberOfFrames');
prompt='Enter the User key';
dlg_title='Enter User key';
userkey = inputdlg(prompt,dlg_title)
userkey =userkey{1,1}
for k = 1 : 6
scale=1;
mov(k).cdata = vidFrames(:,:,:,k);
mov(k).colormap = [];
mov(k).cdata=imresize(mov(k).cdata,[384 512]);
mov(k).cdata=double(rgb2gray(mov(k).cdata));
Face = FaceDetect('haarcascade_frontalface_alt2.xml',mov(k).cdata);
if Face~=-1
out=zeros(5,4);
% Use only the biggest Face found and rescale bounding box to original
% size
pos = find( Face(:,3)==max(Face(:,3)));
pos=pos(1);
out(1,:)=(Face(pos,:)*scale);
ret=out(1,:);
RECT=[ret(1,1),ret(1,2),ret(1,3),ret(1,4)];
I1=imcrop(mov(k).cdata,RECT);
%figure(2),imshow(I1,[])
[r1 c1]=size(I1);
r = randperm(r1);
c = randperm(c1);
J = I1(r,c,:);
x1=ret(1,1)
x2=ret(1,2)
x3=ret(1,3)
i1=0;
j2=0;
i1=x1;
for i=1:r1
j2=x2;
for j=1:c1
mov(k).cdata(i1,j2) =J(i,j);
j2=j2+1;
end
i1=i1+1;
end
mov(k).jdata=J
mov(k).r1data=r;
mov(k).c1data=c;
mov(k).retdata=ret;
figure(1)
imshow(mov(k).cdata,[]),impixelinfo()
save output mov
end
end
% stream
% %==========================================================================
stream=readerobj;
if nargin < 2; %Inspects input stream
if isinteger(stream)... %If integer...
&& (size((unique(stream)),2) == 2)... %and has two symbols...
&& isa(stream,'uint8')... %and a usigned 8 bit integer stream...
&& ~(size(size(stream),2)~=2)... %and is 2D...
&& (size(stream,1) == 1 && size(stream,2) > 0)... %and is 1D horizontal...
&& sum(unique(stream)) == 1 %and is binary stream
type = 'dec';
else
type = 'enc';
end
end
%==========================================================================
%entropy Encoding
%==========================================================================
stream=readerobj;
for i = 3:6
if isa(stream, num2str(2^i,'uint%i'));bitdepth = 2^i;end;
end
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
entropystream = uint8([]);
NYT = unique(stream);
NYTlocation =NYT
n = length(stream);
nodenumber = (2*n);
Answers (1)
Image Analyst
on 18 Mar 2012
0 votes
What database do you have? You mean like Oracle? Would just a simple mat format file work for you? It would be a lot easier than a formal full fledged database.
Categories
Find more on Read, Write, and Modify Image 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!