real time smartphone camera processing
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
I installed IP Webcam app onto my android phone. When I start the server, it begins to stream pictures (frames) of the camera, and I can process it with matlab in the following way:
url = 'http://192.168.1.109:8080/shot.jpg';
cam = imread(url);
img = image(cam);
tic;
while(toc < 5)
cam = imread(url);
set(img,'CData',cam);
drawnow;
toc;
end
So my question: I would like to calculate the intensity of pixels (240 x 320) for each frame and store it in an array. How can i do this? Thanks you for help!
1 comentario
Zarish Akeel
el 13 de Jun. de 2017
What was your MATLAB version? I'm using MATLAb 2013a but this code isn't running on that version.
Respuestas (2)
Image Analyst
el 7 de Nov. de 2014
I'd think you would do something like this (untested):
% Retrieve current (next) image.
cameraImage = imread(url);
hImage = image(cameraImage);
lastPhoto = cameraImage;
difference = 1;
% Set up a failsafe so we don't go on forever.
maxCounter = 100; % Max number you ever want to analyze.
counter = 1;
while difference ~= 0 && counter <= maxCounter
% Continue until image does not change anymore...
theMeans = mean(cameraImage(:));
% Retrieve current (next) image.
cameraImage = imread(url);
counter = counter + 1;
set(img,'CData', cameraImage);
drawnow;
% Compute difference to see if it changed.
diffImage = double(cameraImage) - double(lastPhoto);
difference = nnz(diffImage);
% Delay some to give time for next photo to arrive at the URL.
pause(2);
end
plot(theMeans, 'bs-', 'LineWidth', 3);
grid on;
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Mobile en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!