How to use loops in Image processing
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello
I am new to programming, here i dont know how to use loops in Image processing and please help me out
Here i have to read images from from 2 cameras.
if the image is from cam1 then i should for 1st crop and if images is from cam2 i should go for 2nd crop how it can be done automatically whether to go for 1st crop or 2nd crop . please help me out Thanks in Advance
img= readim('cam1 or cam2.jpg');
img1=img{1};
% crop the image of cam1
%a = cut(img1,[885 1065],[13 59]);% crop the 1st image from daniela & change the values according to the image
%a = a{1};% convert RGB to Gray image
%b = cut(img1,[887 1069],[965 131]);%Crop the 2nd image from Daniela & change the values according to the image
%b = b{1};% convert RGB to Gray image
% Crop the Images of cam2
a = cut(img1,[847 1009],[75 111]);% crop the 1st image from Slave & change the values according to the image
a = a{1};% convert RGB to Gray image
b = cut(img1,[835 1004],[973 110]);% crop the 2nd image from Slave & change the values according to the image
b = b{1};% convert RGB to Gray image
%----------------------------------------------------------------------------------------------------------
c=b-91;
c(c<0)=0;
c(0:end,:)=c(end:-1:0,:); % flip the image if necessary
a=real(ift(extract(DampEdge(ft(a)),size(b))));% make the size of 'a' equal to 'b' or else b = a but always apply this funcion to larger image to convert to small
c=real(ift(extract(DampEdge(ft(c)),size(a))));%for Daniela image
0 comentarios
Respuestas (1)
Uttiya Ghosh
el 19 de Jun. de 2020
Hi Raviteja,
From my understanding you would like to perform different operations on an image based on whether the image was captured from camera 1 or camera 2. I am assuming your images have the name with the format "<imagName>_<camType>.jpg"
fileName="img1_cam1.jpg";
imgName=strsplit(fileName,'_');
imgName=imgName(2);
camType=strsplit(imgName,'.');
camType=camType(1);
if (strcmp(camType,"cam1"))
% Crop the image of cam1
else
% Crop the image of cam2
end
For reading images in MATLAB use the imread function. You may refer to the link below.
0 comentarios
Ver también
Categorías
Más información sobre Camera Calibration en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!