provide the code in which given image find in 600 images in matlab?

조회 수: 2 (최근 30일)
Muhammad  Talha
Muhammad Talha 2018년 6월 10일
다시 열림: Rena Berman 2018년 8월 8일
..
  댓글 수: 4
Image Analyst
Image Analyst 2018년 7월 29일
Muhammad or someone mistakenly deleted the entire question except for the subject line "provide the code in which given image find in 600 images in matlab?" Can someone restore it?
Walter Roberson
Walter Roberson 2018년 7월 30일
Please do not close questions that have an answer.

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

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 6월 10일
편집: KALYAN ACHARJYA 2018년 6월 10일
% Save all 600 images name in a sequence manner before doing the operation
% names for example im1,im2,im3..or 1,2,3...so on
%Save the folder of images in the current directory
%read the given image-assume given image from 600 image folders, say image1.jpg
image=imread('image1.jpg'); % do this operation
gray_image=rgb2gray(image);
path_directory='folder_name'; % 'Folder name' having 600 images
original_files=dir([path_directory '/*.jpg']);
for k=1:length(original_files)
filename=[path_directory '/' original_files(k).name];
image_call=imread(filename);
image_search=rgb2gray(image_call);
sub=imsubtract(image_gray,image_search);
if sub==0
disp('Given Image found');
imshow(image_call);
break;
end
end
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 6월 10일
편집: KALYAN ACHARJYA 2018년 6월 10일
Question is answered and for other question open the new thread, so that other member also participate to help you.
chetna kaushal
chetna kaushal 2018년 8월 1일
Respected Kalyan sir, while reading 600 images automatically, suppose each image has five results to write on excel sheet in row form(not column). i want to save each image result in excel sheet in one row. second image result in second row of same columns and so on. what is its code?

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

추가 답변 (2개)

Image Analyst
Image Analyst 2018년 6월 10일
There are some things in Kalyan's answer that I don't like, namely using the built in function name "image" as the name of a variable, and converting to gray scale instead of simply using isequal() to check for a match. I offer my code below:
% Specify the folder where the files live.
myFolder = pwd; %or 'C:\wherever.....';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
% Read in the reference image
refFileName = fullfile(myFolder, 'refimage.jpg');
if ~exist(refFileName, 'file')
errorMessage = sprintf('Error: The following image does not exist:\n%s', refFileName);
uiwait(warndlg(errorMessage));
return;
end
% Load reference image and display it.
referenceImage = imread(refFileName);
subplot(1, 2, 1);
imshow(referenceImage);
title('Reference Image');
subplot(1, 2, 2); % Switch to right axes.
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.jpg'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
refImageFound = false;
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Display the image.
thisImage = imread(fullFileName);
imshow(thisImage); % Display image.
title(baseFileName);
drawnow; % Force display to update immediately.
if isequal(thisImage, referenceImage)
refImageFound = true;
uiwait(helpdlg('Found it!'));
break;
end
end
if ~refImageFound
uiwait(warndlg('Reference image not found!'));
end
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 6월 11일
Thank you Image Analyst sir, great advice. I will try to incorporate it in my future code.
Thanks again!

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


Umer  Lilla
Umer Lilla 2018년 6월 28일
You all are doing good job keep it up

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by